[Openfirst-cvscommit] members sqlinstall.php,1.2,1.3
Brought to you by:
xtimg
From: <xt...@us...> - 2003-06-01 15:15:17
|
Update of /cvsroot/openfirst/members In directory sc8-pr-cvs1:/tmp/cvs-serv27988 Modified Files: sqlinstall.php Log Message: Make an actual attempt at having the SQL tables work... this appears to work fine for me, could someone please test this on Windows? Do the slashes need to be the other way around for it? Index: sqlinstall.php =================================================================== RCS file: /cvsroot/openfirst/members/sqlinstall.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sqlinstall.php 24 May 2003 18:33:44 -0000 1.2 --- sqlinstall.php 1 Jun 2003 15:15:13 -0000 1.3 *************** *** 41,60 **** <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" /> --- 41,61 ---- <form method="post" action="sqlinstall.php"> <?php ! foreach (glob("../*/*.sql") as $filename) { ! $sqlf = str_replace(".", "-", str_replace(".sql", "",substr(strrchr($filename, "/"), 1))); ! echo("<br /> <input type='checkbox' name='$sqlf'>$sqlf</input>"); ! if($_POST[$sqlf] == "on") { ! // This doesn't quite work. I'm not sure why. ! $sf = fopen($filename, "r"); ! $query = ""; ! while($line = fgets($sf)) { ! if(substr($line, 0, 2) != "--" && substr($line, 0, 1) != "#") { ! $query = $query . $line; ! } ! } ! $q = mysql_query(trim($query)); ! echo(" - <b>Submitted, and added.</b>"); ! } ! } ?> <br /><input type="submit" value="Create Tables" /> |