Vote count:
0
I am trying to learn how to make a basic login system using PHP and MySQL. I am following a tutorial (http://ift.tt/18UCkof), but it isn't working. I tested it out and the inputs from the form on the previous page are working, but it isn't redirecting to the next page. Here's the code. Also, the MySQL connection is working, Im just hiding the password.
<?php
mysql_connect("localhost", "metacano_joe", "************") or die ("cannot connect");
mysql_select_db("metacano_metacanon") or die(mysql_error());
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$sql = "SELECT * FROM users WHERE username = '$myusername' and password = '$mypassword'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
if($count==1){
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
?>
asked 18 secs ago
php file doesn't redirect
Aucun commentaire:
Enregistrer un commentaire