Tema: Re: pasvordo patikrinimas
Autorius: Maug Lee
Data: 2012-01-16 15:14:56
Ainis wrote:
> idomi mintis, regis turetu stipriai pagilinti gyli.. :)

algoritmas su variacija „gylio pagilinimui“:

if ( empty($_POST['user']) or empty($_POST['password']) )
	die('nieka nier') ;

$q = "
    SELECT
        `encrypted_pass`
    FROM
        `users`
    WHERE
        `user` = '".magick_quotes_proof( $_POST['user'] )."'
    LIMIT
	1
" ;
$r = mysql_query($q) ;
if ( !mysql_num_rows($r) )
	die('keule gediminas') ;

$salt = "uv5is7VF" ;
$encrypted = sha1( $_POST['password'] . md5($salt) ) ;

if ( $encrypted != mysql_result($r, 0, 'encrypted_pass') )
	die('ka jyr?') ;
else
	echo 'vualia!' ;

-- 
M.Lee