Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Login Form

Banned
Banned
Joined
Jul 1, 2018
Messages
2
Reaction score
0
Anyone can help me with this script, what is wrong and i cant logedin always say password is wrong

Code:
<?php

$conn = MySQL_Connect($DBHost, $DBUser, $DBPassword) or die (Not connected);   
 MySQL_Select_Db($DBName, $conn) or die ("Database ".$DBName." do not exists.");

$uname = $_POST["user_name"];
$paswd = $_POST["password"] ;

$Salt = $uname.$paswd;
$Salt = md5($Salt);
$Salt = "0x".$Salt;

if(!empty($_POST["login"])) 

{$result = MySQL_Query ("SELECT * FROM users WHERE name='$uname' AND passwd='$Salt'")or ("Can't execute query.");

$row  = MySQL_fetch_array($result);    
if(is_array($row))     
{    

$_SESSION["user_id"] = $row['ID'];    

}

 else

{

$message = "Invalid Username or Password!";    
}
}

?>

Thank you !
 
Last edited:
Junior Spellweaver
Joined
Mar 28, 2014
Messages
186
Reaction score
22
Correction Login Form

Code:
<?php

$conn = mysql_connect($DBHost, $DBUser, $DBPassword) or die ('Not connected');   
 MySQL_Select_Db($DBName, $conn) or die ("Database ".$DBName." do not exists.");

$uname = $_POST["user_name"];
$paswd = $_POST["password"] ;

$Salt = $uname.$paswd;
$Salt = md5($Salt);
$Salt = "0x".$Salt;

if(!empty($_POST["login"])) 

{$result = MySQL_Query ("SELECT * FROM users WHERE name='$uname' AND passwd='$Salt'")or ("Can't execute query.");

$row  = MySQL_fetch_array($result);    
if(is_array($row))     
{    

$_SESSION["user_id"] = $row['ID'];    

}

 else

{

$message = "Invalid Username or Password!";    
}
}

?>

Use that always from now on to read error
Make sure to run webserver .htaccess and add php flags to read the errors for web page.I haven't tested your code but as of now give it a shot and remember mysql is quite deprecated so make sure to switch to mysqli.
 
Banned
Banned
Joined
Jul 1, 2018
Messages
2
Reaction score
0
Re: Correction Login Form

Thank you very much mate
 
Back
Top