php - Session not working on server, but works on localhost -


i keep getting redirected login page after have logged in, no such error when run script on localhost. login script:

login.php

<?php //... if(array_key_exists('submit',$_post)) { $username = $db->sanitizedata($_post['username']); $password = $db->sanitizedata($_post['password']);  $db->executequery("select * table_name username = '$username' , password = sha1('$password')"); $count = $db->numrows();  if ($count == 0)     header("location: ../index.php?error=1");  else {     $row =  $db->fetch_object();     $user_id = $row->admin_id;     $admin_status = $row->status;      $session = new session();     $session->setsession("s_user_id", $user_id);     $session->setsession("admin_status", $admin_status);      $db->executequery("select session_id another_table status=1");     $row = $db->fetch_object();     $session_id = $row->session_id;     $session->setsession("session_id", $session_id);     header("location: ../home.php");     } }  ?> 

on home.php included file has following codes:

<?php //... $session = new session(); $user_id = $session->retrievesession('s_user_id');  if (!isset($user_id))  header("location: ../administrator/index.php"); //... ?> 

on localhost, not getting issue, if trying run page on live server, redirects login.php, instead of home.php thank you, everyone.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -