0

Hi, all
I tried this many times in XAMPP.
It always not give me direct which stuck me now.
Here is my code:

if (mysql_num_rows($result) == 1)
        {
	     $_SESSION["authenticated"] = TRUE;

             redirect("index.php");
        }
	else
	{
	 die("could not find a row");
	}

My redirect function code is really normal:

function redirect($destination)
    {
        // handle URL
        if (preg_match("/^http:\/\//", $destination))
            header("Location: " . $destination);

        // handle absolute path
        else if (preg_match("/^\//", $destination))
        {
            $host = $_SERVER["HTTP_HOST"];
            header("Location: http://$host$destination");
        }

        // handle relative path
        else
        {
            // adapted from http://www.php.net/header
            $host = $_SERVER["HTTP_HOST"];
            $path = rtrim(dirname($_SERVER["PHP_SELF"]), "/\\");
            header("Location: http://$host$path/$destination");
        }

        // exit immediately since we're redirecting anyway
        exit;
    }

And my form action is

action="<? echo $_SERVER["PHP_SELF"]; ?>"

Anybody have any idea about this one??
There is no bug show or no warning show up which I don't know where is wrong with that?
Thanks.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by somedude3488
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.