|
PHP Login script working on windows server but not on Linux Red Hat Server
I wrote a PHP Application which has a Login script, when I run this application on windows server using apapche2triad it runs perfectly but when i use the same PHP application on Linux Red Hat server it does not let me login the system.
here is my form processing code :
<?php
/*
validate the administrator login and redirect to index.php
*/
include("./config/class.inc");
include("./config/errors.inc");
/* prevent empty entries from going beyond this point */
if (strlen(trim($username)) == 0) {
$chronerr->addError(1,"Username");
}
if (strlen(trim($password)) == 0) {
$chronerr->addError(1,"Password");
}
if ($chronerr->error_flag) {
header("location: login.php");
}
$_SESSION['username'] = $_POST['username'];
$_SESSION['password'] = $_POST['password'];
$chrondb = new ChronDB_sql;
$qry_str = "select count(*) from user where username='".$username."' and password='".$password."' and admin = 'y';";
$chrondb->query($qry_str);
$chrondb->next_record();
$user_row_count = $chrondb->record[0];
if ($user_row_count == 1) {
/* start session mgmt & register session variables */
if(!session_start()) {
$chronerr->halt(22,"Session Management");
}
else {
session_register("loggedin");
$loggedin = true;
$date = date('m d, Y');
$update_login = mysql_query("UPDATE user SET last_login = '$date' WHERE username ='".$username."'");
header("Location: index.php");
}
}
else {
$chronerr->addError(9,"Login authentication");
header("location: ".$_SERVER['HTTP_REFERER']);
}
?>
Please tell me why this login form processing code is not allowing the user to enter the system? and the same application is running perfectly on windows server and other Linux servers but not running on my Linux server.why?
Thank you.
Best Regards
Ahmed
|