[Openfirst-cvscommit] base/config first.php,1.29,1.30
Brought to you by:
xtimg
From: Tim G. <xt...@us...> - 2004-04-05 11:26:38
|
Update of /cvsroot/openfirst/base/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28495 Modified Files: first.php Log Message: Add functionality to create a database if it does not already exist, and the user information given has sufficient database access to do so. Index: first.php =================================================================== RCS file: /cvsroot/openfirst/base/config/first.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** first.php 5 Apr 2004 10:26:40 -0000 1.29 --- first.php 5 Apr 2004 11:13:46 -0000 1.30 *************** *** 38,41 **** --- 38,56 ---- if(isset($_POST["ostype"])) { + include_once("./dbase.php"); + $sqlserver = '" . $_POST["sqlserver"] . "'; + $sqluser = '" . $_POST["sqluser"] . "'; + $sqlpassword = '" . $_POST["sqlpassword"] . "'; + $sqldatabase = '" . $_POST["sqldatabase"] . "'; + if(function_exists(\"ofirst_dbconnect\") == false) { + die(\"Your version of PHP has not been compiled with MySQL support, therefore the openFIRST web portal system cannot run on this system. Please contact your system administrator to request MySQL support for your version of PHP.\"); + } + $sqlconnection = ofirst_dbconnect("$sqlserver","$sqluser","$sqlpassword"); + + /* Create database if it does not already exist */ + ofirst_dbquery("CREATE DATABASE IF NOT EXISTS $sqldatabase;"); + + ofirst_select_db($sqldatabase); + // They have submitted the form, write a new globals.php file and test // options. *************** *** 65,72 **** if (\$ostype == \"windows\") { ini_set(\"include_path\",\"../config/;.\"); ! include('dbase.php'); } else { ini_set(\"include_path\",\"../config/:.\"); ! include('dbase.php'); } --- 80,87 ---- if (\$ostype == \"windows\") { ini_set(\"include_path\",\"../config/;.\"); ! include_once('dbase.php'); } else { ini_set(\"include_path\",\"../config/:.\"); ! include_once('dbase.php'); } *************** *** 258,263 **** </tr> <tr> ! <td>Database Name<br> <font size="1">(this database must already exist, ! it will not be automatically created)</font></td> <td><input type="text" name="sqldatabase" value="openfirst" /></td> </tr> --- 273,278 ---- </tr> <tr> ! <td>Database Name<br> <font size="1">(if this database does not already exist, the user entered above ! must have access to create it)</font></td> <td><input type="text" name="sqldatabase" value="openfirst" /></td> </tr> |