oh alright... that makes sense... i put the code in now...and this is what it looks like...
// username and password sent from login form
$Email=mysql_real_escape_string($_POST['Email']);
$Password=$_POST['Password'];
$table= "register";
// Encrypt Password
$encrypted_password=md5($Password);
$sql="SELECT count(*) FROM register WHERE Email='$Email' and Password='$encrypted_password'";
$result=mysql_query($sql);
$count=mysql_result($result,0);
// If result matched $Email and $Password, table row must be 1 row
if($count==1){
// Register $Email, $Password and redirect to file "login_success.php"
$_SESSION["Email"] = $Email;
$_SESSION["Password"] = $Password;
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
?>
but now when i actually log in...all it does is refresh the log in page pretty much? do i have to change the if($count==1) statement now as well b/c i changed the database query statement?
sorry again for all this hassle, i just don't have the best grasp on all this right now!
also....by using the:
$_SESSION[$Email] = $Email
and so on.... it actually starts the session? so in every page on my site that i want to have for members only, i need to to write code that checks to see if
$_SESSION[$Email] = $Email....has a session started and then allow the page to be viewed?
something kind of like...
(check to see if user has started session code)
if user has started session
header (secure page)
else
header (login)
am i right?