SHARE
TWEET

ZF2-06b

a guest Apr 23rd, 2013 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?PHP
  2. use Zend\Crypt\Password\Bcrypt;
  3.  
  4. public function saveUser(Signup $signup)
  5. {
  6.     $bcrypt = new Bcrypt();
  7.     $hash = $bcrypt->create(preg_replace('/\s+/', ' ', $signup->password));
  8.     $data = array(
  9.         'firstname' => preg_replace('/\s+/', ' ', $signup->firstname),
  10.         'lastname' => preg_replace('/\s+/', ' ', $signup->lastname),
  11.         'username' => preg_replace('/\s+/', ' ', $signup->username),
  12.         'password' => $hash,
  13. /*  Data saved against password field for the number 1212 = $2y$14$6qFtNrzv.qcjckwwoQCFqeoUenlmKmrH0uvxGve7kk0bwmNLqtr6a
  14. */
  15.         'age' => $signup->age,
  16.         'imgname' => $signup->fileImg,
  17.     );
  18.     $id = (int)$signup->id;
  19.     if ($id == 0) {
  20.         $this->tableGateway->insert($data);
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top