exit; } $secret = "6LfdFBUTAAAAAF40Be_HnpwT_Oj6CyDAsgtLohW_"; $recaptcha = new \ReCaptcha\ReCaptcha($secret); $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']); if ($resp->isSuccess()) { // verified! } else { $errors = $resp->getErrorCodes(); header("Location: " . $baseurl . "user/new/provider/?status=error&code=captcha&" . $querystring . "&respcode=" . http_build_query($errors)); exit; } $db = new MysqliDb(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE); $db->where("email", $email); if ($db->has("users")) { header("Location: " . $baseurl . "user/new/provider/?status=error&code=exists&" . $querystring); exit; } $Auth = new Auth(); // $result = $Auth->createUser($email, $password, $fname, $lname, $is_active = 1, $is_admin = 0, $is_provider = 0, $is_super = 0, $is_verified = 0); $result = $Auth->createUser($email, $password1, $fn, $ln, 1, 0, 1, 0, 0); if ($result['status']) { $attribute = array('pn' => $pn, 'ph' => $ph, 'title' => $prof, 'zip' => $zip); if ($Auth->setAttr($result['id'], $attribute)) { header("Location: " . $baseurl . "user/new/provider/done.php?e=" . $email); } else { die("auth error"); } } else { die("auth error"); }
$trail->setID($id); $info = $trail->getInfo("array"); $rating = $info['rating']; $ratings = $info['ratings']; $userRating = intval($_POST['value']); $newRatings = $ratings + 1; $weighted = $rating * $ratings; $add = $weighted + $userRating; $newRating = $add / $newRatings; $rate = $_SESSION['data']['rate']; if (is_array($rate)) { $rate[] = $id; } else { $rate = array(0, $id); } $_SESSION['data']['rate'] = $rate; $update = array("rate" => $rate); $authObj = new Auth(); $result = $authObj->setAttr($_SESSION['user_id'], $update); $update = array("rating" => $newRating, "ratings" => $newRatings); $response = $trail->setAttr($update); if ($response == "done") { $status = array("status" => "done", "rating" => round($newRating, 2), "ratings" => $newRatings); } else { $status = array("status" => "error", "message" => $result); } } else { $status = array("status" => "error", "message" => "unauth"); } header('Content-Type: application/json'); echo json_encode($status);