insert into - I can't add database in inbound data from salt method in php -
i have problem mentioned title. want add named tbl_users in database. tables column user_name, password ans salt. have hash class.
class hash { public static function create($string, $salt = '') { return hash('haval256,4',$string.$salt); } public static function salt($length = 32) { if(function_exists('random_bytes')) return random_bytes($length); else return mcrypt_create_iv($length); } public static function unique() { return self::create(uniqid()); } }
i creating $salt variable salt column hash::salt. but, when added $salt variable value in salt column, can't add value.
$salt = hash::salt(); $pass = hash::create('123456',$salt); $query = connection::getinstance()->getconnection("insert tbl_user set user_name='blablabla' password='$pass', salt='$salt'");
but, can add random values ('2345234',fgsdffs' that). can't solve this. i'm waiting help. way knowing english weak. i'am sorry.
you missing comma before password=.
note can upset setting password 'xx''; drop table tbl_user;'
Comments
Post a Comment