john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

php password example

<html>
<head>
</head>
<body onload="document.entryform.txtpassword.focus()"> <!-- default cursor -->

<?php
//$username = "user";      //01apr2008
$password = "-network1";

//if( ($_POST['txtUsername'] != $username) || ($_POST['txtpassword']!= $password) )
if( $_POST['txtpassword']!= $password )
{
?>

    <form name="entryform" method="post" action="
    <?php echo $_SERVER['php_SELF'];?>             ">

    <!-- user:<input type="text" name="txtUsername" /><br> -->
    pass:<input type="password" name="txtpassword" /><br>
    <input type="submit" value="Submit" />

    </form>

<?php
}
else
{
    if (!$filehandle = fopen("mybm.php", 'r'))
    {
         echo "Cannot open file";
         exit;
    }

    while( !feof($filehandle) )
    {
        $line = fgets($filehandle);
        echo "$line<br>";
        if( "START-BOOKMARKS-SECTION" == $line)
        {
            echo "success";
        }


    }//end while

/*            while( (!feof($filehandle)) && ($line != "<!--END-BOOKMARKS-SECTION-->") )
            {
                $line=fgets($filehandle);
                print "$line<br>";
            }//end while

        }//end if
*/


    fclose($filehandle);
?>
START-BOOKMARKS-SECTION


END-BOOKMARKS-SECTION

<?php       //password protected until here
}
?>



</body>
</html>

  • « javascript notes
  • php email example »

Published

Feb 6, 2010

Category

php

~94 words

Tags

  • password 10
  • php 82