Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class AuthenUser{
- private $username;
- private $password;
- private $passmd5;
- public function CNX(){
- mysql_connect('localhost', 'phobya_connect', 'amorderey1') or die(mysql_error() . "Couldnt connect to the server");
- mysql_select_db('phobya_testing') or die(mysql_error() . "Couldnt select the Database" );
- }
- public function __construct(){
- $this->username = $this->filter($_GET['username']);
- $this->password = $this->filter($_GET['password']);
- $this->passmd5 = md5($this->password);
- }
- public function filter($var)
- {
- $this->CNX();
- $escaped = mysql_real_escape_string($var);
- return preg_replace('/[^a-zA-Z0-9@.]/','',$escaped);
- }
- public function verifyUser(){
- $this->CNX();
- $query = mysql_query("SELECT * FROM members WHERE email='{$this->username}' AND password='{$this->passmd5}'");
- $num_rows = mysql_num_rows($query);
- if($num_rows > 0){
- echo 'true';
- }
- else
- echo 'false';
- }
- }
- $AU = new AuthenUser();
- $AU->verifyUser();
- ?>
Add Comment
Please, Sign In to add comment