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
https://forums.phpfreaks.com/topic/244291-not-loading/
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)

Link to comment
https://forums.phpfreaks.com/topic/244291-not-loading/#findComment-1254783
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
https://forums.phpfreaks.com/topic/244291-not-loading/#findComment-1255090
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.