topical media & game development
server-php-micro-db-installer-index.php / php
<?php
/*------------------------------------------------------------------------------------------
Micro DB Installer
ŠPhpToys 2007
http://www.phptoys.com
Released under the terms and conditions of the
GNU General Public License (http://gnu.org).
USAGE:
Just copy the files to your webserver with a valid sql file.
You can configure the sql file name by changing the
sqlErrorText = '';
sqlStmt = '';
_SERVER['PHP_SELF']; ?>" method="post" name="dbdata">
<table width="100%">
<tr><td>Hostname:</td><td><input class="text" name="hostname" type="text" size="20" value="localhost" /></td></tr>
<tr><td>Username:</td><td> <input class="text" name="username" type="text" size="20" value="" /></td></tr>
<tr><td>Password:</td><td> <input class="text" name="password" type="password" size="20" value="" /></td></tr>
<tr><td align="center" colspan="2"><br/><input class="text" type="submit" name="submitBtn" value="Install" /></td></tr>
</table>
</form>
<?php
if (isset(host = isset(_POST['hostname'] : '';
_POST['username']) ? pass = isset(_POST['password'] : '';
host,pass);
if (f = fopen(sqlFile = fread(sqlFileToExecute));
sqlFile);
//Process the sql file by statements
foreach (stmt) {
if (strlen(result = mysql_query(result){
sqlErrorText = mysql_error();
stmt;
break;
}
}
}
}
?>
<div class="caption">RESULT:</div>
<div id="icon2"> </div>
<div id="result">
<table width="100%">
<?php
if (sqlErrorCode</td></tr>";
echo "<tr><td>Error text: sqlStmt</td></tr>";
}
?>
</table>
</div>
<?php
}
?>
<div id="source">Micro DB Installer 1.0</div>
</div>
</body>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.