我有稍微翻了一下網上的資料好像是因為參考資料太舊php版本不符合
那我有甚麼辦法在不改動太多東西的情況下讓我的php正常嗎?
這是一個參考別人的登入php
<?php
$username=$_POST['user'];
$password=$_POST['pass'];
$username=stripcslashes($username);
$password=stripcslashes($password);
$username=mysql_real_escape_string($username);
$password=mysql_real_escape_string($password);
mysql_connect("localhost","root","");
mysql_select_db("login");
$result=mysql_query("select * from users where username = '$username' and password = '$password'")
or die("Failed to query datebase ".mysql_error());
$row=mysql_fetch_array($result);
if($row['username'] == $username && $row['password'] == $password ){
echo "Login sucess. Welcome ".$row['username'];
}else{
echo "Failed to login!";
}
?>