ok so this is what i have, i have a login script that checks an imap server for a user, if the user has an account then he gets access to the private pages, here is the first part;
this is the script that gets hit by the login form;
Code:
<?php
// setup the connection here
$server = "your ip"; // your IMAP ip address
$user = $_POST['user']; // this will get the name field of your form in this case "user"
$password = $_POST['pass']; // this will get the name field of your form in this case "pass"
$conn = @imap_open("\{$server/imap}INBOX", $user, $pass) // here we go amigo, create the imap connection
or die("<img src=\"images/stop_24.gif\"> no account found with that information <a href=\"login.php\">click here to try again</a>"); // if the account was not found-error message
// if the passwod match the password on the imap server validate and login
if ($pass == $pass) {
session_register("user");
header("Location: index.php");
}
?>
and this is the index.php file (the file that the user logged in to)
Code:
<?php
if (!$PHPSESSID) {
header("Location: login.php");
exit(0);
} else {
session_start();
session_register("user");
}
html goes below
?>
so this is were i need to set a cookie so they don't have to login every time they return to the index.php page, how would i do that, i tried
setcookie("PHPSESSID",$_COOKIE['PHPSESSID'],time()+999999999);
but that didn't work
if im doing something wrong please let me know, im a newbie working hard to learn 🙂