Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'core/init.php';
- if(Input::exists()){
- $user = new User();
- $salt = Hash::salt(32);
- try{
- $user->create(array(
- 'uname' => Input::get('uname'),
- 'mail' => Input::get('mail'),
- 'pass' => Hash::make(Input::get('pass'), $salt),
- 'salt' => $salt
- ));
- Session::flash('home', 'You have registered successfully now you can log in !');
- Redirect::to('index.html');
- }catch(Exception $e){
- die($e->getMessage());
- }
- }
- ?>
- <?php
- class Hash{
- public static function make($string, $salt = ''){
- return hash('sha256', $string . $salt);
- }
- public static function salt($length){
- return mcrypt_create_iv($length);
- }
- public static function unique(){
- return self::make(uniqid());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement