Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'Include/functions.php';
- head();
- nav();
- dbconn();
- ?>
- <h1 align="center">Login</h1>
- <p align="center">Füllen Sie das folgende Formular aus, um sich einloggen zu können.</p>
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
- <table align="center">
- <tr>
- <td>Username</td>
- <td><input type="text" name="username" size="30"></td>
- </tr>
- <tr>
- <td>Passwort</td>
- <td><input type="password" name="password" value="" size="30" ></td>
- </tr>
- <tr>
- <td></td>
- <td><input type="submit" name="login" value="Login!"></td>
- </tr>
- </table>
- </form>
- <?php
- if(isset($_COOKIE['ID_my_site'])) {
- $usersname = $_COOKIE['ID_my_site'];
- $pass = $_COOKIE['Key_my_site'];
- $check = mysql_query('SELECT * FROM users WHERE username = \''.mysql_real_escape_string($usersname).'\'')or die(mysql_error());
- while($info = mysql_fetch_array( $check )) {
- if ($pass == $info['passhash']) {
- Header('Location: index.php');
- }
- }
- } else {
- if (isset($_REQUEST['login'])) {
- if(!isset($_REQUEST['username']) | !isset($_REQUEST['password'])) {
- exit('Du hast vergessen ein Feld auszufüllen.');
- }
- if (!get_magic_quotes_gpc()) {
- $_REQUEST['email'] = addslashes($_REQUEST['email']);
- }
- $check = mysql_query("SELECT * FROM users WHERE username = '".$_REQUEST['username']."'")or die(mysql_error());
- $check2 = mysql_num_rows($check);
- if ($check2 == 0) {
- exit('Dieser users existiert nicht in unserer Datenbank. <a href=register.php><b><u>Zum registrieren hier klicken</u></b></a>');
- }
- while($info = mysql_fetch_array( $check )) {
- $_REQUEST['passhash'] = stripslashes($_REQUEST['passhash']);
- $info['passhash'] = stripslashes($info['passhash']);
- $_REQUEST['passhash'] = md5($_REQUEST['passhash']);
- if ($_REQUEST['passhash'] != $info['passhash']) {
- exit('Falsches Passwort, bitte versuchen Sie es nochmal.');
- } else {
- $_REQUEST['usersname'] = stripslashes($_REQUEST['usersname']);
- setcookie('ID_my_site', $_REQUEST['usersname'], time()+3600);
- setcookie('Key_my_site', $_REQUEST['pass'], time()+3600);
- Header('Location: index.php');
- }
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment