コード例 #1
0
require 'db_connect.inc.php';
$connect = mysqli_connect(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);
if (mysqli_connect_errno()) {
    showJson(10, "Cannot connect with MySql :" . mysqli_connect_errno());
    mysqli_close($connect);
} else {
    //Successfully connected
    if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['password'])) {
        $name = $_POST['name'];
        $email = $_POST['email'];
        $password = $_POST['password'];
        if (!empty($name) && !empty($email) && !empty($password)) {
            if (getUserId($connect, $email) === 0) {
                if (createAccount($connect, $name, $email, $password) == 1) {
                    sendEmailConfirmation($email);
                    $id = getUserId($connect, $email);
                    $response = array();
                    $response['status'] = 1;
                    $response['message'] = "Account Created";
                    $response['user_id'] = $id;
                    echo json_encode($response);
                } else {
                    showJson(0, "Oops!...Details cannot be added into Database.Try again later.");
                    die;
                }
            } else {
                showJson(3, "Email has already been registered.");
            }
        } else {
            showJson(4, "Fields cannot be empty.");
コード例 #2
0
        if (UpdateMarketingUser($user, $fname, '', $company, $phone, $adv)) {
        } else {
            trigger_error('Failed to update marketing user ' . $user . "...\n");
        }
    } else {
        if (AddMarketingUser($fname, '', $company, $email, $phone, 0, $app, $adv)) {
            $user = MarketingUserIdWIthEmail($email);
        } else {
            trigger_error("Failed to add new marketing user...\n");
        }
    }
}
/* INTERNAL EMAIL */
sendInternalEmail();
/* EMAIL CONFIRMATION */
sendEmailConfirmation();
/* SHOW RESPONSE */
switch ($form) {
    case CONTACT_FORM:
        include 'form_success_contact.php';
        break;
    case DISCOVERY_FORM:
        $discovery = file_get_contents('form_success_discovery.php');
        $discovery = str_replace('@@user@@', $user, $discovery);
        echo $discovery;
        break;
    case DOWNLOAD_FORM:
        if (!AddDownload($user, $app, $version)) {
            trigger_error("Failed to add download...\n");
        }
        $download = file_get_contents('form_success_download.php');