/** * * @param Array $requestdata * Callback function for creating user account. */ function createuseraccount($requestdata) { if (empty($requestdata)) { exit('Invalid Request.'); } if (!isset($requestdata['email'])) { exit('Email id is required.'); } if (!isset($requestdata['password'])) { exit('Password is required.'); } if (validateemail($requestdata['email'])) { $dd = new FinditDynamoDbUser(); $result = $dd->createUserProfile($requestdata); return $result; } }
if ($data['op'] == 'login') { $result = $user->validateuseraccount($_POST['email'], $_POST['password']); if ($result['status']) { $data = array(); $data['email'] = $result['email']['S']; $data['name'] = $result['name']['S']; $data['id'] = $result['id']['S']; $cookie = base64_encode(serialize($data)); setcookie('Findit_user', $cookie, 0, '/', '.findit.com'); $location = $_POST['redirect_uri']; header("Location: {$location}"); } else { echo 'Somrthing went wrong.Please try again.'; } } else { $count = $user->getUserCountByMail($_POST['email']); if ($count) { echo 'Used with this email id already exist'; } else { $result = $user->createUserProfile($data); $data = array(); $data['email'] = $result['email']['S']; $data['name'] = $result['name']['S']; $data['id'] = $result['id']['S']; $cookie = base64_encode(serialize($data)); setcookie('Findit_user', $cookie, 0, '/', '.findit.com'); $location = $_POST['redirect_uri']; header("Location: {$location}"); } } }