} else { $response["JunkshopID"] = $reply; } echo json_encode($response); } else { if ($tag == 'requestRegister') { $activationCode = $_POST['activationCode']; $username = $_POST['username']; $password = $_POST['password']; $reply = $DBFunction->VerifyCode($activationCode); if ($reply['status']) { if ($DBFunction->IsUsernameExisted($username)) { $response["ErrorStatus"] = TRUE; $response["ErrorMessage"] = "Sorry, username has already been taken."; } else { $reply = $DBFunction->RequestRegister($reply['junkshopID'], $username, $password); if ($reply == FALSE) { $response["ErrorStatus"] = TRUE; $response["ErrorMessage"] = "Sorry, there's a problem within our service. Please, try again later.\n(Error: G-4RE-G04)"; } else { $response["JunkshopID"] = $reply; } } } else { $response["ErrorStatus"] = TRUE; $response["ErrorMessage"] = $reply['message']; } echo json_encode($response); } else { if ($tag == 'requestJunkshopInfo') { $junkshopID = $_POST['junkshopID'];
$response["AccountID"] = $reply["us_ID"]; $response["AccountName"] = $reply["us_firstname"]; } echo json_encode($response); } else { if ($tag == 'requestRegister') { $firstname = $_GET['firstname']; $lastname = $_GET['lastname']; $username = $_GET['username']; $address = $_GET['address']; $password = $_GET['password']; if ($DBFunction->IsUsernameExisted($username)) { $response["ErrorStatus"] = TRUE; $response["ErrorMessage"] = "Sorry, username has already been taken. Please try another."; } else { $reply = $DBFunction->RequestRegister($firstname, $lastname, $username, $address, $password); if ($reply == FALSE) { $response["ErrorStatus"] = TRUE; $response["ErrorMessage"] = "Sorry, there's a problem within our service. Please, try again later.\n(Error: 4RE-G04)"; } else { $response["AccountID"] = $reply["us_ID"]; $response["AccountName"] = $reply["us_firstname"]; } } echo json_encode($response); } else { if ($tag == 'requestJunkshopList') { $junkshopList = $DBFunction->RequestJunkshopList(); if ($junkshopList == FALSE) { $response["ErrorStatus"] = TRUE; $response["ErrorMessage"] = "Sorry, there's a problem within our service. Please, try again later.\n(Error: 4JK-L04)";