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).
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.
Inserting Data into a MS Access DB using PHP.
As part of my uni course I am doing a placement at a company whom want me to create a client zone for their website.Basically, they want me to create the code to get data from a MS Access db and
SAP BCS. BPS
Hi all,
Help Optimizing code
Good Morning,I wrote a small import function for a website of mine and I know there has to be a better way to handle what I'm doing. I'm hoping someone can take my code and make it run a hair faster
help understanding hidden input w/ php
hello i'm doing a tutorial where there are multiple forms for an edit page for a user to update their info... there's a section of the code i dont really understand how it works...here's code:php:if
Staff Induction System - No idea where to go from here!!!
Hi there, I'm pretty new to PHP and Mysql so could really do with being pointed in the right direction with this problem I have.I am trying to set up a system induct new members of staff onto their
whats wrong with my code please help!!!
this is the errorWarning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /var/www/IpSearch.php on line Code: [Select]<?php$srch = $_REQUEST["srch"];if
Empty text file when there is over XXXX lines of text.
define("RANDOM_FILE","/public_html/random.txt"); $randomEntry = "This goes in text file.\n"; { $randomFile = fopen(RANDOM_FILE,"a"); }
OPINIONS WANTED
This is my login page code, and I want your opinion on it please! Code: // Login ~ CHECKS THE (USERNAME/PASSWORD) ENTERED BY THE USER THEN EITHER GRANTS ACCESS OR DENIEDS ACCESS case
am I using this for loop correctly
Dear buddies!
str_replace help
Hey there,I'm a PHP newb, I'm having troubles with the str_replace function. I want to clean up bad html to valid xhtml, I am using:Code: $pee = str_replace('&', '&amp;', $pee);It