<?php $host = ''; $user = '******'; $pass = '******'; $db = @mysql_connect('localhost', $user, $pass); //$out = getStructure($db, $dbname); $dbname = @$_REQUEST['dbname']; $out = array(); if (trim($dbname) != "") { $out = getForeginKey($db, $dbname); $struct = getStructure($db, $dbname); } $databases = getDatabaseNames($db); drawInterface($dbname, $out, $struct, $databases); function drawInterface($dbname, $out, $struct, $databases) { echo "<html><head><title>sGrep</title></head><body>"; echo "<style>a:link, a:hover, a:active, a:visited{color:black;text-decoration: none;}</style>"; echo "<div class='bar'>"; echo "<span><b>Databases</b>: </span>"; foreach ($databases as $database) { echo " <span><a href='?dbname={$database}' style='color:blue;'>{$database}</a></span> | "; } echo "</div>"; echo "<h1>Graf</h1>"; echo "<div class='draw' >"; draw($out); echo "</div>"; echo "<div class='structure' >"; echo "<h1>Short structure</h1>";
$column = @$_REQUEST['column']; $out = ""; if ($command == 'structure') { $out = getStructure($db, $dbname); } else { if ($command == 'indexies') { $out = getIndexies($db, $dbname); } else { if ($command == 'keys') { $out = getForeginKey($db, $dbname); } else { if ($command == 'tables') { $out = getTableNames($db, $dbname, $table); } else { if ($command == 'databases') { $out = getDatabaseNames($db, $dbname, $table); } else { if ($command == 'search' && trim($word) != "" && strlen(trim($word)) > 2) { $dbnames = array(); $tables = array(); $columns = array(); if ($selector != "") { $parts = explode("|", $selector); if (isset($parts[0])) { $dbnames = explode(",", $parts[0]); } if (isset($parts[1])) { $tables = explode(",", $parts[1]); } if (isset($parts[2])) { $columns = explode(",", $parts[2]);