Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use classes\system as system;
- class login {
- public function __construct() {
- }
- public function login() {
- if(isset($_POST['submit'])) {
- if(empty($_POST['password']) && empty($_POST['password'])) {
- echo "Je bent iets vergeten om in te vullen!";
- } else {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $data = system::db()->queryFirstRow("SELECT username FROM users WHERE username=%s, $username");
- if(system::db()->count() > 0) {
- if($data['password'] == sha1(md5($password))) {
- $_SESSION['login'] = true;
- $_SESSION['username'] = $username;
- $_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
- $ip = $_SESSION['ip'];
- $iplog = system::db()->update('users', array( 'ip_last'=> $ip));
- }
- }
- }
- }
- }
- if($_SESSION['login'] = true) {
- header("Location: home.php");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement