Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include("loginclass.php";
- $sessionclass = new sessions();
- session_set_save_handler(array(&$sessionclass, 'open'),
- array(&$sessionclass, 'close'),
- array(&$sessionclass, 'read'),
- array(&$sessionclass, 'write'),
- array(&$sessionclass, 'destroy'),
- array(&$sessionclass, 'gc'));
- session_start()
- $user = $_POST['user']; //pulls the username from the form
- $pw = $_POST['pass']; //pulls the pass from the form
- $pass = md5($pw); //makes our password an md5
- mysql_connect("localhost", "sunyon", "pass") or die("Could not connect to MySQL server!");
- mysql_select_db("sunyon_database") or die("Could not find MySQL database");
- $login = mysql_query("SELECT * FROM `users` WHERE `user` = '$user' AND `pass` = '$pass`"); //selects info from our table if the row has the same user and pass that our form does
- if(!mysql_num_rows($login)) //if the username and pass are wrong
- {
- header("Location: login.php"); //redirects to our login page
- die(); //stops the page from going any further
- }
- else
- {
- $_SESSION['username'] = $user;
- header("Location: controlpanel.php");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement