public static function RegMail($acc)
 {
     //leap mail
     $lm = new Leapmail();
     $lm->senderMail = "*****@*****.**";
     $isi .= "Berikut Adalah Kredensial Pendaftaran Anda \n\n";
     $isi .= "";
     $isi .= "Email Anda : " . $acc->admin_email . "\n";
     $isi .= "Password : "******"\n\n";
     $isi .= "Silahkan Mulai Membeli Barang Branded dan ORI dengan Harga Miring!! \n\n Visit http://b3l1.com/firsttime for more Information";
     $isi .= "\n\n";
     $isi .= "Untuk Informasi lebih lanjut bisa melakukan email ke info@b3l1.com";
     $lm->sendEmail($cm->user_email, "Proses Registrasi B3l1.COM", $isi);
 }
 public function sendwithreturn()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $json = array();
     $json['status_code'] = 1;
     $idOrder = $_GET['id_order'];
     $toEmail = $_GET['email'];
     $order = new MasterOrderModel();
     $order->getByID($idOrder);
     $resto = new MasterRestaurantModel();
     $resto->getByID($order->id_restaurant);
     $subject = "Your receipt from " . $restoName . " , Receipt#" . $idOrder;
     $od = new OrderDetailModel();
     $d = new MasterDishModel();
     //      $dompdf = new Dompdf\Dompdf();
     global $db;
     $q = "SELECT {$od->table_name}.id_dish, {$d->table_name}.name, SUM(quantity) AS sum_qty, {$d->table_name}.price,\nSUM({$od->table_name}.price) AS sum_price, status_progress FROM `{$od->table_name}`\nRIGHT JOIN {$d->table_name} ON {$od->table_name}.id_dish = {$d->table_name}.id_dish WHERE id_order='{$idOrder}' GROUP BY id_dish";
     $arrDetails = $db->query($q, 2);
     $css_boot = _BPATH . "themes/tbstheme_ori/css/bootstrap.min.css";
     $image1 = _BPATH . _PHOTOURL . $resto->image_logo;
     if ($image1 == "") {
         $image1 = _BPATH . _PHOTOURL . "noimage.jpg";
     }
     $head = "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
     $head = "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Notification email</title>";
     $head = $head . "<link href=" . $css_boot . " rel=\"stylesheet\">";
     $head = $head . "<link href=\"https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700&subset=latin,latin-ext\" rel=\"stylesheet\" type=\"text/css\">";
     $head = $head . "</head>";
     $html = "<div style=\"max-width: 800px; box-shadow: 0 0 10px rgba(0, 0, 0, .15); font-size: 16px; line-height: 24px; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #555; margin: auto; padding: 30px; border: 1px solid #eee;\">\n<table style=\"width: 100%; line-height: inherit; text-align: left;\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"vertical-align: top; padding: 5px;\" colspan=\"2\">\n<table style=\"width: 100%; line-height: inherit; text-align: left;\">\n<tbody>\n<tr>\n<td style=\"vertical-align: top; font-size: 45px; line-height: 45px; color: #333; width: 50%; display: block; text-align: left; padding: 5px 5px 20px;\" align=\"left\" valign=\"top\"><img style=\"width: 50%; max-width: 300px;\" src=" . $image1 . " alt=\"\" /></td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; width: 100%; display: block; text-align: left; padding: 5px 5px 40px;\" align=\"center\" valign=\"top\">";
     $html = $html . "<strong>" . $resto->name . "</strong><br />";
     $html = $html . $resto->district . " - " . $resto->city . " <br>";
     $html = $html . "Phone : " . $resto->phone_no . "</td>";
     $html = $html . "</tr>\n</tbody>\n</table>\n</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; padding: 5px;\" colspan=\"2\" valign=\"top\">\n<table style=\"width: 100%; line-height: inherit; text-align: left;\">\n<tbody>\n<tr>\n<td style=\"vertical-align: top; text-align: left; t width: 50%; display: block; padding: 5px 5px 20px;\" align=\"left\" valign=\"top\">";
     $html = $html . "</tr>";
     $html = $html . "Receipt #: " . $idOrder;
     $html = $html . "<br/>";
     $html = $html . "  Server : ";
     if ($order->type_order == "1" || $order->type_order == "3") {
         $html = $html . "Apps Order";
     } else {
         $html = $html . $order->server_name;
     }
     $html = $html . "<br/>";
     $html = $html . " Time Order : " . date("d M, Y H:m", strtotime($order->datetime_order));
     $html = $html . "<br/>";
     $html = $html . " Payment Method : " . Generic::selectPaymentMethod($order->status_payment);
     $html = $html . "<br/>";
     if ($order->type_order == "1" || $order->type_order == "3") {
         $html = $html . "Apps Order";
     } else {
         $html = $html . "Manual Order";
     }
     $html = $html . "<br/>";
     $html = $html . "</td>";
     $html = $html . "</tr> \n</tbody>\n</table>\n</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #ddd; font-weight: bold; background-color: #eee; padding: 5px;\" valign=\"top\" bgcolor=\"#eee\">Item</td>\n<td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #ddd; font-weight: bold; background-color: #eee; padding: 5px;\" align=\"center\" valign=\"top\" bgcolor=\"#eee\">#</td>\n<td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #ddd; font-weight: bold; background-color: #eee; padding: 5px;\" align=\"right\" valign=\"top\" bgcolor=\"#eee\">Price</td>\n  <td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #ddd; font-weight: bold; background-color: #eee; padding: 5px;\" align=\"right\" valign=\"top\" bgcolor=\"#eee\">Total</td>\n</tr>";
     foreach ($arrDetails as $details) {
         $void = "";
         if ($details->status_progress == "9") {
             $void = "<strong> Voided </strong>";
             $details->price = 0;
             $details->sum_price = 0;
         }
         $html = $html . "<tr><td style=\"vertical-align: top; border-bottom-width: 1px; border-bottom-color: #eee; border-bottom-style: solid; padding: 5px;\" valign=\"top\">" . $details->name . $void . "</td>";
         $html = $html . "<td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-color: #eee; border-bottom-style: solid; padding: 5px;\" align=\"right\" valign=\"top\">" . $details->sum_qty . "</td>";
         $html = $html . "<td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-color: #eee; border-bottom-style: solid; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($details->price) . "</td>";
         $html = $html . "<td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-color: #eee; border-bottom-style: solid; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($details->sum_price) . "</td></tr>";
     }
     $html = $html . "<tr>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Total : </td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->total_cost) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Disc Resto : </td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->disc_resto) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Disc Credit Card : </td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->disc_bank) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Disc MR : </td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->disc_mr) . "</td>\n</tr>\n\n<tr>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Tax PB1 : </td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->tax_pb1) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Service Charge : </td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->tax_pb1) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Other Charge : </td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->tax_pb1) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Grand Total :</td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->grand_total) . "</td>\n</tr>\n\n</tbody>\n</table>\n</div></html>";
     $html = $head . $html;
     $mail = new Leapmail();
     $res = $mail->sendEmailHTML($toEmail, $subject, $html);
     return $res;
 }
 public function sendOrderBulk()
 {
     $err = 0;
     $name = addslashes($_POST['name']);
     if ($name == "") {
         $err = 1;
     }
     /*$email = addslashes($_POST['email']);
       if($email==""){
           $err = 1;
       }
       if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
           $err = 1;
       }*/
     $mobile = addslashes($_POST['mobile']);
     if ($mobile == "") {
         $err = 1;
     }
     $address = addslashes($_POST['address']);
     if ($address == "") {
         $err = 1;
     }
     //prop:prop,city:kota,pengirim_name:pengirim_name,pengirim_mobile:pengirim_mobile
     $prop = addslashes($_POST['prop']);
     if ($prop == "") {
         $err = 1;
     }
     $city = addslashes($_POST['city']);
     if ($city == "") {
         $err = 1;
     }
     $pengirim_name = addslashes($_POST['pengirim_name']);
     if ($pengirim_name == "") {
         $err = 1;
     }
     $pengirim_mobile = addslashes($_POST['pengirim_mobile']);
     if ($pengirim_mobile == "") {
         $err = 1;
     }
     //total_goodcost:total_goodcost,berat_total:berat_total,jne_type:jne_type,jne_price:jne_price
     //total_shipcost:total_shipcost,total_cost:total_cost
     $total_goodcost = addslashes($_POST['total_goodcost']);
     if ($total_goodcost == "") {
         $err = 1;
     }
     $berat_total = addslashes($_POST['berat_total']);
     if ($berat_total == "") {
         $err = 1;
     }
     $jne_type = addslashes($_POST['jne_type']);
     if ($jne_type == "") {
         $err = 1;
     }
     $jne_price = addslashes($_POST['jne_price']);
     if ($jne_price == "") {
         $err = 1;
     }
     $total_shipcost = addslashes($_POST['total_shipcost']);
     if ($total_shipcost == "") {
         $err = 1;
     }
     $total_cost = addslashes($_POST['total_cost']);
     if ($total_cost == "") {
         $err = 1;
     }
     if (self::hasCart() < 1) {
         $err = 1;
     }
     $arrOOS = self::cekStok();
     $kurang_stok = count($arrOOS);
     if ($kurang_stok) {
         $err = 1;
     }
     if (!$err) {
         $cm = new CartModel();
         $cm->po_address = $address;
         $cm->po_name = $name;
         $cm->po_mobile = $mobile;
         $cm->po_date = leap_mysqldate();
         $cm->po_email = $email;
         $cm->po_pesanan_retail = json_encode(self::getCart());
         $cm->po_ip_address = $_SERVER['REMOTE_ADDR'];
         //baru
         $cm->prop = $prop;
         $cm->city = $city;
         $cm->pengirim_mobile = $pengirim_mobile;
         $cm->pengirim_name = $pengirim_name;
         $cm->total_goodcost = $total_goodcost;
         $cm->total_cost = $total_cost;
         $cm->total_shipcost = $total_shipcost;
         $cm->jne_price = $jne_price;
         $cm->jne_type = $jne_type;
         $cm->berat_total = $berat_total;
         $cm->jumlah_item = self::hasCart();
         $cm->po_pesanan_bulk = json_encode(self::getCartBulk());
         $arrm = array("retail" => self::getCart(), "bulk" => self::getCartBulk());
         $cm->po_pesanan = json_encode($arrm);
         $cm->userid = Account::getMyID();
         $cm->user_email = Account::getMyEmail();
         $po_id = $cm->save();
         if ($po_id) {
             self::kurangiStok($po_id);
             $json['bool'] = 1;
             $json['po'] = $po_id;
             //leap mail
             $lm = new Leapmail();
             $lm->senderMail = "*****@*****.**";
             $isi .= "Terima Kasih Anda Telah Melakukan Pemesanan \n\n";
             $isi .= "";
             $isi .= "Detail Pesanan : " . _BPATH . "CartOrder/details?po={$po_id} \n";
             $isi .= "Konfirmasi Sukses : " . _BPATH . "ordersuccesspage?po={$po_id} \n";
             $isi .= "Order History : " . _BPATH . "myorder \n\n";
             $isi .= "Terima Kasih Atas Pemesanan Anda, Silahkan Melakukan Transfer ke Rek \n";
             $isi .= str_replace("<br>", "\n", Efiwebsetting::getData('rek_bca'));
             $isi .= "\n\n Dengan berita 'Payment NR " . $po_id . "'";
             $isi .= "\n\n Pembayaran dengan Nama Rekening yang berbeda dengan Nama Account B3L1 Anda, HARUS melampirkan BERITA Transfer.";
             $isi .= "\n\n Barang akan kami process setelah pembayaran diterima. \n Pengiriman akan dilakukan setelah itu. ";
             $isi .= "\n\n Lama delivery sesuai JNE delivery sekitar 3-4 hari untuk paket REGULAR dan 1 hari untuk paket Yakin Esok Sampai.";
             $isi .= "\n\n Untuk Informasi lebih lanjut bisa melakukan email ke info@b3l1.com";
             $lm->sendEmail($cm->user_email, "Pemesanan Produk B3l1.COM", $isi);
             //$to = "*****@*****.**";
             //$subject = "Pemesanan b3l1";
             //$message = "Tgl : ".$cm->po_date."\n Nama : ".$name."\n Email :".$email."\n Mobile : ".$mobile."\n Address : ".$address."\n Pesanan : ".$cm->po_pesanan;
             //mail($to, $subject, $message);
             //header("Location:"._SPPATH."ordersuccesspage");
             //exit();
             $cm->getByID($po_id);
             $cm->load = 1;
             $cm->iden_nr = Account::getMyEmail() . " ORDER NR : " . $po_id;
             $cm->save();
         }
     } else {
         $json['bool'] = 0;
     }
     echo json_encode($json);
     exit;
 }
 function sendMsg()
 {
     $json['bool'] = 0;
     $json['err'] = "ok";
     $accid = addslashes($_POST['acc_id']);
     $judul = addslashes($_POST['judul']);
     $isi = addslashes($_POST['isi']);
     $emai = isset($_POST['emai']) ? addslashes($_POST['emai']) : 0;
     $type = isset($_POST['type']) ? addslashes($_POST['type']) : "casual";
     if ($accid == Account::getMyID()) {
         $json['err'] = Lang::t('Receipient ID error');
     }
     if ($accid == "") {
         $json['err'] = Lang::t('Receipient ID empty');
     }
     if ($judul == "") {
         $json['err'] = Lang::t('Message Title empty');
     }
     if ($isi == "") {
         $json['err'] = Lang::t('Message Content empty');
     }
     if ($json['err'] == "ok") {
         $in = new Inbox();
         $tgl = date("Y-m-d H:i:s");
         $in->inbox_from = Account::getMyID();
         $in->inbox_to = $accid;
         $in->inbox_giliran_read = $accid;
         $in->inbox_read = 0;
         $in->inbox_createdate = $tgl;
         $in->inbox_changedate = $tgl;
         $in->inbox_judul = $judul;
         $in->inbox_msg = $isi;
         $in->inbox_type = $type;
         $inboxid = $in->save();
         if ($inboxid) {
             $json['bool'] = $in->addInboxNotif($accid, $inboxid, 1);
             // cek read didalamnya makanya dikasi val 0
             //send mail
             if ($emai) {
                 $lem = new Leapmail();
                 if (!$lem->sendByID($accid, $judul, $isi)) {
                     $json['err'] = Lang::t('Send Email Failed');
                 }
             }
         } else {
             $json['err'] = Lang::t('Saving Failed');
         }
     }
     echo json_encode($json);
 }
 function asa()
 {
     $mail = new Leapmail();
     $html = $this->createHTMLMsg();
     pr($mail->sendEmail("*****@*****.**", "Aktivasi Restaurant", $html));
 }
Esempio n. 6
0
 function processRegister()
 {
     //masi copy paste
     $uname_min = 5;
     $uname_max = 15;
     $passwd_min = 5;
     $passwd_max = 15;
     $hp_min = 9;
     $hp_max = 15;
     $json = array();
     $json['err'] = "";
     $json['bool'] = 0;
     //check captcha
     if (isset($_POST['g-recaptcha-response'])) {
         $captcha = $_POST['g-recaptcha-response'];
     }
     if (!$captcha) {
         $json['err'] .= Lang::t('Please verify that you are not a robot') . "<br>";
     } else {
         $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LdxXBMTAAAAAAgT0r9Vgly2P8yyrtU2Io-OVDZa&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']);
         if ($response . success == false) {
             $json['err'] .= Lang::t('Please verify that you are not a robot') . "<br>";
         } else {
             //echo '<h2>Thanks for posting comment.</h2>';
             //human
             //                $json['err'] .= Lang::t('HUMANNN')."<br>";
         }
     }
     //END check captcha
     //check token
     $rand = $_SESSION['rand'];
     $token = $_POST['token'];
     if ($rand != $token) {
         $json['err'] .= "Wrong Token<br>";
     }
     //eND check token
     //check username
     $uname = addslashes($_POST['uname']);
     if (!validate_alphanumeric_underscore($uname)) {
         $json['err'] .= "Username must be alphanumeric<br>";
     }
     if ($uname == "") {
         $json['err'] .= "Username cannot be empty<br>";
     }
     if (strlen($uname) < $uname_min || strlen($uname) > $uname_max) {
         $json['err'] .= "The username is the wrong length. Min {$uname_min} Max {$uname_max} Characters.<br>";
     }
     //apakah sudah terpakai
     //END
     //Check password
     $pwd = addslashes($_POST['pwd']);
     //        if(!validate_alphanumeric_underscore($pwd)){
     //            $json['err'] .= "Password must be alphanumeric<br>";
     //        }
     if ($pwd == "") {
         $json['err'] .= "Password cannot be empty<br>";
     }
     if (strlen($pwd) < $passwd_min || strlen($pwd) > $passwd_max) {
         $json['err'] .= "The password is the wrong length. Min {$passwd_min} Max {$passwd_max} Characters.<br>";
     }
     $pwd2 = addslashes($_POST['pwd2']);
     if ($pwd != $pwd2) {
         $json['err'] .= "Password mismatched.<br>";
     }
     //EnD
     //CHeck name
     $name = addslashes($_POST['name']);
     if ($name == "") {
         $json['err'] .= "Name cannot be empty<br>";
     }
     if (!preg_match("/^[a-zA-Z ]*\$/", $name)) {
         $json['err'] .= "Only letters and white space allowed<br>";
     }
     //END
     //Check Address
     $addresss = addslashes($_POST['addresss']);
     if ($addresss == "") {
         $json['err'] .= "Address cannot be empty<br>";
     }
     //END
     //Check email
     $email = addslashes($_POST['email']);
     if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
         $json['err'] .= "Invalid Email Address<br>";
     }
     //apakah sudah terpakai
     //END
     //Check Phone
     $phone = addslashes($_POST['phone']);
     if (strlen($phone) < $hp_min || strlen($phone) > $hp_max) {
         $json['err'] .= "The phone is the wrong length. Min {$hp_min} Max {$hp_max} Characters.<br>";
     }
     //ENd
     if ($json['err'] == "") {
         //cek apakah email dan username masi free
         $acc = new Account();
         $nr = $acc->getJumlah("admin_email = '{$email}'");
         $nr2 = $acc->getJumlah("admin_username = '******'");
         if ($nr > 0) {
             $json['err'] .= "Email is already being registered.<br>";
         }
         if ($nr2 > 0) {
             $json['err'] .= "Username is already being registered.<br>";
         }
         if ($json['err'] == "") {
             //save as new Account
             $acc->admin_email = $email;
             $acc->admin_ip = $_SERVER['REMOTE_ADDR'];
             $acc->admin_nama_depan = $name;
             $acc->admin_password = $pwd;
             $acc->admin_username = $uname;
             $acc->admin_role = "normal_user";
             $acc->admin_type = 1;
             $acc->admin_aktiv = 0;
             $acc->admin_hash = md5($uname . $pwd . time());
             $acc->admin_reg_date = leap_mysqldate();
             $acc->admin_lastupdate = leap_mysqldate();
             $mid = $acc->save();
             if ($mid) {
                 $judul = "Your Registration at YourApp.Com";
                 $isi = "\n\n                    <h1>Thank you for registering with us!!</h1>\n                    <br>\n                    <a href='" . _BPATH . "verify?mid={$uname}&token={$acc->admin_hash}'>Verify My Account Now</a> <br>\n                    or open this link " . _BPATH . "verify?mid={$uname}&token={$acc->admin_hash}\n                    ";
                 //send email
                 $lm = new Leapmail();
                 //                    $lm->senderMail = "*****@*****.**";
                 //sementara disini..krn response error
                 $json['bool'] = 1;
                 $json['mid'] = $mid;
                 if ($mm = $lm->sendEmail($email, $judul, $isi)) {
                     $json['err'] .= $mm;
                 } else {
                     $json['err'] .= "Send Email failed. Please <a href='" . _SPPATH . "contact'>contact</a> us by email or phone.<br>";
                 }
             } else {
                 $json['err'] .= "Save failed. Please <a href='" . _SPPATH . "contact'>contact</a> us by email or phone.<br>";
             }
         }
     }
     echo json_encode($json);
     die;
 }
 public function forgotpass2()
 {
     $email = addslashes($_POST['email']);
     if ($email == "") {
         die("Please Insert Email Account");
     }
     $acc = new Account();
     $arr = $acc->getWhere("admin_email = '{$email}'");
     $acc = $arr[0];
     $lm = new Leapmail();
     $lm->senderMail = "*****@*****.**";
     $isi .= "Berikut Adalah Kredensial Pendaftaran Anda \n\n";
     $isi .= "";
     $isi .= "Email Anda : " . $acc->admin_email . "\n";
     $isi .= "Password : "******"\n\n";
     $isi .= "Silahkan Mulai Membeli Barang Branded dan ORI dengan Harga Miring!! \n\n Visit http://b3l1.com/firsttime for more Information";
     $isi .= "\n\n";
     $isi .= "Untuk Informasi lebih lanjut bisa melakukan email ke info@b3l1.com";
     $lm->sendEmail($acc->admin_email, "Recovery Password B3l1.COM", $isi);
     header("Location:" . _LANGPATH . "register?msg=Recovery%20Email%20sudah%20dikirim");
     exit;
 }
 public function setStatus()
 {
     $payment_status = isset($_GET['ps']) ? addslashes($_GET['ps']) : die('no ps');
     $po_id = isset($_GET['po']) ? addslashes($_GET['po']) : die('no po');
     $po = new CartModel();
     $po->getByID($po_id);
     $payment_status_lama = $po->payment_status;
     if ($payment_status_lama == '3') {
         //canceled ke gak canceled
         // kurangi stok
         CartWeb::kurangiStok($po_id, 1, 0);
     }
     if ($payment_status == '3') {
         //gak canceled ke canceled
         // release stok //tambah stok
         CartWeb::kurangiStok($po_id, 0, 0);
     }
     if ($payment_status == '1') {
         //leap mail
         $lm = new Leapmail();
         $lm->senderMail = "*****@*****.**";
         $isi .= "Terima Kasih Anda Telah Melakukan Pembayaran \n\n";
         $isi .= "";
         $isi .= "Detail Pesanan : " . _BPATH . "CartOrder/details?po={$po_id} \n";
         $isi .= "Order History : " . _BPATH . "myorder \n\n";
         $isi .= "\n\n Pengiriman akan kami jalankan secepatnya.";
         $isi .= "\n\n Lama delivery sesuai JNE delivery sekitar 3-4 hari untuk paket REGULAR dan 1 hari untuk paket Yakin Esok Sampai.";
         $isi .= "\n\n Untuk Informasi lebih lanjut bisa melakukan email ke info@b3l1.com";
         $lm->sendEmail($po->user_email, "Konfirmasi Pemrosesan Pemesanan Produk B3l1.COM", $isi);
     }
     if ($payment_status == '2') {
         //leap mail
         $lm = new Leapmail();
         $lm->senderMail = "*****@*****.**";
         $isi .= "Pengiriman Produk Pesanan Anda Sudah Dilakukan \n\n";
         $isi .= "";
         $isi .= "Detail Pesanan : " . _BPATH . "CartOrder/details?po={$po_id} \n";
         $isi .= "Order History : " . _BPATH . "myorder \n\n";
         $isi .= "\n\n Lama delivery sesuai JNE delivery sekitar 3-4 hari untuk paket REGULAR dan 1 hari untuk paket Yakin Esok Sampai.";
         $isi .= "\n\n Untuk Informasi lebih lanjut bisa melakukan email ke info@b3l1.com";
         $lm->sendEmail($po->user_email, "Pengiriman Produk B3l1.COM", $isi);
     }
     $po->payment_status = $payment_status;
     $po->load = 1;
     $po->save();
 }