Advertisement
Guest User

Untitled

a guest
Jan 9th, 2013
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <?
  2.  
  3.  
  4. // Sekcja logowania
  5. $Logins=stripslashes(mysql_real_escape_string($_POST['Logins']));
  6. if($Logins) {
  7.  
  8. //addslashes() //przed zapisaniem tekstu do bazy/pliku
  9. //stripslashes() //przed wyświetleniem tekstu z bazy/pliku
  10. $uzytkownik=stripslashes(mysql_real_escape_string($_POST['login']));
  11. $haslo=stripslashes(mysql_real_escape_string($_POST['pass']));
  12.  
  13.  
  14. //
  15.  
  16. $a=mysql_query("SELECT password FROM authme where username = '$uzytkownik' LIMIT 1");
  17. if(mysql_num_rows($a) == 1 ) {
  18. $password_info=mysql_fetch_array($a);
  19. $sha_info = explode("$",$password_info[0]);
  20. } else {error('Nie ma takiego konta lub podałaś/eś błęde dane'); return false;}
  21.  
  22. if( $sha_info[1] === "SHA" ) {
  23. $salt = $sha_info[2];
  24. $sha256_password = hash('sha256', $haslo);
  25. $sha256_password .= $sha_info[2];;
  26.  
  27. if( strcasecmp(trim($sha_info[3]),hash('sha256', $sha256_password) ) == 0 )
  28. {
  29. session_register("uzytkownik");
  30. ok('Zalogowano poprawnie. <a href="index.php">OK</a>');
  31. header("Location: index.php");
  32. }
  33. else
  34. {
  35. error('Nie ma takiego konta lub podałaś/eś błęde dane');
  36. }
  37.  
  38. }
  39.  
  40. }
  41.  
  42. // Koniec sprawdzania autoryzacji.
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement