"; //$sql="SELECT * FROM agents WHERE username='$urlun' and password='$urlpw'"; $sql="SELECT * FROM users WHERE username='$urlun' and password='$cleanpw'"; $result=mysqli_query($db,$sql); // mysqli_num_row is counting table rows $count=mysqli_num_rows($result); // If result matches $myusername and $mypassword, table row must be 1 row //echo"Count:$count
"; if($count==1){ // Register $myusername and redirect to file designated success file $cookie_name ="$cookiename"; $cookie_value ="$urlun"; //set to 24 hours $cookie_expire ="86400"; setcookie($cookie_name,$cookie_value,time() + (86400),"/", $cookie_domain); header("location:$successful_login_url"); }else{ header("location:$failed_login"); } ?>