Jump to content

Not Loading


justinba1010

Recommended Posts

/* Checks for inserted data
* otherwise quits with exit command
*/
// MySQL Connect
$con01 = mysql_connect("localhost","root","");
mysql_select_db("game");
if(isset($_POST['username'])&& isset($_POST['username']))
{
$username = $_POST['username'];
$username = stripslashes($username);
$username = mysql_escape_string($username);
$password = $_POST['password'];
$password = stripslashes($password);
$password = mysql_escape_string($password);
$password = md5($password);
}
else exit("You haven't entered either a username and/or a password.");
// Query
$query = mysql_query("SELECT * FROM login WHERE username = '$username' AND password = '$password'")or exit("Couldn't find you in the login.");
$edie = mysql_num_rows($query);
while($row = mysql_fetch_assoc)
{
$dbVN = $row['vilnum'];
}
if($edie = 1&&$dbVN=0)
{
while($row = mysql_fetch_assoc($query))
{
$dbuid = $row['uid'];
}
$query = mysql_query("SELECT * FROM villages WHERE uid = '0' AND type = '0' LIMIT 0,1");
while($row = mysql_fetch_assoc($query))
{
$dbvid = $row['vid'];
$dbx = $row['x'];
$dby = $row['y'];
}
echo "$dbx<br>$dby<br>$dbvid";
}
if(!$dbvid||!$dbx||!$dby)
{
exit;
}
// Updates
$query = mysql_query("UPDATE villages SET uid = '$dbuid' AND vilnum = '1' WHERE vid = '$dbvid' AND x = '$dbx' AND y = '$dby'") or exit("Unknown Error #1");
$query = mysql_query("UPDATE login SET vilnum = '1' WHERE uid = '$dbuid'") or exit("Unknown Error #2");

?>

Well I tried them in phpmyadmin, they work there, but something is wrong here.

Link to comment
Share on other sites

Several issues here, I'll post a few:

 

1. why is this duplicated?

if( isset($_POST['username']) && isset($_POST['username']) )

 

2. mysql_escape_string is depricated.

 

3. while($row = mysql_fetch_assoc) has no query associated to it.

 

4. if($edie = 1&&$dbVN=0) should be if($edie == 1 && $dbVN == 0)

 

Thank you so much! Was a bit tired, really didn't do it good as others I did. Overthought a lot of it. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.