LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-10-2009, 09:16 AM   #1
ahmedyk
LQ Newbie
 
Registered: Jan 2009
Posts: 2

Rep: Reputation: 0
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
 
Old 01-11-2009, 02:11 PM   #2
hob
Senior Member
 
Registered: Mar 2004
Location: Wales, UK
Distribution: Debian, Ubuntu
Posts: 1,075

Rep: Reputation: 45
Quote:
Originally Posted by ahmedyk View Post
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.

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
If the same code works on other servers then the issue is very likely to be with the configuration of the server, rather than the code itself. Use either the log files or debugging to find the point at which the code fails, and go from there. If you don't understand the error, then please post that, and someone should be able to suggest how it can be fixed.
 
Old 01-14-2009, 01:22 AM   #3
ahmedyk
LQ Newbie
 
Registered: Jan 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Smile Thank you for your response

Yes, you are right I checked the configuration of php.ini on linux server and I turned on Register_globals=On and now it started working fine on Linux Red Hat .

Thank you very much.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem accessing Windows SQL server from Red Hat Web Server mariap Linux - General 0 12-28-2008 06:46 PM
backup Windows Server to Red Hat Linux fortunepc Linux - Server 3 05-14-2007 11:35 AM
Red Hat Linux 9 + Windows Server 2003 + Windows XP + Fedora in same domain wolfy339 Linux - Networking 5 03-02-2005 07:03 AM
Red Hat 9 server can't write PHP script, problem in httpd.conf file? x_menno_x Linux - Newbie 27 06-29-2004 05:44 PM
Login Red Hat 9 on NT domain server???? Gekare Red Hat 0 10-23-2003 02:31 PM


All times are GMT -5. The time now is 10:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration