how to pass session_id() throught out the php pages?
- by Piyush
when user clicks on login button(index.php) I am calling chechlogin.php where I am checking loginId an password as-
if($count==1)
{
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
$_SESSION['UserId'] = $myusername;
$_session['SessionId'] = session_id();
header("location:LoggedUser.php");
}
in LiggedUser.php
<?php session_start(); //starting session
if (!isset($_SESSION['SessionId']) || $_SESSION['SessionId'] == '')
{
header("location:index.php");
}
?
Problem: It is always going back to index.php page although I am entering right userid and password.I think session_id() is not working properly or ??