public function register() { $model = new Login_Model(); if ($model->email_exists()) { echo '<h1>email already exists</h1>'; $this->view->render('login/register', 0); exit; } $id = $this->model->sign_up(); if ($id > 0) { Session::init(); Session::set('id', $id); echo Session::get('id'); echo 'successful registration'; header("Location:http://localhost/socialiko/post"); } else { echo 'error in registration form'; } }