Jump to content

strange error


rahuul

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.