How to make username and password form work - where website cannot be seen by just typing in url : <p>So i have a website on a sever, and am using php code to access a 'log on' page where a person who has a username and password can add stuff to the website. But if you type the url in anyone can just access it without username and password. How do it change this. </p>

<p>So there is a form on html page, that has username and password fields, user types them in, php checks the info and the redirects to the correct page if the info is correct. </p>

<p>PHP code used</p>

<pre><code>    &lt;?php
    if ($_POST["usn"]=="ag316" || $_POST["psw"]=="rock") 
    {
        header("Location: addentry.html");
        exit();
    } 
    else
    {
        header("Location: login.html");
        exit();
    }
?&gt;
</code></pre>
