Forum Moderators: coopster
I created the following login script based on Jatar's authentication thread. So far, I've run into an Undefined index notice, and no matter what I try the notice remains! I'm getting these notices:
Undefined index: username on line 12
Undefined index: userpass on line 13
This is the form action script:
<?php
session_start();
$con = mysql_connect("host","user","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db", $con);
$username = $_POST["username"];
$userpass = md5($_POST["userpass"]);
$sql = "SELECT username , userpass FROM user WHERE username='$username' AND userpass='$userpass'";
$result = mysql_query($sql);
if (mysql_num_rows($result)!= 1) {
$loginError = 1;
include "login.php";
} else {
header("Location: profile.php");
}
?>
Any suggestions?
Thanks,
Max