Tuesday, April 24, 2007

session register checking and redirecting pages...

logging script session is registered and than checked


<?php


if(session_is_registered ('user'))

{

session_destroy();

}

session_start();

session_name('user');


//session is registered and than checked....


session_register("reguser");

$reguser="$member_id";


?>


//check for user or webmasters.....


<?php



session_start();

if($_SESSION['reguser'])

{

$msg= "Logged in&nbsp;".$_SESSION['reguser'];

echo $msg;


exit();



}

if($_SESSION['webmaster'])

{

$msg= "Logged in Web Master Id no:".$_SESSION['webmaster'];

echo $msg;


exit();

}




?>


//redirect page by the header funtion as per user category


<?php


session_destroy();

if(session_is_registered('reguser'))

{

header("location: ./index.php");

}





if(session_is_registered('webmaster'))

{

header("location: ./index.php");

}
?>

No comments: