server-php-db-browser-dbbrowser.php / php
<?php /*------------------------------------------------------------------------------------------ DB Browser �PhpToys 2006 http://www.phptoys.com Released under the terms and conditions of the GNU General Public License (http://gnu.org). USAGE: Just copy the file to your webserver and load it. --------------------------------------------------------------------------------------------*/ session_start(); sqlerror = ""; if (isset(sitemode=_GET['db'])) { _GET['db']; dbname;} if (isset(tablename=_SESSION['table']=//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <head> <title>DB Browser</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="ctr"> <div class="login"> <div class="lform"> <div class="text">Database Browser</div><br/> <div class="fblock"> <?php if ((sitemode == 0) && (!isset(<form action="<?php echo _SERVER['PHP_SELF']; ?>" method="post" name="convertForm"> <table width="100%" > <tr align=left> <td class="text">Hostname:</td> <td><input name="hostname" value="localhost" /></td> </tr> <tr align=left> <td class="text">User name:</td> <td><input name="username" value="" /></td> </tr> <tr align=left> <td class="text">Password:</td> <td><input name="password" type="password" value="" /></td> </tr> <tr> <td style="text-align: center;" colspan="2"><br/><input type="submit" name="submitdb" value="Show databases" /></td> </tr> </table> </form> <?php } if ((_POST['submitdb']))){ _POST['hostname']; _POST['username']; _POST['password']; hostname; username; password; hostname, password); if (!sitemode=1; } if (result = mysql_query('SHOW databases'); if (!<table width="300"><tr><th width="100">Nr.</th><th>Database name:</th></tr>'; i=1; while (result, MYSQL_NUM)) { echo '<tr><td align="center">'.</td><td align="left"><a href="'._SERVER['PHP_SELF'].'?mode=2&db='.row[0].'</a></td></tr>'; </table>"; mysql_free_result(result); mysql_close(sitemode == 2) { _SESSION['hostname'],_SESSION['password'] ); if (!_SESSION['dbname']); result) die('Invalid query: ' . mysql_error()); echo '<table width="300"><tr><th width="100">Nr.</th><th>Tables in '.</th></tr>'; i=1; while (result, MYSQL_NUM)) { echo '<tr><td align="center">'.</td><td align="left"><a href="'._SERVER['PHP_SELF'].'?mode=3&table='.row[0].'</a></td></tr>'; </table>"; mysql_free_result(result); mysql_close(sitemode == 3) { _SESSION['hostname'],_SESSION['password'] ); if (!_SESSION['dbname']); _SESSION['table']); if (!<table width="100%" cellspacing="0" cellpadding="0">'; i=1; while (result, MYSQL_ASSOC)) { if (<tr>'; foreach (row as value) { echo '<th class="th1"> '.</th>'; } echo '</tr>'; } echo '<tr>'; foreach (row as value) { if ( value=" "; echo '<td class="td1"> '.</td>'; } echo '</tr>'; i++; } if (</table>"; mysql_free_result(result); mysql_close(</div> <div class="text2">Micro Database Browser 1.1</div><br/> </div> </div> </div> </body> </html>
(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.