i need some help , i want to know more abt session and how to use it in logging with username and password i've a script that take out and check the username and password from the database how to register the "session" and how to use it .
Printable View
i need some help , i want to know more abt session and how to use it in logging with username and password i've a script that take out and check the username and password from the database how to register the "session" and how to use it .
In the register page code put this:
Remember session_start will go at very top of the page.PHP Code:<?php
Session_start();
$_SESSION['username']=$username;
?>
Than in the users pages retreive it like:
In every page u want the user to allow with login use session_start();PHP Code:<?php
Session_start();
$username=$_SESSION['username'];
OR
$_SESSION['username'];
Now do some validation here like:
if (isset($_SESSION['username'])){
Allow user to enter}else{ header('Location:login.php')
}
?>
and their Session stored username that either he is logged in or not.
Hope this will help.
thanx man