Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <form method="POST">
- <p>Login : <input type='text' name='login' value='login'/></p>
- <p>Password : <input type='password' name='password' value='*****'/></p>
- <input type="submit" name="submit" value="Submit"/>
- </form>
- <p>Not signed up yet ? <a href=register.php>Register</a>.</p>
- <?php
- $wrong_user=false;
- $wrong_password=false;
- if(isset($_POST["submit"]) && $_POST["submit"]=="Submit" && isset($_POST['login']) and isset($_POST['password'])){
- $handle=fopen("logs/logins.txt", "r+");
- while (!feof($handle)){
- $line=fgets($handle);
- explode('\t',$line);
- if ($_POST['login']==$line[0]) {
- if ($_POST['password']==$line[1]) {
- $match=true;
- }
- else {
- $match=false;
- $wrong_password=true;
- }
- }
- else{
- $match=false;
- $wrong_user=true;
- }
- }
- if ($match==true) {
- session_start();
- $_SESSION['login']=$_POST['login'];
- print "Login successful!";
- print "<p><a href=\"welcome.php\" target=\"_blank\">Jump to the website</a></p>";
- }
- else {
- if ($wrong_password=true) {
- print "Wrong password." ;
- }
- if ($wrong_user=true) {
- print "Unknown username." ;
- }
- }
- }
- else {
- print "Please specify username and login." ;
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement