'No database slected' error
Scris: Vin Dec 09, 2011
Mereu cand folosesc scriptul...No database selected ...
Config:
Scriptul a fost la inceput criptat si am folosit un decoder online care mi la dat cu X-uri in loc de "a" sau ")" si l`am rescris eu.
Cod: Selectaţi tot
<?php
require_once('cfg/config.php');
$MySQL=mysql_connect($myhost,$myuser,$mypass);
mysql_select_db($accdb);
$name = $_POST['accid'];
$datetime = date('Y-m-d H:i:s');
$ip = $_SERVER[REMOTE_ADDR];
if($_POST['submit'])
{
if ($name==false)
{
echo 'Please Type In Your Account ID!';
}
else
{
$idchk=mysql_query("SELECT * FROM accounts WHERE `name`=(".$name.")") or die (mysql_error());
$mail=mysql_fetch_assoc($idchk);
mysql_select_db($mydb);
$user=mysql_query("SELECT * FROM `cq_user` WHERE `account_id`=(".$mail['id'].")") or die (mysql_error());
$id=mysql_fetch_assoc($user);
if(mysql_num_rows($idchk)== 0)
{
echo 'This AccountID Does Not Exist!';
}
else
{
$voteip=mysql_query("SELECT * FROM `vote` WHERE `ip`=(".$ip.")") or die (mysql_error());
if(mysql_num_rows($voteip)== 0)
{
$votemail=mysql_query("SELECT * FROM `vote` WHERE `email`=(".$mail['email'].")") or die (mysql_error());
if(mysql_num_rows($votemail)==0)
{
echo "<meta http-equiv=\"refresh\" content=\"0;url=".$url."\" />";
mysql_query("INSERT INTO vote SET `email`=(".$mail['email']."),`ip`=(".$ip."), `timestamp`=(".date('Y-m-d H:i:s').") ") ;
mysql_query("UPDATE cq_user SET `emoney`=`emoney`+(".$emoney.") where id=(".$id['id'].")") ;
echo 'Your Voting Genreted Sucssesfuly';
}
else
{
$votemail2=mysql_query("SELECT * FROM `vote` WHERE `email`=(".$mail['email'].") AND UNIX_TIMESTAMP(`timestamp`) <= UNIX_TIMESTAMP((" .date('Y-m-d H:i:s', strtotime('-12 Hours'))."))") or die (mysql_error());
if(mysql_num_rows($votemail2)==0)
{
echo 'You Have Already Voted!';
}
else
{
$voteip2=mysql_query("SELECT * FROM `vote` WHERE `ip`=(".$ip.") AND UNIX_TIMESTAMP(`timestamp`) <= UNIX_TIMESTAMP((" .date('Y-m-d H:i:s', strtotime('-12 Hours'))."))") or die (mysql_error());
if(mysql_num_rows($voteip2)== 0)
{
echo 'You Have Already Voted!';
}
else
{
echo "<meta http-equiv=\"refresh\" content=\"0;url=(".$url.")\" />";
mysql_query("UPDATE vote SET `ip`=(".$ip."),`timestamp`=(".date('Y-m-d H:i:s').") WHERE `email`=(".$mail['email'].")") ;
mysql_query("UPDATE cq_user SET `emoney`=`emoney`+(".$emoney.") where id=(".$id['id'].")") ;
echo 'Your Voting Genreted Sucssesfuly';
}
}
}
}
else
{
$votemail2=mysql_query("SELECT * FROM `vote` WHERE `email`=(".$mail['email'].") AND UNIX_TIMESTAMP(`timestamp`) <= UNIX_TIMESTAMP((" .date('Y-m-d H:i:s', strtotime('-12 Hours'))."))") or die (mysql_error());
if(mysql_num_rows($votemail2)==0)
{
echo 'You Have Already Voted!';
}
else
{
$voteip2=mysql_query("SELECT * FROM `vote` WHERE `ip`=(".$ip.") AND UNIX_TIMESTAMP(`timestamp`) <= UNIX_TIMESTAMP((" .date('Y-m-d H:i:s', strtotime('-12 Hours'))."))") or die (mysql_error());
if(mysql_num_rows($voteip2)== 0)
{
echo 'You Have Already Voted!';
}
else
{
echo "<meta http-equiv=\"refresh\" content=\"0;url=(".$url.")\" />";
mysql_query("UPDATE vote SET `ip`=(".$ip."),`timestamp`=(".date('Y-m-d H:i:s').") WHERE `email`=(".$mail['email'].")") ;
mysql_query("UPDATE cq_user SET `emoney`=`emoney`+(".$emoney.") where id=(".$id['id'].")") ;
echo 'Your Voting Genreted Sucssesfuly';
}
}
}
}
}
}
?>
</div>
Cod: Selectaţi tot
<?php
$mysql['myhost'] = 'localhost';
$mysql['myuser'] = 'root';
$mysql['mypass'] = 'parolamea';
$accdb='codatabase'; //account database
$gamedb='codatabase'; // game database
//status.php
$serveraddress='94.52.44.211:8080'; //IP
$serverport=5817; //gameserver connection port
$servername='XSGaming'; //name
$url='http://bit.ly/xsg_vote'; //your VOTE site
$emoney='80050';
$MySQL=mysql_connect($myhost,$myuser,$mypass);
mysql_select_db($gamedb);