Hi all, i am making a login script, and my session variables wont register.
Here is what login.php looks like
<?php
extract($_POST);
if ($submitted == "1" && ($server == "" || $user == "" || $password == "")){
if ($server == "")
$error = "Missing POP-SERVER";
if ($user == "")
$error = "Missing username";
if ($password == "")
$error = "Missing password";
} else if ($submitted == "1" && !eregi('^([.a-z0-9-]+[._a-z0-9]*)@(([a-z0-9-]+\.)*([a-z0-9]+)(\.a-z]{2,3})?)$', stripslashes(trim($user)))){
$error .= "Username is not a valid e-mail addredd";
} else if ($submitted == "1" && $error == ""){
session_start();
session_register("SESSION_USERNAME");
session_register("SESSION_PASSWORD");
session_register("SESSION_SERVER");
$SESSION_USERNAME = $user;
$SESSION_PASSWORD = $password;
$SESSION_SERVER = $server;
header("Location: inbox.php");
}
?>
<!-- Then the HTML login form is here -->
As you can see, if the variables are registered (Or if the form is submitted) the user will go to inbox.php wich looks like this:
<?php
session_start();
extract($_GET);
if (!isset($SESSION_SERVER)){
header("Location: login.php");
}
$inbox = imap_open("{".$SESSION_SERVER.":110/pop3}", $SESSION_USERNAME, $SESSION_PASSWORD);
$total = imap_num_msg($inbox);
?>
<!-- The rest of the script -->
My problem is the user gets re-directed to login.php once the form is submitted.
Can anyone help me solve my dilema?
Thank you for your time
~Gabor