//	27-05-15 : terms and condition check
 if (!isset($_POST['terms'])) {
     header("Location:" . RESOURCE_PATH_DIY . "login?error=Terms and conditions not accepted.");
 } else {
     unset($_POST['terms']);
 }
 /*check email */
 if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
     header("Location:" . RESOURCE_PATH_DIY . "login?error=Invalid email.");
 }
 $_POST['contact_no'] = $_POST['country_code'] . $_POST['contact_no'];
 unset($_POST['country_code']);
 $_POST['dob'] = date("Y-m-d H:i:s", strtotime($_POST['dob']));
 $client = new Client();
 try {
     $data = $client->register($_POST);
 } catch (Exception $e) {
     /*return with exception */
     header("Location:" . RESOURCE_PATH_DIY . "login?error=" . $e->getMessage());
     exit;
 }
 $_SESSION['client'] = $data;
 $access_token = Hash::get($_SESSION['client']['client_id'], Hash::salt(10) . time());
 Logger::logPlobizUser($data['client_id'], $access_token, 'N/A', uniqid(), 'WEB', 1);
 $_SESSION['client']['access_token'] = $access_token;
 /*generate verification link 
  * 26-03-15 :: time() added to make unique everytime
  * */
 $verify = Hash::get($data['email'], 'verify_email' . time());
 $crud = CRUD::getInstance();
 $crud->insert("client_reset_tokens", array('client_id' => $data['client_id'], 'type' => 'email', 'hash' => $verify));