function createCustomer() { session_save_path('/tmp'); ini_set('session.gc_probability', 1); if (!isset($_SESSION)) { session_start(); } $_SESSION['categories'] = $_POST['categories']; $_SESSION['sizes'] = $_POST['sizes']; $_SESSION['colors'] = $_POST['colors']; $_SESSION['gender'] = $_POST['gender']; /* * Parameters */ $email = $_REQUEST['email']; $password_hash = $this->createPasswordHash($_REQUEST['password']); /* * Mongo model */ $model = new Application_Models_MongoDB(); $model->createNewCustomer($email, $password_hash); /* * Grab newly created customer and return customer object * Auto login customer */ $customer_object = $model->getCustomerByEmail($email); $_SESSION['user'] = $customer_object; return $customer_object; }