daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Jul 20th, 2017 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['form_name']) && $_POST['form_name'] == 'loginform')
  3. {
  4.    $success_page = './flexible_services.php';
  5.    $error_page = './login_error.php';
  6.    $database = './proof_reader_usersdb.php';
  7.    $crypt_pass = md5($_POST['password']);
  8.    $found = false;
  9.    $fullname = '';
  10.    $session_timeout = 600;
  11.    if(filesize($database) > 0)
  12.    {
  13.       $items = file($database, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
  14.       foreach($items as $line)
  15.       {
  16.          list($username, $password, $email, $name, $active) = explode('|', trim($line));
  17.          if ($username == $_POST['username'] && $active != "0" && $password == $crypt_pass)
  18.          {
  19.             $found = true;
  20.             $fullname = $name;
  21.          }
  22.       }
  23.    }
  24.    if($found == false)
  25.    {
  26.       header('Location: '.$error_page);
  27.       exit;
  28.    }
  29.    else
  30.    {
  31.       if (session_id() == "")
  32.       {
  33.          session_start();
  34.       }
  35.       $_SESSION['username'] = $_POST['username'];
  36.       $_SESSION['fullname'] = $fullname;
  37.       $_SESSION['expires_by'] = time() + $session_timeout;
  38.       $_SESSION['expires_timeout'] = $session_timeout;
  39.       $rememberme = isset($_POST['rememberme']) ? true : false;
  40.       if ($rememberme)
  41.       {
  42.          setcookie('username', $_POST['username'], time() + 3600*24*30);
  43.          setcookie('password', $_POST['password'], time() + 3600*24*30);
  44.       }
  45.       header('Location: '.$success_page);
  46.       exit;
  47.    }
  48. }
  49. $username = isset($_COOKIE['username']) ? $_COOKIE['username'] : '';
  50. $password = isset($_COOKIE['password']) ? $_COOKIE['password'] : '';
  51. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top