SHARE
TWEET

Untitled

a guest Jun 5th, 2017 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if(!isset($_POST['actio'])){
  2. $hidden = array('actio' => '1');
  3. echo form_open('user','',$hidden);
  4. $user = array(
  5.               'name'        => 'username',
  6.               'id'          => 'username',
  7.               'value'       => 'johndoe',
  8.               'maxlength'   => '20',
  9.               'size'        => '20',
  10.             );
  11. echo form_label('Username:','username'), form_input($user)."<br>";
  12. $password = array(
  13.               'name'        => 'password',
  14.               'id'          => 'password',
  15.               'value'       => 'johndoe',
  16.               'maxlength'   => '20',
  17.               'size'        => '20',
  18.             );
  19. echo form_label('Password:','password'),form_password($password)."<br>";
  20. echo form_submit('login','Login');
  21. echo form_close();
  22. }
  23. else{
  24.     $username = $_POST['username'];
  25.     $p = $_POST['password'];
  26.     $pw = md5($p);
  27.     $query = $this->db->query("SELECT * FROM `users` WHERE user_nome = '$username' AND user_pass = '$pw'");
  28.     $num = $query->num_rows();
  29.     echo $num;
  30.     if($num == 1){
  31. $cookie = array(
  32. 'name' => 'loggedin',
  33. 'value' => "$username",
  34. 'expire' => '86500',
  35. 'domain' => 'luisleite.net',
  36. 'prefix' => 'ap_'
  37. );
  38. set_cookie($cookie);
  39.         echo "Login realizado<br>";
  40.         echo get_cookie('username');
  41.     }
  42.     else{
  43.         echo "Algo está errado<br>";
  44.     }
  45. }
  46. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top