Advertisement
Guest User

ZF2-06

a guest
Apr 23rd, 2013
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  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.         'age' => $signup->age,
  14.         'imgname' => $signup->fileImg,
  15.     );
  16.     $id = (int)$signup->id;
  17.     if ($id == 0) {
  18.         $this->tableGateway->insert($data);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement