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? Link to comment https://forums.phpfreaks.com/topic/48287-solved-phpini-question/ 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? Link to comment https://forums.phpfreaks.com/topic/48287-solved-phpini-question/#findComment-236057 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']); ?> Link to comment https://forums.phpfreaks.com/topic/48287-solved-phpini-question/#findComment-236064 Share on other sites More sharing options...
mpharo Posted April 23, 2007 Share Posted April 23, 2007 $_SESSION['username'] = $usename; spelled username wrong Link to comment https://forums.phpfreaks.com/topic/48287-solved-phpini-question/#findComment-236069 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. Link to comment https://forums.phpfreaks.com/topic/48287-solved-phpini-question/#findComment-236093 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.