Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="index.php" method="post">
- Username: <input type="text" name="user" /><br />
- Password: <input type="password" name="passwd" />
- <input type="submit" value = "Submit" />
- </form>
- <?php
- $file = fopen ("log.txt","a") or exit("Unable to find log file <br />");
- $user = $_POST["user"];
- $passwd = $_POST["passwd"];
- $ip = $_SERVER["REMOTE_ADDR"];
- $plen = strlen($passwd);
- $ulen = strlen($user);
- $time = date("h:i");
- if (($ulen != 0)&&($plen != 0)) {
- if (($user="exogan")&&($passwd == "carrot")) echo "Password correct";
- else {
- echo "Incorrect password, attempt logged";
- $user = "User= " . $user . " and ";
- $passwd = "password= " . $passwd . " at ". $time ." from ". $ip ."\n";
- fwrite($file, $user);
- fwrite($file, $passwd);
- fclose($file);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement