php header does not work anymore

Posted on 2010-01-06
Medium Priority
Last Modified: 2012-05-08
This was working for days and all of sudden it just now goes back to the index.php. I can not even go to a page directly.   I have not changed any settings and i replaced the current code with a backup copy from December and its doing the same thing.

Any assistant would be greatly appreciated.
include 'mysql_connect.php';
include 'functions.php';

$userid   = safe($_POST["user"]);
$password = safe($_POST["pwd"]);

	$query = "select email,dept, dept_name,access from users u,departments d where d.dept_num=u.dept and  email = '$userid'";
	$result = mysql_query($query);
	$num_rows = mysql_num_rows($result);
	$row = mysql_fetch_row($result);
	if ($num_rows == 1) {
	 $_SESSION["dept_num"] = $row[1];
	 $_SESSION["dept_name"] = $row[2];
	 $_SESSION["access"] = $row[3];
		if($row[3] ==1){
			 header( 'Location:home.php' );


Open in new window

Question by:jiritsu
  • 2
  • 2
LVL 12

Accepted Solution

jet-black earned 2000 total points
ID: 26193576
Since there is no "index.php" here, maybe it is the issue about home_lvl.php or home.php, or failed_login.php.
Even, it may be an issue with included files since we don't see their sources here.

Author Comment

ID: 26193615

Failed_login is not coded yet
Here is index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<title>Log On</title>
<form name="login" action="authenticate.php" method="post"> 
	<td><input type="text" name="user" size="22" maxlength="45"></td>
	<td><input type="password" name="pwd" size="22" maxlength="45"></td></tr>
	<td colspan ="2" align="center"><input type="submit" id="submitTrans" name="submitTrans" value="Enter"></td>
	<td><input type="button" id="pwdForget" name="pwdForget" value="Forgot Password"></td>

Open in new window

LVL 82

Expert Comment

ID: 26193627
Open home_lvl.php to see if it is redirecting to index.php. Likewise, check home.php and failed_login.php

Author Closing Comment

ID: 31673649
It was my include files did not even bother to look there
LVL 12

Expert Comment

ID: 26193666
Thanks for the points.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month15 days, 21 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question