NameSilo

Geting error on this php page

Spaceship Spaceship
Watch
Impact
19
Hey
here is my code:
PHP:
<?$username = $_GET['user'];
$pass = $_GET['pass'];
$pass .= md5($pass);
$email = $_GET['email'];
$country = $_GET['country'];
$registerpass = $_GET['registerpass'];
$dbusername="zubair";
$dbpassword="";
$database= "z_game";
if ($registerpass == "aa") {
mysql_connect(localhost, $dbusername, $dbpassword);
@mysql_select_db($database) or die("Unable to select database");

$sql_username_check = mysql_query("Select username from user WHERE username='$username'");
$username_check = mysql_num_rows($sql_username_check);
if ($username_check > 0) {
echo "error1";
exit();
}

$query= "INSERT INTO user(id, username, pass, email, lastlogin, health, country, level, armysize,money) VALUES (NULL, '$username', '$pass', '$email', NULL, 100, '$country', 1, 1, 10000)";
mysql_query($query); 
echo "Complete";
}
else {
echo "Error"; 
}?>
and i m getting this error :(
Code:
Parse error: syntax error, unexpected $end in D:\htdocs\Zubair\login.php on line 27
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
it syntactically looks correct is this the full code?

line 27 is }?> but that shouldn't cause an error. I notice you have edited your post is it possible before you was missing a closing bracket or something silly like that and you have added it now?
 
0
•••
grr well i sent it to a friend of mine and he modified it and it doesnt give that error..
hre is the code
but it gives this error now:
PHP:
<?
$username = $_GET['user'];
$pass = $_GET['pass'];
$pass .= md5($pass);
$loginpass = $_GET['loginpass'];
$dbusername="zubair";
$dbpassword="";
$database= "z_game";
if ($loginpass == "aa") {
	mysql_connect(localhost, $dbusername, $dbpassword);
	@mysql_select_db($database) or die("Unable to select database");
 	$sql = mysql_query("SELECT user, pass FROM user  WHERE user='".$user."'  AND pass='".$pass."'LIMIT 1");

	if (mysql_num_rows($sql) > 0)
		{
   		echo "in";
		}
	else
		{
   		 echo "out" ;
		} 
} 
else {
echo "error";
}
?>
Code:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\htdocs\Zubair\login.php on line 14
out
 
0
•••
try the query in phpmyadmin, it is most likely that the query does not get any results at all.
 
0
•••
The error means you have a problem with $sql.
Since you get the error and it returns false, it makes it 0 which is why it still echo's 'out'.

$sql = mysql_query("SELECT user, pass FROM user WHERE user='$user' AND pass='$pass' LIMIT 1");

You have some some really weird code..

You are setting $pass to their password AND the md5 of it, instead of just the md5 of it.

I'm not sure why you have $pass and $loginpass...
 
0
•••
oh i got it :p
it was
PHP:
$pass = $_GET['pass'];
$pass .= md5($pass);
i thought it was getting the password first..and then OVERWRITING it with the md5 of it :p well i fixed it :D Thanks for all the help pplz :D i will be back with more questions soon lol :D
I LOVE NAMEPROS :p
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back