Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region register only
- public function create_salt(){
- return bin2hex(mcrypt_create_iv(11, MCRYPT_DEV_URANDOM));
- }
- public function register($username, $password){
- //at this very moment usernames are case sensetive!
- $salt = $this->create_salt();
- $password = $this->create_hashed_password($password,$salt);
- global $dbhost, $dbusername, $dbpassword, $dbname;
- $con = new Database($dbhost, $dbusername, $dbpassword, $dbname);
- $query = $con->runQuery("INSERT INTO `users` VALUES('','".$username."','".$password."','".$salt."')");
- if($query){
- return true;
- }else{
- return false;
- }
- }
- #end
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement