Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(-1); ini_set('display_errors', 'on');
- Include 'db.php'; // Locates file from directory this file is in
- class login {
- var $uname;
- var $pass;
- var $sql;
- var $query;
- var $row;
- var $session;
- var $ver;
- //var $uname = stripslashes($uname); // Inject Protect
- //var $pass = stripslashes($pass);
- //var $uname = mysql_real_escape_string($uname);
- //var $pass = mysql_real_escape_string($pass);
- public function usercheck()
- {
- $this->uname = $_POST['username'];
- $this->pass = $_POST['password'];
- $this->sql = "SELECT * FROM users WHERE username='$this->uname' and password='$this->pass'";
- $this->query = mysql_query($this->sql) or die(mysql_error());
- if(mysql_num_rows($this->query) == 1)
- {
- $this->row = mysql_fetch_assoc($this->query); // Gets the value for each field in the row
- $this->session['id_user'] = $this->row['id_user']; // Store name is session var
- $this->session['username'] = $this->row['username']; // Store name is session var
- //header('Location: /site/main.php'); // Reload to update logincheck.php
- echo "Welcome ",$this->session['username'];
- }
- else {
- echo "Wrong Name Or Password";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement