obewan Posted April 23, 2007 Share Posted April 23, 2007 Hi We just set up a CentOS box, php 4.3.9, and I am having trouble getting sessions running. My login script uses sessions so this is a problem. I've played around with php.ini but sessions arent working. Here is how I am registering session vars (which works in 4.3.6) $_SESSION['admin'] = true; $_SESSION['username'] = $usename; Any ideas? Quote Link to comment Share on other sites More sharing options...
trq Posted April 23, 2007 Share Posted April 23, 2007 Do you have session_start() at the top of your scripts? Quote Link to comment Share on other sites More sharing options...
obewan Posted April 23, 2007 Author Share Posted April 23, 2007 Yes, I do. My script runs fine on the server running php 4.3.6 but it isn't running on server with php 4.3.9 Here is complete login script <?php session_start(); include('include/functions.php'); $username = $_POST["username"]; $password = $_POST["password"]; // check and see if they entered any info if($_POST["username"] == "") { header('Location: index.php'); } // establish database connection connect_db(); $password = md5($password); $query = "select count(*) from ". ADMIN ." where username = '$username' and password = '$password'"; $result = mysql_query( $query ); $count = mysql_result( $result, 0, 0 ); if($count < 1) { include('index.php'); exit; } $_SESSION['admin'] = true; $_SESSION['username'] = $usename; header("Location:". $_SERVER['HTTP_REFERER']); ?> Quote Link to comment Share on other sites More sharing options...
mpharo Posted April 23, 2007 Share Posted April 23, 2007 $_SESSION['username'] = $usename; spelled username wrong Quote Link to comment Share on other sites More sharing options...
obewan Posted April 23, 2007 Author Share Posted April 23, 2007 oh man, I hate when that happens. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.