php header does not work anymore

Posted on 2010-01-06
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
    LVL 12

    Accepted Solution

    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


    Failed_login is not coded yet
    Here is index.php
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="" 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

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

    Author Closing Comment

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

    Expert Comment

    Thanks for the points.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now