On Fri, Jun 20, 2008 at 5:48 PM, R.C. <[EMAIL PROTECTED]> wrote:

> "tedd" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > If you had used my minimal method, I could have provided you with a
> > simple example. But considering you want bloat, try reading the
> > manual about sessions. :-)
> > Cheers,
> > tedd
>
> This was very helpful Tedd....  sorry I used someone else's method here
> from
> this group... it wasn't bloat at all, but very functional actually and I
> managed to get those 3 issues combined and working. But I did appreciate
> your input.
>
> So.. that said: let's get back to what I ask and maybe someone can give me
> some insight into how to make these sessions work across these multiple
> pages.  And yes, I am reading thru manuals:  Here's the script sofar and my
> question:
>
> 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 <[EMAIL PROTECTED]>';
> $message = '<p>User '. $_POST ['email'].' has logged in.</p>';
> mail(' [EMAIL PROTECTED]',   $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
>
>
simple

<?php

//start the session tracking on each page
session_start();

//test to see if your session variables are set and if NOT SET then redirect
the user
if(( empty($_SESSION ['userpass'])) && ( $_SESSION ['authuser'] != 1))
{
  header("location:login.php");
  exit();
}

//rest of the page content goes here

?>

-- 

Bastien

Cat, the other other white meat

Reply via email to