SHOW:
|
|
- or go back to the newest paste.
| 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 | } |