Example #1
0
$bookingXml = "XMLfile=<BookTripRequest>\n  <SessionID>TestingForm</SessionID>\n  <TourOperatorCode>TIM</TourOperatorCode>\n  <AgencyCode>21754246</AgencyCode>\n  <ClientType></ClientType>\n  <ReturnItemList>Y</ReturnItemList>\n  <WantInsurance>N</WantInsurance>\n  <RoomPaxLists>\n    <TotalPassengerCount>2</TotalPassengerCount>\n    <PassengerList>\n      <PassengerCount>2</PassengerCount>\n      <Passenger>\n        <PassengerFirstName>{$firstname}</PassengerFirstName>\n        <PassengerLastName>{$lastname}</PassengerLastName>\n      </Passenger>\n      <Passenger>\n        <PassengerFirstName>Placeholder</PassengerFirstName>\n        <PassengerLastName>{$lastname}</PassengerLastName>\n      </Passenger>\n      <ChildList>\n        <ChildCount>0</ChildCount>\n      </ChildList>\n    </PassengerList>\n  </RoomPaxLists>\n  \n  <GatewayCode>{$gatewayCode}</GatewayCode>\n  <DestinationCode>{$destinationCode}</DestinationCode>\n  <DepartureDate>{$txtLeave}</DepartureDate>\n  <ReturnDate>{$txtReturn}</ReturnDate>\n  \n  <HotelRequest>\n    <RoomID>{$roomId}</RoomID>\n    <NumberOfRooms>1</NumberOfRooms>\n  </HotelRequest>\n  \n</BookTripRequest>";
$xmlResponse = do_post_request(BOOKING_URL, $bookingXml);
if (!empty($xmlResponse)) {
    if (@(!($sxe = simplexml_load_string($xmlResponse)))) {
        error_log("Error while parsing search xml for gatewayCode {$gatewayCode} and destinationCode {$destinationCode}", 0);
    }
    if (!($dom = dom_import_simplexml($sxe))) {
        error_log("Error while parsing search xml, second level, for gatewayCode {$gatewayCode} and destinationCode {$destinationCode}", 0);
    }
    $exceptionResponse = $dom->getElementsByTagName('ExceptionText');
    if ($exceptionResponse->length > 0) {
        error_log("Error while booking gatewayCode {$gatewayCode} and destinationCode {$destinationCode}, leaving {$txtLeave} and returning {$txtReturn}", 0);
    } else {
        $bookingNumber = $dom->getElementsByTagName('BookingNo')->item(0)->nodeValue;
        if (!empty($email)) {
            sendConfirmationEmail($bookingNumber, $email, $hotelName, $roomDesc, $txtLeave, $txtReturn, $quotedPrice, $firstname . " " . $lastname, $phone, $commentBox);
        }
        echo $bookingNumber;
        $numberPax = $dom->getElementsByTagName('NoAdult')->item(0)->nodeValue + $dom->getElementsByTagName('NoChild')->item(0)->nodeValue;
        $listPrice = $dom->getElementsByTagName('TotalPrice')->item(0)->nodeValue;
        //Total price less commission
        $netSupCost = "error";
        //start as error in case it isn't computed below
        $items = $dom->getElementsByTagName('Item');
        for ($i = 0; $i < $items->length; $i++) {
            $theItem = $items->item($i);
            $componentCode = $theItem->getElementsByTagName('ComponentCode')->item(0)->nodeValue;
            //search for the hotel commission ignore all others
            if (!empty($componentCode) && strcmp($componentCode, "R") == 0) {
                $commission = $theItem->getElementsByTagName('CommissionDueAmount')->item(0)->nodeValue;
                $netSupCost = $listPrice - $commission;
    #	$emailLead = "*****@*****.**";
    $getDuplicados = $client->get_entry_list($session_id, 'Opportunities', 'trim(email_c) like "' . $emailLead . '"', 'email_c', 0, array('id', 'name', 'email_c'));
    $duplicados = $getDuplicados->entry_list;
    if (count($duplicados) > 0) {
        $nombre = "- D - " . $nombre;
    }
    # END VALIDAR DUPLICADOS
    // create a new contact record, assigned to this account, and grab the contact ID
    $response = $client->set_entry($session_id, 'Opportunities', array(array("name" => 'name', "value" => $nombre . ' ' . $apellido), array("name" => 'nombre_c', "value" => $nombre), array("name" => 'apellidos_c', "value" => $apellido), array("name" => 'email_c', "value" => $email), array("name" => $tipo_tel == 'Celular' ? 'telfalternativo_c' : 'telf_c', "value" => $tel), array("name" => 'cursosinteres_c', "value" => $area), array("name" => 'objetoestudio_c', "value" => $objeto), array("name" => 'edad_c', "value" => $edad), array("name" => 'horario_contacto_c', "value" => $horario), array("name" => 'comentario_c', "value" => $comentario), array("name" => 'viene_de_c', "value" => $vieneDe)));
    $leadCreado = $response->error->number == 0 ? 1 : 0;
    sendDebugMail('step leadCreado', $leadCreado);
    // SEND MAIL
    if ($leadCreado == 1) {
        //			sendDebugMail('step leadCreado 2', $leadCreado);
        $to = $myemail;
        $email_subject = "Registro recibido - Gastronómica Internacional";
        //			sendDebugMail('step semi semi final', $myemail . " " . $email_subject);
        sendConfirmationEmail($email);
        $email_body = "Registro Recibido. " . "\n Nombre: " . $nombre . "\n Apellido: " . $apellido . "\n Email: " . $email . "\n Teléfono: " . $tel . "\n Tipo de Teléfono: " . $tipo_tel . "\n Área de Interés: " . $area . "\n Viene de: " . $vieneDe . "\n Horario de contacto: " . $horario . "\n Edad: " . $edad . "\n Comentario: " . $comentario;
        sendDebugMail('step final', $email_body);
        $headers = "From: " . $myemail . "\n";
        $headers .= "Reply-To: " . $email;
        //			mail( $to, $email_subject, $email_body, $headers );
    } else {
        sendDebugMail('tep 13s', '');
    }
    ###################END CREACION DE LEAD EN SUGAR #################################
} else {
    $response['status'] = 'Error';
    $response['msg'] = 'Hubo un error en la comunicación.';
}
Example #3
0
    } else {
        $driverID = mysqli_insert_id($con);
        $sql = "INSERT INTO DriverHabits (DriverID, Home_Zip, Home_City, Work_Zip, Work_City, Avg_Weekday_Miles,Avg_Weekend_Miles, Avg_Monthly_Miles,Comments, Home_State, Work_State)\n\t\t\tVALUES ({$driverID},'{$home_zip}', '{$home_city}','{$work_zip}', '{$work_city}', '{$avg}', {$avg_weekend}, {$avgMonthlyMiles},'{$comments}','{$homeState}', '{$workState}')";
        error_log($sql, 3, 'mobile_bug.txt');
        if (!mysqli_query($con, $sql)) {
            error_log('Error: ' . mysqli_error($con), 3, 'mobile_bug.txt');
            echo $sql;
            die('Error: ' . mysqli_error($con));
        } else {
            $sql = "INSERT INTO VehicleInfo (DriverID,Year, Make, Model, Color,Current_Condition)\n\t\t\t\tVALUES ({$driverID},{$year}, '{$make}', '{$model}', '{$color}', '{$condition}')";
            error_log($sql, 3, 'mobile_bug.txt');
            if (!mysqli_query($con, $sql)) {
                error_log('Error: ' . mysqli_error($con), 3, 'mobile_bug.txt');
                die('Error: ' . mysqli_error($con));
            } else {
                sendConfirmationEmail();
                echo "succeed";
            }
        }
    }
}
function sendConfirmationEmail()
{
    $firstName = $_SESSION['firstName'];
    $email = $_SESSION['email'];
    //recipient - change this to your name and email
    $to = $email;
    //sender
    $from = '<*****@*****.**>';
    //subject and the html message
    $subject = 'Thanks For Signing up!';
function add($number, $email, $phone, $message)
{
    global $db, $countrycode;
    $userId = getUser($number);
    $phone = normalizephonenumber($phone);
    $result = $db->query("SELECT number,mail,userName FROM users where number={$phone} OR mail='{$email}'");
    if ($result->num_rows != 0) {
        $row = $result->fetch_assoc();
        $oldPhone = $row["number"];
        $oldName = $row["userName"];
        $oldMail = $row["mail"];
        sendSMS($number, _('Contact information conflict: This number already registered:') . " " . $oldMail . " +" . $oldPhone . " " . $oldName);
        return;
    }
    if ($phone < $countrycode . "000000000" || $phone > $countrycode + 1 . "000000000" || !preg_match("/add\\s+([a-z0-9._%+-]+@[a-z0-9.-]+)\\s+\\+?[0-9]+\\s+(.{2,}\\s.{2,})/i", $message, $matches)) {
        sendSMS($number, _('Contact information is in incorrect format. Use:') . " ADD king@earth.com 0901456789 Martin Luther King Jr.");
        return;
    }
    $userName = $db->conn->real_escape_string(trim($matches[2]));
    $email = $db->conn->real_escape_string(trim($matches[1]));
    $result = $db->query("INSERT into users SET userName='******',number={$phone},mail='{$email}'");
    sendConfirmationEmail($email);
    sendSMS($number, _('User') . " " . $userName . " " . _('added. They need to read email and agree to rules before using the system.'));
}
function register($number, $code, $checkcode, $fullname, $email, $password, $password2, $existing)
{
    global $db, $dbpassword, $countrycode, $systemURL;
    $number = $db->conn->real_escape_string(trim($number));
    $code = $db->conn->real_escape_string(trim($code));
    $checkcode = $db->conn->real_escape_string(trim($checkcode));
    $fullname = $db->conn->real_escape_string(trim($fullname));
    $email = $db->conn->real_escape_string(trim($email));
    $password = $db->conn->real_escape_string(trim($password));
    $password2 = $db->conn->real_escape_string(trim($password2));
    $existing = $db->conn->real_escape_string(trim($existing));
    $parametercheck = $number . ";" . str_replace(" ", "", $code) . ";" . $checkcode;
    if ($password != $password2) {
        response(_('Password do not match. Please correct and try again.'), ERROR);
    }
    if (issmssystemenabled() == TRUE) {
        $result = $db->query("SELECT parameter FROM history WHERE userId=0 AND bikeNum=0 AND action='REGISTER' AND parameter='{$parametercheck}' ORDER BY time DESC LIMIT 1");
        if ($result->num_rows == 1) {
            if (!$existing) {
                $result = $db->query("INSERT INTO users SET userName='******',password=SHA2('{$password}',512),mail='{$email}',number='{$number}',privileges=0");
                $userId = $db->conn->insert_id;
                sendConfirmationEmail($email);
                response(_('You have been successfully registered. Please, check your email and read the instructions to finish your registration.'));
            } else {
                $result = $db->query("SELECT userId FROM users WHERE number='{$number}'");
                $row = $result->fetch_assoc();
                $userId = $row["userId"];
                $result = $db->query("UPDATE users SET password=SHA2('{$password}',512) WHERE userId='{$userId}'");
                response(_('Password successfully changed. Your username is your phone number. Continue to') . ' <a href="' . $systemURL . '">' . _('login') . '</a>.');
            }
        } else {
            response(_('Problem with the SMS code entered. Please check and try again.'), ERROR);
        }
    } else {
        $result = $db->query("INSERT INTO users SET userName='******',password=SHA2('{$password}',512),mail='{$email}',number='',privileges=0");
        $userId = $db->conn->insert_id;
        $result = $db->query("UPDATE users SET number='{$userId}' WHERE userId='{$userId}'");
        sendConfirmationEmail($email);
        response(_('You have been successfully registered. Please, check your email and read the instructions to finish your registration. Your number for login is:') . " " . $userId);
    }
}
<?php

header('Content-type: application/json');
chdir('../../common');
require_once 'init.php';
chdir('../database');
require_once 'plataform.php';
chdir('../actions');
require_once 'plataform.php';
chdir('../ajax/plataform');
if (isset($_GET['name']) and isset($_GET['email']) and isset($_GET['password'])) {
    $user = getUserByEmail($_GET['email']);
    if (isset($user) and ($user['privilege'] == 'merchant' or $user['privilege'] == 'admin')) {
        echo json_encode(array("result" => "userAlreadyExists"));
    } else {
        try {
            $id = createMerchant($_GET['name'], $_GET['email'], $_GET['password']);
            $hash = generateActivationHash($id);
            sendConfirmationEmail($id);
            echo json_encode(array("result" => "ok", "id" => $id));
        } catch (Exception $e) {
            echo json_encode(array("result" => "error"));
        }
    }
} else {
    echo json_encode(array("result" => "missingParams"));
}
Example #7
0
if ($_POST['type'] == 'credit') {
    require "../modules/cccharge.php";
    $amount = createAmount($user);
    $invoice = createInvoice();
    $result = chargeCreditCard($amount, $_POST['first-name'], $_POST['last-name'], $_POST['email'], $_POST['card'], $_POST['exp'], $_POST['cvc'], $invoice);
    if ($result) {
        registerCourses($db, $user);
        displayConfirmation($db, $amount, $invoice);
        sendConfirmationEmail($db, $user, $amount, $invoice);
    } else {
        error("Unforseen Error", "Something failed in an unexpected way. Please contact the Experimental College and ask to speak with the webmaster");
    }
} else {
    registerCourses($db, $user);
    displayConfirmation($db, $amount, $invoice);
    sendConfirmationEmail($db, $user, $amount, $invoice);
}
$_SESSION["cart"] = null;
//verifies user data, throws errors if they arent signed in, if there is no data,
//if there are no classes, or if there's missing credit data
function verifyInputData()
{
    if (empty($_SESSION["id"])) {
        error("No Logon Info", "Please login to continue");
    }
    if (count($_SESSION["cart"]) < 2 && !$_POST['outside']) {
        error("No classes", "You don't have any classes to sign up for!");
    }
    if (empty($_POST['referred']) || $_POST['referred'] == "Select...") {
        error("Missing Referral", "Please select a referral location. This information is anonymous");
    }
    $mailcontent .= 'Name: ' . $contact_name . "\n" . 'Company Name: ' . $cname . "\n" . 'Item: ' . $delenum . "\n\n" . 'Amount paid: €' . $theAmount . "\n" . 'Amount: EUR ' . money_format("%.2i", $amount) . "\n" . 'Tax: EUR ' . money_format("%.2i", $taxAmount) . "\n" . 'Order ID: ' . $bookingID . "\n\n";
    $toaddress = $email;
    mail($toaddress, $subject, $mailcontent, $fromaddress);
    $toaddress = "";
    mail($toaddress, $subject, $mailcontent, $fromaddress);
    $toaddress = "";
    mail($toaddress, $subject, $mailcontent, $fromaddress);
}
if (isset($_GET['ID'])) {
    $post_id = $_GET['ID'];
    $location_home = home_url();
    $location_plugin = plugins_url();
    if ($_GET['success'] == '1') {
        $password = randomPassword();
        update_post_meta($post_id, 'my_meta_order_id', $_GET['orderID']);
        update_post_meta($post_id, 'my_meta_response', $_GET['response']);
        update_post_meta($post_id, 'my_meta_password', $password);
        update_post_meta($post_id, 'my_meta_paid', true);
        wp_publish_post($post_id);
        sendConfirmationEmail($_GET['ID'], $password);
        $page_success_url = $location_home . "/table-summary/";
        wp_redirect($page_success_url);
    } else {
        update_post_meta($post_id, 'my_meta_response', $_GET['response']);
        $page_rd = $location_home . "/payment-page/?ID=" . $_GET['ID'] . "&error=" . $_GET['error'];
        wp_redirect($page_rd);
    }
} else {
    $tablebooking_page = $home_url . "/table-booking/";
    wp_redirect($tablebooking_page);
}