$sth->bindValue('kid_id', $kid); $sth->bindValue('kid2', $value['kid_id']); $c = 0; try { $c = $sth->execute(); } catch (Exception $e) { } } else { $success = '0'; $msg = 'Already sent'; } } if ($c) { $success = '1'; $msg = 'Buddy Code sent.'; $msg1 = "Buddy Code for Jobstars"; DataClass::sendEmail($email, $msg1, $code, SMTP_EMAIL); } } else { $success = '0'; $msg = "Invalid email or no kid is linked with it"; } } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+ /*if($success=='1'){ echo json_encode(array("success"=>$success,"msg"=>$msg,"data"=>$data)); } else*/ echo json_encode(array("success" => $success, "msg" => $msg));
$success = "0"; $msg = "Incomplete Parameters"; $data = array(); } else { $sth = $conn->prepare("select * from users where email=:email"); $sth->bindValue("email", $email); try { $sth->execute(); } catch (Exception $e) { } $result = $sth->fetchAll(PDO::FETCH_ASSOC); if (count($result)) { $success = "0"; $msg = "Email is already taken"; } else { $success = "1"; $v_code = DataClass::generateRandomString(); $msg = "Verification Code Sent"; $message = "Verification Code for Jobstars"; $body_mail = "<div style='font-size:16px;line-height:1.4;'>\n\t\t\t\t<p>Thank you for registering on the JobStars App!</p>\n\t\t\t\t<p>Please enter the following verification code to complete the registration process: <b>" . $v_code . "</b></p>\n\t\t\t\t<p>Thanks and Enjoy!</p>\n\t\t\t\t<p>The JobStars Team </p><br>\n\t\t\t\t<p> ------------------------------------------------------------------------ </p>\n\t\t\t\t<p>Check out tutorials at www.jobstars.rocks/tutorials</p>\n\t\t\t\t\n\t\t\t\t<p>Email us for help at support@jobstars.rocks</p>\n\t\t\t\t</div>"; DataClass::sendEmail($email, $message, $body_mail, SMTP_EMAIL); } } // +-----------------------------------+ // + STEP 4: send json data + // +-----------------------------------+ if ($success == 1) { echo json_encode(array("success" => $success, "msg" => $msg, "data" => $v_code)); } else { echo json_encode(array("success" => $success, "msg" => $msg)); }