rahuul Posted April 28, 2010 Share Posted April 28, 2010 hi friends, i have a strange problem..... my site is running fine on localhost... but as i put it online on server it behaves strangelly....... when i enter correct username/password the form doesnot post anything but as i enter wrong it post the variables...... any idea why????????? my code is as below............. $ARR_CFGS["db_host"] = 'localhost'; $ARR_CFGS["db_name"] = 'as_travel'; #gws_alqhemy #gws_nat $ARR_CFGS["db_user"] = 'root'; $ARR_CFGS["db_pass"] = ''; function connect_db() { global $ARR_CFGS; if (!isset($GLOBALS['dbcon'])) { $GLOBALS['dbcon'] = mysql_connect($ARR_CFGS["db_host"], $ARR_CFGS["db_user"], $ARR_CFGS["db_pass"])or die(mysql_error()); mysql_select_db($ARR_CFGS["db_name"]) or die("Could not connect to database"); } } connect_db(); include('../includes/include.inc.php'); print $_POST['submit']; print $_POST['username']; print $_POST['password']; if($_POST['submit']=='Login'){ if($_POST['username']!='' && $_POST['password']!=''){ $sql = "SELECT * FROM admin WHERE user_name='$username'"; $res = mysql_query($sql) or die(mysql_error()); $rows = mysql_num_rows($res); $line=mysql_fetch_array($res); print $line[password].$password; if($line[password]===$password){ if($rows>0){ $_SESSION['SESS_MSG']=$username ." logged Sucessfully "; //$_SESSION['DREAM_ADMIN_SESSION_ID'] = session_id(); $_SESSION['ADMIN_ID'] = $line['id']; $_SESSION['ADMIN_USERNAME'] = $line['user_name']; $_SESSION['DEP_ID'] = $line['dep_id']; $_SESSION['ADMIN_NAME'] = $line['name']; $_SESSION['ADMIN_LAST_LOGIN'] = $line['last_login']; $sql = "UPDATE admin SET last_login = NOW() WHERE id = '".$line['id']."'"; mysql_query($sql) or die(mysql_error()); header("Location: dashboard.php"); exit; }else{ $_SESSION['SESS_MSG'] = "Invalid user name and password"; header("Location: index.php"); exit; } } } } Link to comment https://forums.phpfreaks.com/topic/200060-strange-error/ Share on other sites More sharing options...
rahuul Posted April 28, 2010 Author Share Posted April 28, 2010 i just noticed this it is not storing sessions due to which it is redirecting from dashboard to index....... my server is having php4 pls help............ Link to comment https://forums.phpfreaks.com/topic/200060-strange-error/#findComment-1050015 Share on other sites More sharing options...
Ken2k7 Posted April 28, 2010 Share Posted April 28, 2010 Upgrade your PHP version. Read session_start. Link to comment https://forums.phpfreaks.com/topic/200060-strange-error/#findComment-1050021 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.