Mayby someone can help with php script. What here is wrong?

Mayby someone can help with php script.
What here is wrong? When I try loged in it show me “The Username or Password you have Provided is Invalid”
[php]<?
$url=$_GET[‘url’];
$canLogin=$_POST[‘canLogin’];
if($canLogin==1) {
$username=$_POST[‘txtUsername’];
$password=$_POST[‘txtPassword’];
$seccode=$_POST[‘txtSeccode’];
$scode=$_POST[‘scode’];
$url=$_POST[‘url’];
if($username==’’) $userflag=1;
if($password==’’) $passflag=1;
if($seccode!=$scode) $secflag=1;
if($userflag!=1 && $passflag!=1 && $secflag!=1) {
$tsql=“select * from members where username=’$username’”;
$tres=mysql_query($tsql);
$trow=mysql_fetch_array($tres);
$pwd=crypt($password,$trow[‘password’]);
$validuser_check_query=“select * from members where username=’$username’ and password=’$pwd’”;
$validuser_check_result=mysql_query($validuser_check_query);
if(mysql_num_rows($validuser_check_result)>0) {
$validuser_check_row=mysql_fetch_array($validuser_check_result);
$userid=$validuser_check_row[‘member_id’];
if($validuser_check_row[‘verified’]==‘no’) {
$verified_flag=1;
}
else if($validuser_check_row[‘status’]==‘suspended’){
$suspend_flag=1;
}
else if($validuser_check_row[‘status’]==‘duplicate’){
$duplicate_flag=1;
}
else {
$_SESSION[‘username’]=$username;
$_SESSION[‘useremail’]=$validuser_check_row[‘member_email’];
$_SESSION[‘userid’]=$validuser_check_row[‘member_id’];
if($url)
echo ‘’;
else
echo ‘’;
?>
Please Wait , you will be Redirected to your Home page

If not Please Click here
<?
exit();
}
}
else {
$login_failed=1;
}
}
}
?>[/php]

I see that error message no where in the provided area.

That is very bad, insecure, obsolete code and will not work at all in the current version of Php. You need to toss the whole thing. The code logic is also very bad.

You need to use PDO. Start here: https://phpdelusions.net/pdo

You can also download my PDO Bumpstart Database to get going quickly.

Sponsor our Newsletter | Privacy Policy | Terms of Service