Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If will need a serverside script which checks, whether the password is correct or not.</p> <p>First you have to modify your form to call the script</p> <pre><code>&lt;form action="login.php" method="post"&gt; Member login:&lt;input type="password" name="password" /&gt; &lt;input type="submit" value="Login" /&gt; &lt;/form&gt; </code></pre> <p>Changes:</p> <ul> <li>action: defines the script which is called when user clicks the submit button</li> <li>input type=submit: the submit button which causes the form to send its data to the server</li> <li>method: defines the way the data is passed to the server</li> </ul> <p>A simple example for "login.php" would be this PHP script:</p> <pre><code>&lt;?php if($_POST["password"] == "Your password here.") { ?&gt; Your website here. &lt;?php } else { ?&gt; Error message here. &lt;?php } ?&gt; </code></pre> <p>line 2 checks if the password field posted by the form equals the String on the right ("Your password here").</p> <p>The text "Your website here." is shown, when the password is correct. Otherwise it will show "Error message here." You can replace that texts by regular HTML code.</p> <p>In addition to your comment:</p> <p>You should never redirect to an HTML file after an login, because that file has to be public for an redirection to it. Instead you should use .htaccess to make it private (only accesible by localhost) and INCLUDE it via the php script.</p> <p>.htacces to make an folder private:</p> <pre><code>Order deny,allow Deny from all Allow from 127.0.0.1 </code></pre> <p>updated PHP script (secureFolder is the private folder):</p> <pre><code>&lt;?php if($_POST["password"] == "Your password here.") { include("secureFolder/members.html"); } else { ?&gt; Error message here. &lt;?php } ?&gt; </code></pre> <p>Please be aware, that you can only access a single site this way. To allow an user to open multiple site's after an login you will need an PHP session which saves the users login and provides the pages.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload