Login page problems


Posted on 16th Feb 2014 07:03 pm by admin

I developed a website a few months ago and I am now having an issue with logging into it. The place that it is hosted just did some upgrades to their servers and for some reason, now my login page doesn't work correct.

I do know that it connects to the database, receives the information, and the session is set. The problem is that it doesn't forward itself to the next page. The way I know that the session has started is I have manually typed in the URL of the menu page (the page it is suppose to go to once the user logs in).

Did you know?Explore Trending and Topic pages for more stories like this.
I am completely stumped on what is wrong here. I have other pages that use the same method to go to the next page once a user fills in a form and they work correctly.

Here is the code I use
Code: //process the script only if the form has been submitted
if (array_key_exists('login', $_POST)) {
//start the session
session_start();
include('include/connection.php');

//clean the $_POST array and assign to shorter variables
nukeMagicQuotes();
$username = trim($_POST['username']);
$pwd = trim($_POST['pwd']);

//connect to the database as a user
$conn = dbConnect();

//prepare username for use in SQL query
$username = mysql_real_escape_string($username);

//get the username's details from the database
$sql = "Select * FROM user
WHERE Username = '$username'";
$result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($result);

if (sha1($pwd.$row['Salt']) == $row['pwd']) {
$_SESSION['authenticated'] = 'abc';
}
//if no match, destroy the session and prepare error message else {
$_SESSION = array();
session_destroy();
$error = 'Invalid username or password';
}
//if the session variaable has been set, redirect if (isset($_SESSION['authenticated'])) {
//get the time the session started
$_SESSION['start'] = time();
header('Location: homepage.php');
exit;
}
}

When I hit the login button, all i get is the information from the header.php file (which contains the <head> information) and the URL says it's still the index file.

Any help would be greatly appreciated. The PHP version they are now using is 5.2.9. I'm not sure what the previous version was, but it was a PHP 5.x.x version.
No comments posted yet

Your Answer:

Login to answer
69 Like 54 Dislike
Previous forums Next forums
Other forums

My query is being run with no results.
I have this.

Code: function DropUser($duser_id, $user_email, $user_username) {

Not Loading Function Into Div
I'm not sure whether to put this under the php forum or ajax forum but because I tink it's more of a

quotes changing
hi all

in my content

opening quotes " changes to “

close qu

show random images
hey guys

can someone please suggest a way in which the following code can be edited so it onl

Php If in MySql query (hiding labels if a field is empty)
Okay, I've been trying to do this for a while, and I'm finally going to ask for help so I can get th

Query failed issue with php script but works fine in mssql manager!
hi i have the script below which copies data from one table to another but will only insert new data

SESSION CHECK WORKS "MOST" of the time... whats going on?
i have a sign in check thats included in every page that is a members only page which is basically a

tell csv import script to ignore blank rows?
Hi i have the below script but i get an error if a row is blank ie a return in the csv file at the e

Storing/displaying image urls in a database?
Hi
Basically I have the following scenario:
User chooses picture from list. Picture info is ad

Windows Authentication
I have a website which is windows authenticated.
now i want something more on this application.<

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash