Connexion à une base de données...
...Sans commentaires.
...Sans commentaires.
Database connection ...
... No comments.
... No comments.
الاتصال بقاعدة البيانات ...
بدون تعليقات
Open in a new window
<?
//##################################################
// find more scripts on scripts-n-codes.blogspot.com
//################## EDIT BELOW ####################
$dho = "CHANGE ME"; //hostname
$dus = "CHANGE ME"; //username
$dpa = "CHANGE ME"; //password
$ddb = "CHANGE ME"; //db user
//##################################################
?>
<html>
<head>
<title>Codes | Scripts</title>
<style>
.fonta{font-family: san-serif; font-weight: 600; color: #629669; font-size: 17px;}
.mainstyle{font-family: san-serif; font-weight: 600; color: #ffffff; font-size: 17px; height: 22px;}
.mainstyle:hover{TEXT-DECORATION: none; color: #236623;}
.mainstyle2{ font-family: san-serif; font-weight: 600; color: #7d7d7d; font-size: 17px; height: 22px;}
.mainstyle2:hover{TEXT-DECORATION: none; color: #552255;}
</style>
</head>
<body style="border: 5px solid #000000; margin: 0px; font-family: arial, verdana, san-serif; font-size: 14px;">
<?php
$type=$_POST['type'];
$qtext = $_POST['qtext'];
$qtext = str_replace("\\","",$qtext);
$user = $_POST['user'];
$pass = $_POST['pass'];
$host = $_POST['host'];
$dbn = $_POST['dbname'];
if($user != "" && $host != "" && $dbn != "")
{
$hostname = $host;
$username = $user;
$password = $pass;
$dbname = $dbn;
}
$db = @mysql_connect($hostname, $username,$password);
if(!$db)
$con = "conf";
else if(!@mysql_select_db($dbname,$db))
$con = "dbnf";
?>
<table width=100% height=100% bgcolor=#adadad border=0 cellpadding=0 cellspacing=0
style="font-family: arial, verdana, san-serif; font-size: 14px;">
<tr bgcolor=#989898 height=60>
<td height=60 bgcolor=#000000 style="font-family: san-serif; font-weight: 600;
color: #EEEEEE; font-size: 17px;" align=center>
HIOX DBQ 1.1<br>
<font size=-1><a style="color: #dddddd;" href="http://www.hscripts.com">www. h s c r i p t s .com</a></font>
</td>
</tr>
<script language=javascript>
function changae()
{
var ss = document.ssd.dd.value;
document.form15.qtext.value = ss;
}
function confirmDel()
{
document.form15.user.value = document.f14.un.value;
document.form15.pass.value = document.f14.pw.value;
document.form15.host.value = document.f14.hn.value;
document.form15.dbname.value = document.f14.dbn.value;
var sss = document.form15.qtext.value;
if(sss.indexOf("delete") != -1 || sss.indexOf("alter") != -1)
{
var dd = confirm("You are trying to do a delete or modify operation, press ok to continue.");
if(dd == true)
return true;
else
return false;
}
}
function changedef()
{
document.f14.hn.value = document.f14.hh.value;
document.f14.un.value = document.f14.uu.value;
document.f14.pw.value = document.f14.pp.value;
document.f14.dbn.value = document.f14.dd.value;
}
</script>
<tr bgcolor=#989878 height=90%>
<td width=100% align=center valign=top>
<br>
<table cellpadding=0 cellspacing=0 align=center style="background-color: #efaaff;
padding: 1px; font-family: arial, verdana, san-serif;" border=1>
<tr align=center><td></td><td>Host</td><td>DB Name</td><td>User</td><td>Pass</td></tr>
<tr><td><form name=f14 onsubmit="return false">
<input type=button name=def value=def onclick="changedef()"></input></td>
<td><input size=10 type=text name=hn value="<?php echo($hostname); ?>"></input></td>
<td><input size=10 type=text name=dbn value="<?php echo($dbname); ?>"></input></td>
<td><input size=10 type=text name=un value="<?php echo($username); ?>"></input></td>
<td><input size=10 type=text name=pw value="<?php echo($password); ?>"></input></td>
<input type=hidden name=uu value="<?php echo($dus); ?>"></input>
<input type=hidden name=pp value="<?php echo($dpa); ?>"></input>
<input type=hidden name=dd value="<?php echo($ddb); ?>"></input>
<input type=hidden name=hh value="<?php echo($dho); ?>"></input></form>
</tr>
<tr><td colspan=5>
<form name=ssd>
<select name=dd onchange="changae()" size=2 style="width:410px;">
<option value="select * from ">select * from </option>
<option value="select count(*) from ">select count(*) from </option>
<option value="show tables">show tables</option>
<option value="show databases">show databases</option>
<option value="insert in to ">insert in to </option>
<option value="desc">desc</option>
</select>
</form>
</td></tr>
</table>
<br>
<form name="form15" method="post" action="dbq.php" onsubmit="return confirmDel()">
<input type="hidden" name="user" value="<?php echo($username);?>">
<input type="hidden" name="pass" value="<?php echo($password);?>" >
<input type="hidden" name="host" value="<?php echo($hostname);?>" >
<input type="hidden" name="dbname" value="<?php echo($dbname);?>" >
<input type="hidden" name="type" value="query" >
Query <input type="text" name="qtext" value="<?php echo($qtext);?>" size=60>
<input type="Submit" name="submit" value="Go">
</form>
<br>
<?php
if($con == "dbnf")
echo "<font color=red>Wrong database name<br></font>";
if($con == "conf")
echo "<font color=red>Connection Failed<br></font>";
else if($type =="query")
{
$qtext2 = str_replace("\\", " ", $qtext);
if($qtext2 == "")
{
echo "Please enter a proper query";
}
else
{
if($result = mysql_query("$qtext2",$db))
echo "Successly Exected - ";
else
echo "<font color=red>Not able to execute the query<br>Either the
table doesnot exist or a wrong query.</font><br><br>";
echo("Query is : ");
echo("<font color=blue>".$qtext2."</font>");
echo "<table border=1 cellpadding=0 cellspacing=0 width=80% style=\"font-size: 14px; font-family: arial;\">
<tr bgcolor=green align=center style=\"font-weight: bold;\">\n";
$sds = @mysql_num_fields($result);
for($ss=0; $ss<$sds; $ss++)
{
$ee = @mysql_field_name($result,$ss);
echo "<td bgcolor=green>$ee</td>";
}
echo "</tr>\n";
$vv = true;
while ($line = @mysql_fetch_array($result, MYSQL_ASSOC)) {
if($vv === true){
echo "<tr align=center bgcolor=#ffeeff>\n";
$vv = false;
}
else{
echo "<tr align=center bgcolor=#ffccff>\n";
$vv = true;
}
foreach ($line as $col_value) {
echo "<td>$col_value</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
/* Free resultset */
@mysql_free_result($result);
}
}
?>
</td>
</tr>
<tr bgcolor=#989878>
<td align=center valign=top bgcolor=#969476>
<br>
<font size=-1>
Ubugnu | <a href='http://scripts-n-codes.blogspot.com'>http://scripts-n-codes.blogspot.com</a>
</font>
</td>
</tr>
</table>
</body>
</html>