Update of /cvsroot/openfirst/members
In directory sc8-pr-cvs1:/tmp/cvs-serv31161
Added Files:
sqlinstall.php
Log Message:
Add basic SQL install script.
--- NEW FILE: sqlinstall.php ---
<?php
/*
* openFIRST.members - sqlinstall.php
*
* Copyright (C) 2003,
* openFIRST Project
* Original Author: Tim Ginn <tim...@po...>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
include("../config/globals.php");
include($header);
if($user->membertype == "administrator") {
?>
<h1>SQL Install</h1>
<p>This utility will create the tables required for certain openFIRST
components to run. Select the SQL scripts you would like to
install...</p>
<form method="post" action="sqlinstall.php">
<?php
if($ostype == "unix") {
$sqlfiles = `ls -w1 ../*/*.sql`;
} else {
$sqlfiles = `dir ../*/*.sql`;
}
$sqlfiles = split("\n", $sqlfiles);
for ($i=0; $i + 1 < count($sqlfiles); $i++) {
$sqlf = str_replace(".", "", str_replace(".sql", "", substr(strrchr($sqlfiles[$i], "/"), 1)));
echo("<br /> <input type='checkbox' name='$sqlf'>$sqlf</input>");
if($_POST[$sqlf] == "on") {
// This doesn't quite work. I'm not sure why.
$query = mysql_query(`cat $sqlfiles[$i]`);
echo(" - <b>Submitted.</b>");
}
}
?>
<br /><input type="submit" value="Create Tables" />
</form>
<?php } else {
showlogin();
}
include($footer); ?>
|