greyhat49

bingung ma OOP gan..

Apr 26th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. validasi.php
  2. <?php
  3.     include ('user.php');
  4.    
  5.     class validasi extends user{//extend untuk menurunkan sifat yang ada pada class user pada kelas baru
  6.         //juga untuk mendapatkan hasil inisialisasi dari kelas user tersebut
  7.         public function login($email, $pass){//fungsi
  8.         /*$vEmail = mysql_query("select email from user");
  9.         $vPass = mysql_query("select password from user");*/
  10.         $qry = mysql_query("select * from user where email = '$email' and pass = '$pass'");
  11.         $xec = mysql_fetch_array($qry);
  12.         if($xec!=null){
  13.             echo '<h1><blink>berhasil login !';
  14.             }
  15.             else echo '<strong><h1><blink>password dan email anda salah';
  16.         }
  17.     }
  18.    
  19.     $log = new validasi('');
  20.     echo $log->login($this->email, $this->pass);
  21. ?>
  22.  
  23. user.php
  24. <?php
  25.  
  26.     include ('db.php');
  27.     class user{
  28.         public $email;
  29.         public $pass;
  30.        
  31.         public function __construct($pass){//construct
  32.             $this->email = $_POST['email'];
  33.             $this->pass = $_POST['pass'];
  34.            
  35.             /*$vEmail = mysql_query("select email from user");
  36.             $vPass = mysql_query("select password from user");*/
  37.         }
  38.     }
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment