Sessions across multiple pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



First, thanks to all who helped with the protected page/email notification.
Works great.
One more thing to ask you gurus:
Here's the workflow:  user clicks on login.php (which has the login form)
fills out form and get directed to video.php. (if the password is incorect,
it opens up loginfail.php with message and link back to login.php.

 Now the main video page has a bunch of individual videos set up they can
view, each on a separate page that opens. At end of each separate sub-video
page is a "back" button that gets user back to the main video "video.php"
site BUT... now they have to log back in with password and email... which is
a pain.

Without having a database for this, I believe one could use sessions to keep
the information in memory and transferrable to all the video subpages while
user is on the site? I tried playing with this but couldn't get this to go.

Below is the code that sits at the top of the main video page "video.php".
One of the subpages is called "video-1-flash.html" . What would I need to
input into the "video-1-flash.html" page ( I know it would have to be
converted to a php file) and where should the code go to ensure that the
user does not have to log in again, once the back button on the subpage
clicked and directs the user back to the main video page for further
selections.

<?php
session_start();
 $_SESSION ['userpass'] = $_POST ['pass'];
 $_SESSION ['authuser'] = 0;
$login="video";
if (preg_match('/^'.$_SESSION['userpass'].'$/i',$login)) {
$_SESSION['authuser'] = 1;

/* this code will be executed if login is successful */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= 'From: Full Video <contact@xxxxxxxxxxxxxxxxx>';
$message = '<p>User '. $_POST ['email'].' has logged in.</p>';
mail(' contact@xxxxxxxx',   $email . ' logged in', $message, $headers);

} else {
 echo include("loginfail.html");
exit(); }
?>

Hope this made sense.  Thanks for your assistance.
R.C.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux