public function signupserviceAction() { $session = new Container('user'); $username = $session->username; $userid = $session->userid; $authusername = $session->username; $network = $session->network; $profilepic = $session->profilepic; $username = $this->params()->fromPost('username'); $password = $this->params()->fromPost('password'); $repassword = $this->params()->fromPost('repassword'); $agecertify = $this->params()->fromPost('agecertify'); if ($network != '') { if ($authusername != $username) { $result = new JsonModel(array('error' => "Authentication email is not maching")); return $result; } } if (filter_var($username, FILTER_VALIDATE_EMAIL) === false) { $result = new JsonModel(array('error' => "Please enter the valid email address.")); return $result; } if ($password != $repassword && $password != "") { $result = new JsonModel(array('error' => "Password is not matching.")); return $result; } if ($agecertify == null || $agecertify == '') { $result = new JsonModel(array('error' => "Please certify that your age atleast 13 and above.")); return $result; } if (!$this->getUserTable()->checkEmailAvailable($username)) { $key = md5(date('Y-m-d hh:mm:ss')); $session = new Container('global'); $regchannel = $session->channel; if ($network != '') { $userid = $this->getUserTable()->insertStudent($username, $password, $key, Constants::ROLE_STUDENT, $regchannel, $profilepic, 1); } else { $userid = $this->getUserTable()->insertStudent($username, $password, $key, Constants::ROLE_STUDENT, $regchannel, $profilepic, 0); } $this->getPlanTable()->insertUID($userid); if ($network != '') { $result = new JsonModel(array('success' => "You have successfully registered.")); return $result; } else { $mail = new EmailManager(); $mail->sendMail($username, $username, $key); $result = new JsonModel(array('success' => "You have successfully registered. Please check your Inbox for activation e-mail. Check the spam folder in case you don't see our email in your Inbox.")); return $result; } } else { $result = new JsonModel(array('error' => "This email ID already exists. Please enter a different one.")); return $result; } //} }