Your Ad Here

Posted By

bitlimakina on 08/26/10


Tagged

login


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

convergine


check_user


 / Published in: PHP
 

  1. function checkuser($user,$pw) {
  2. $link = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('Veri tabanı bağlantısı sağlanamadı!');
  3. $pw = md5($pw);
  4. $sorgu ="SELECT * FROM users WHERE user_name= ? AND user_pass= ? LIMIT 1";
  5. if($smt = $link->prepare($sorgu)){
  6. $smt->bind_param('ss' ,$user, $pw);
  7. $smt->execute();
  8. $smt->bind_result($user_name);
  9. if ($smt->fetch()){
  10. $_SESSION['user'] = $user_name;
  11. $_SESSION['logged'] = true;
  12. return true;
  13. } else {
  14. $_SESSION['error'] ="Hata!";
  15. return false;
  16. }
  17. $smt->close();
  18. }
  19. $link->close();
  20. }

Report this snippet  

You need to login to post a comment.