Php session variables, block a user
<p>Hey can any one look over my code and help me... I using apache and I am trying to make it were if the user types in the password and user name incorrectly 3 times it will just forward them to the 404 html page. Unfortunately I am getting some of my code displayed in my browser and im not sure why. I'm knew to php so if the code is sloppy or incorrect please dont hound me about it.</p>

<p><strong>login.php:</strong></p>

<pre><code>&lt;?php 
session_start(); 
$_SESSION['wrong']=0;
$user = $_POST['user'];
$pass = $_POST['pass'];
if($user == "school"
&amp;&amp; $pass == "homework")
{
echo"Password system work!";
}else{
$_SESSION['wrong']=$_SESSION['wrong']+1;
header( 'Location: http://localhost' ) ;
}
?&gt;
</code></pre>

<p><strong>Index.html:</strong></p>

<pre><code>&lt;? session_start(); 
include 'login.php';
global $_SESSION['wrong'];
if($_SESSION['wrong']&gt;=3){
header( 'Location: 404_File_Not_Found.html' ) ; //This is what the browser is showing

}
?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;style type="text/css"&gt;

#form{
width:  340px;
height: 400px;
box-shadow: 0px 2px 5px rgba(0,0,0,0.25);
position: relative;
-webkit-box-shadow: 0px 2px 5px;
border: solid 1px #ddd;
padding: 30px 30px 60px 30px;
background: #fff;
border-radius: 10px;
}
p{
font-family: Verdana;

}
div{
margin-left:auto;
margin-right:auto;
margin-top:5%;

}
img{
width: 120;
height: 133;
left: 100px;
position: relative;
}
input{
margin-left:10%;
margin-right:5%;
font-size: 14px;
width: 264px;
padding: 9px 7px 7px;
background: none !important;
position: relative;
z-index: 10;
margin-bottom: 20px;
border-radius: 5px;

}
.button:hover{
color: red;
}
&lt;/style&gt;


&lt;/head&gt;
&lt;body&gt;
&lt;div id="form"&gt;     
&lt;img src="http://traceybaptiste.files.wordpress.com/2011/01/homework2.jpg" /&gt;
    &lt;form method="POST" action="login.php"&gt;
    &lt;p&gt;User:&lt;/p&gt; &lt;input type="text" name="user"&gt;&lt;/input&gt;
    &lt;p&gt;Pass:&lt;/p&gt; &lt;input type="password" name="pass"&gt;&lt;/input&gt;
    &lt;input type="submit" name="submit" class="button"&gt;&lt;/input&gt;
    &lt;/form&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p><strong>404.html:</strong></p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
html{
background-color:grey;
}
body{
background-image:url("404.jpg");
background-repeat:no-repeat;
margin-left: 25%;
margin-right: auto;
margin-top: 10%;

}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
