Not a Member Yet,
Click here to Register

ID: 104
Viewed: 4788
Added: Jun 10, 2004
Version: php4.1+
Snippet uploaded by: snippet
Written By: snippet
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

This script show you how to setup a session and read that session variable. if no session variable is found then it is passed to a form so they can start a session.

works on php version 4.1+

<!---Head--->
<?php
//must go at the beginning of the page.
session_start();
?>

<!---Body--->


 <?php
//if you want to check for the variable that is
//suppose to be in the session, one way is this.
//lets say $_POST['use\r\name'] is from the form.
if (isset($_POST['use\r\name'])){
//if it is set, you want to verify that it is the user
//I would run check on the Database to be sure.

//after you have checked it with the database and
// all is ok, then you need to register the variables
// you got from the database
$_SESSION['userid'] = $variableFromDB
$_SESSION['use\r\name'] = $variableFromDB

}else{
//goto form so they can login and to creat a session.

}
?>


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!