Visitors Today: 6
Total Visits: 456993


Do you have source code, articles, and tutorials to share?
Visual Basic, VB.NET, C#, PHP/MySQL, C/C++, Java/JavaScript, ASP/ASP.NET, MS Access, FoxPro, SQL
You can write your own content here.


    If the information on this site helps you and you would like to make donation to please click the LINK below.

    If you want to support us, please make a contribution. Any amount is appreciated. To make a donation via PayPal, credit card, or e-check..

    Please click the DONATE link..

    Your contribution will make grow in the future.



Simple Password Protect Page PHP

    Posted GraniteGear Posted On March 1, 2013

    PHP 0 Current Comments 8129 Views

    Like 0 people liked this.
    A simple PHP password protection script for a single page. Your visitors must enter a password and username into a form to view the content of the page.


    // Define your username and password
    $username = "someuser";
    $password = "somepassword";

    if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {


    <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <label for="txtUsername">Username:</label>
    <input type="text" title="Enter your Username" name="txtUsername" />
    <label for="txtpassword">Password:</label>
    <input type="password" title="Enter your password" name="txtPassword" />
    <input type="submit" name="Submit" value="Login" />


    else {


    This is the protected page. Your private content goes here.




Share With Your Friends

Fatal error: Uncaught Error: Call to undefined function mysql_escape_string() in /home/xtremgoo/laravel/public/comments/inc_rate.php:89 Stack trace: #0 /home/xtremgoo/laravel/public/pages/display.php(401): getComments('47', 'post') #1 /home/xtremgoo/laravel/public/body.php(18): include('/home/xtremgoo/...') #2 /home/xtremgoo/laravel/public/index.php(376): include('/home/xtremgoo/...') #3 {main} thrown in /home/xtremgoo/laravel/public/comments/inc_rate.php on line 89