Visitors Today: 90
Total Visits: 400220

www.codester.info

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.

Donation


    If the information on this site helps you and you would like to make donation to XtremeXtension.com 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 XtremeXtension.com grow in the future.

Sponsor

Calendar

Simple Password Protect Page PHP

    Posted GraniteGear Posted On March 1, 2013

    PHP 0 Current Comments 6799 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.

    SOURCE

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

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

    ?>

    <h1>Login</h1>
    <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" />
    </form>

    <?php

    }
    else {

    ?>

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

    <?php

         }

    ?>





Share With Your Friends
Share Your Thoughts With Other Users

Be the first to comment.

Leave a Reply
This small test serves as access restriction against malicious bots.