PHP page works once
<p>The code works once but then it will not load the customer_login.php page again. It gives HTTp 404 Not Found error when I try for a second time.  Between the time it was working and got the error, I did not change anything. </p>

<pre><code>    &lt;?php
session_start();
if(isset($_SESSION["manager"]))
    {
        header("location: ./admin/website/".$websitelocation."/index.html");
        exit();
    }
     ?&gt;
     &lt;?php
if(isset($_POST["username"])&amp;&amp;isset($_POST["password"]))
    {
        $manager = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["username"]); 
        $password = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["password"]); 

        include "./scripts/connect_to_mysql.php";
        $sql = mysql_query("SELECT UsersID, Active, Website_Location  FROM users WHERE       User_Name='$manager' AND Password='$password' LIMIT 1") or die(mysql_error());

        $existCount = mysql_num_rows($sql);
        echo $existCount;

        if ($existCount == 1) 
                {
                    while($row = mysql_fetch_array($sql))
                        { 
                            $id = $row["UsersID"];
                            $active = $row["Active"];
                            $websitelocation = $row["Website_Location"];                            
                        }
                    if($active == 'Yes')
                    {   
                        $_SESSION["id"] = $id;
                        $_SESSION["manager"] = $manager;
                        $_SESSION["password"] = $password;

                        header("location: ./admin/website/".$websitelocation."/index.html");

                        exit();
                    }
                    else
                    {
                        echo "&lt;script type='text/javascript'&gt;alert('You are not authorized to login!!!!');&lt;/script&gt; ";

                        echo "click here to go back to &lt;a href='admin_login.php'&gt;login page&lt;/a&gt;. &lt;br&gt;&lt;br&gt;"; 
                        echo "click here to go to &lt;a href='../customer_login.php'&gt;customer login&lt;/a&gt;. &lt;br&gt;&lt;br&gt;";
                        echo "click here to go to &lt;a href='../index.php'&gt;JE Designs LLC main page&lt;/a&gt;. &lt;br&gt;&lt;br&gt;";                               

                        exit();
                    }
                } 
                else 
                {
                    echo "&lt;script type='text/javascript'&gt;alert('The information you have entered is not correct, please try again.');&lt;/script&gt; ";

                    echo "&lt;a href=\"javascript:history.go(-1)\"&gt;Go back to login page.&lt;/a&gt;"; 


                    exit();
                }

    }
     ?&gt;

    &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
    &lt;title&gt;User Login&lt;/title&gt;
    &lt;/head&gt;

    &lt;body&gt;
    &lt;div align="center" id="mainWrapper"&gt;
    &lt;?php include_once("template_header.php");?&gt;
    &lt;div id="pageContent"&gt;&lt;br /&gt;
&lt;div align="left" style="margin-left:24px;"&gt;
  &lt;h2&gt;Log in to view website.&lt;/h2&gt;
  &lt;form id="form1" name="form1" method="post" action="
  &lt;?php 
    if(isset($_POST["username"])&amp;&amp;isset($_POST["password"]))
        {
            echo "./admin/website/".$websitelocation."/index.html"; 
        }
        else
        {
            echo "customer_login.php";
        }
  ?&gt; " &gt;
    User Name:&lt;br /&gt;
      &lt;input name="username" type="text" id="username" size="40" /&gt;
    &lt;br /&gt;&lt;br /&gt;
    Password:&lt;br /&gt;
   &lt;input name="password" type="password" id="password" size="40" /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;

     &lt;input type="submit" name="button" id="button" value="Log In" /&gt;

  &lt;/form&gt;
  &lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;?php include_once("template_footer.php");?&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;    
</code></pre>
