Пример #1
0
 public function detailbooking()
 {
     global $CONFIG, $basedomain;
     $getProvinsi = $this->contentHelper->getProvinsi();
     $this->view->assign('prov', $getProvinsi);
     if (isset($_POST['submit'])) {
         $nama = $_POST['nama'];
         $alamat = $_POST['alamat'];
         $no_telp = $_POST['no_telp'];
         $email = $_POST['email'];
         $kota = $_POST['kota'];
         $provinsi = $_POST['provinsi'];
         $jumlah_kamar = $_POST['jumlah_kamar'];
         $extra_bed = $_POST['extra_bed'];
         $tamu_dewasa = $_POST['tamu_dewasa'];
         $tamu_anak = $_POST['tamu_anak'];
         $data = $this->contentHelper->inputbooking($_POST);
         // pr($data);
         if ($data['status'] == 1) {
             foreach ($data as $key => $value) {
                 if ($key == 'tanggal_masuk') {
                     $data['tanggalMasuk'] = changeDate($value);
                 }
                 if ($key == 'tanggal_keluar') {
                     $data['tanggalKeluar'] = changeDate($value);
                 }
             }
             $date1 = new DateTime($data['tanggal_masuk']);
             $date2 = new DateTime($data['tanggal_keluar']);
             $diff = $date2->diff($date1)->format("%a");
             $data['total'] = number_format($diff * 300000);
             $this->view->assign('data', $data);
             $msg = $this->loadView('emailTemplate');
             $send = sendGlobalMail($data['email'], false, $msg);
             // pr($data);
             // pr($msg);
             // exit;
             // echo "<script>alert('Data berhasil disimpan, silahkan periksa email anda');window.location.href='".$basedomain."booking'</script>";
         }
     }
     $tanggal_masuk = $_SESSION['data_booking']['tanggal_masuk'];
     $tanggal_keluar = $_SESSION['data_booking']['tanggal_keluar'];
     $tipe_kamar = $_SESSION['data_booking']['tipe_kamar'];
     $date1 = new DateTime($tanggal_masuk);
     $date2 = new DateTime($tanggal_keluar);
     $diff = $date2->diff($date1)->format("%a");
     $jumlahbook = 300000 * $diff;
     $this->view->assign('jumlahhari', $diff);
     $this->view->assign('jumlahbook', number_format($jumlahbook));
     $this->view->assign('data', $_SESSION['data_booking']);
     return $this->loadView('booking/detail_booking');
 }
Пример #2
0
 function forgotPassword()
 {
     global $CONFIG;
     $token = _p('token');
     $this->view->assign('status', true);
     if ($token) {
         // pr($_POST);
         $getToken = $this->loginHelper->getUserEmail(_p('email'), true);
         if ($getToken) {
             // send mail before activate account
             $dataArr['email'] = $getToken['email'];
             $dataArr['username'] = $getToken['username'];
             $dataArr['password'] = $getToken['password'];
             $dataArr['token'] = sha1('reset' . $getToken['email']);
             $dataArr['validby'] = $getToken['email_token'];
             $dataArr['regfrom'] = 1;
             $dataArr['reset'] = 1;
             $inflatData = encode(serialize($dataArr));
             logFile($inflatData);
             $to = $getToken['email'];
             $from = $CONFIG['email']['EMAIL_FROM_DEFAULT'];
             // $msg = "To activate your account please <a href='{$basedomain}login/validate/?ref={$inflatData}'>click here</a>";
             $this->view->assign('email', $getToken['email']);
             $this->view->assign('username', $getToken['username']);
             $this->view->assign('encode', $inflatData);
             $this->view->assign('content', "reset");
             $msg = "<p>Hi " . $getToken['username'] . "!</p>";
             $msg .= $this->loadView('emailTemplate');
             // try to send mail
             // pr($getToken);
             // exit;
             $sendMail = sendGlobalMail($to, $from, $msg, true);
             logFile('mail reset account send ' . serialize($sendMail));
             $this->view->assign('status', true);
         } else {
             $this->view->assign('status', false);
         }
         // $this->activityHelper->updateEmailLog(false,$to,'account',0);
         /*$verifiedData = $this->loginHelper->resetAccount($to);
          	if ($verifiedData){
          		echo 'true';
          	}*/
     }
     return $this->loadView('forgot-password');
 }
Пример #3
0
 function signup()
 {
     global $basedomain;
     // pr($_POST);
     if ($_POST['g-recaptcha-response']) {
         $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LcrRQwTAAAAACtWyyx6tUJO_TWg8l7ddhrriCDI&response=" . $_POST['g-recaptcha-response'] . "&remoteip=" . $_SERVER['REMOTE_ADDR']), true);
         // pr($response);
         if ($response['success'] == false) {
             echo '<h2>You are spammer ! Get the @$%K out</h2>';
             exit;
         } else {
             if ($_POST['token']) {
                 $is_email_valid = false;
                 $email_validate = $_POST['email'];
                 if (filter_var($email_validate, FILTER_VALIDATE_EMAIL)) {
                     $is_email_valid = true;
                 }
                 if (!$is_email_valid) {
                     logFile('email not valid = ' . $email_validate);
                     redirect($basedomain . 'register');
                     exit;
                 }
                 $register = $this->userHelper->createAccount($_POST);
                 if ($register) {
                     $this->view->assign('email', $register['email']);
                     $this->view->assign('name', $register['name']);
                     $this->view->assign('encode', $register['encode']);
                     $html = $this->loadView('akun/emailTemplate');
                     // db($register);
                     // logFile($msg);
                     // $html = "klik link berikut ini {$basedomain}register/validate/?ref={$msg}";
                     $send = sendGlobalMail($register['email'], false, $html);
                     redirect($basedomain . 'register/status');
                 } else {
                     redirect($basedomain . 'register');
                 }
                 exit;
             }
         }
     } else {
         echo "<script>alert('Silahkan Cek Captcha terlebih dahulu')</script>";
         redirect($basedomain . "register");
     }
 }
Пример #4
0
 /**
  * @todo insert individu from posted data
  * */
 public function insertIndiv()
 {
     global $basedomain, $CONFIG;
     $data = $_POST;
     //get data user from session
     $session = new Session();
     //$login = $session->get_session();
     //$userData = $login['ses_user'];
     $userData = $session->get_session();
     $personID = $userData['login']['id'];
     $data['personID'] = $personID;
     //pr($personID);exit;
     $insertData = $this->insertonebyone->insertTransaction('indiv', $data);
     if ($insertData) {
         if ($insertData['status']) {
             $sess_onebyone = array('indivID' => $insertData['lastid']);
             $session->set_session($sess_onebyone, 'onebyone');
             //Email notif
             $html = "Data telah diperbaharui";
             $data_email = $this->insertonebyone->get_email();
             pr($html);
             // $send = sendGlobalMail(trim($data_email),$CONFIG['email']['EMAIL_FROM_DEFAULT'],$html);
             $send = sendGlobalMail('*****@*****.**', $CONFIG['email']['EMAIL_FROM_DEFAULT'], $html);
             vd($send);
             exit;
             exit;
             $this->msg->add('s', 'Sukses Memperbarui Individu');
             // header('Location: ../onebyone/detContent');
             redirect($basedomain . 'onebyone/detContent');
         } else {
             $this->msg->add('e', 'Gagal Memperbarui Individu');
             // header('Location: ../onebyone/indivContent');
             redirect($basedomain . 'onebyone/indivContent');
         }
     } else {
         $this->msg->add('e', 'Gagal Memperbarui Individu');
         // header('Location: ../onebyone/indivContent');
         redirect($basedomain . 'onebyone/indivContent');
     }
 }
Пример #5
0
 function debug()
 {
     $param = _g('param');
     if ($param) {
         switch ($param) {
             case '1':
                 phpinfo();
                 break;
             case '2':
                 sendGlobalMail('*****@*****.**', '*****@*****.**', 'testing send mail');
                 break;
             default:
                 echo 'debug mode not specified';
                 break;
         }
     } else {
         echo 'param : <br>1. Php Info</br>2. Send Mail';
     }
     exit;
 }
Пример #6
0
 /**
  * @todo create new user
  *           
  * @return $statusName and $msgName = status and message for validating name
  * @return $statusEmail and $msgEmail = status and message for validating email
  * @return $statusUsername and $msgUsername = status and message for validating username
  * @return $statusTwitter and $msgTwitter = status and message for validating twitter                  
  */
 function doSignup()
 {
     global $CONFIG;
     $data = $_POST;
     $checkEmail = $this->loginHelper->checkEmail($data['email']);
     $checkUsername = $this->loginHelper->checkUsername($data['username']);
     $checkTwitter = $this->loginHelper->checkTwitter($data['twitter']);
     if ($checkEmail !== true || $checkUsername !== true || $checkTwitter !== true) {
         $statusEmail = "";
         $msgEmail = "";
         $statusUsername = "";
         $msgUsername = "";
         $statusTwitter = "";
         $msgTwitter = "";
         if ($checkEmail !== true) {
             $statusEmail = "exist";
             $msgEmail = "Email already exist";
         }
         if ($checkUsername !== true) {
             $statusUsername = "******";
             $msgUsername = "******";
         }
         if ($checkTwitter !== true) {
             $statusTwitter = "exist";
             $msgTwitter = "Twitter already exist";
         }
         echo json_encode(array('statusEmail' => $statusEmail, 'msgEmail' => $msgEmail, 'statusUsername' => $statusUsername, 'msgUsername' => $msgUsername, 'statusTwitter' => $statusTwitter, 'msgTwitter' => $msgTwitter));
         exit;
     }
     // else{
     //     echo json_encode(array('status' => 'error'));
     //     exit;
     // }
     if ($checkEmail && $checkUsername && $checkTwitter) {
         $signup = $this->loginHelper->createUser($data);
         // uncomment in server
         // if ($signup){
         $getToken = $this->loginHelper->getEmailToken($data['username']);
         // send mail before activate account
         $dataArr['email'] = $data['email'];
         $dataArr['username'] = $data['username'];
         $dataArr['password'] = $data['password'];
         $dataArr['token'] = sha1('register' . $data['email']);
         $dataArr['validby'] = $getToken['email_token'];
         $dataArr['regfrom'] = 1;
         $inflatData = encode(serialize($dataArr));
         logFile($inflatData);
         $to = $data['email'];
         $from = $CONFIG['email']['EMAIL_FROM_DEFAULT'];
         // $msg = "To activate your account please <a href='{$basedomain}login/validate/?ref={$inflatData}'>click here</a>";
         $this->view->assign('email', $data['email']);
         $this->view->assign('username', $data['username']);
         $this->view->assign('encode', $inflatData);
         $this->view->assign('content', "pembuatan");
         $msg = "<p>Hi " . $data['username'] . "!</p>";
         $msg .= $this->loadView('emailTemplate');
         // try to send mail
         $sendMail = sendGlobalMail($to, $from, $msg, true);
         logFile('mail send ' . serialize($sendMail));
         $this->activityHelper->updateEmailLog(false, $to, 'account', 0);
         // }
         echo json_encode(array('status' => true));
         exit;
     }
     exit;
 }
Пример #7
0
 function register()
 {
     global $basedomain, $CONFIG, $LOCALE;
     $salt = md5('register');
     if ($_POST['submit']) {
         $checkBefore['table'] = "bsn_users";
         $checkBefore['condition'] = array('email' => $_POST['email']);
         $checkDataBefore = $this->contentHelper->fetchData($checkBefore);
         if ($checkDataBefore) {
             if ($checkDataBefore) {
                 echo "<script>alert('Email sudah digunakan');window.location.href='{$basedomain}home/register'</script>";
             }
             exit;
         }
         $pass = _p('pass');
         $pass1 = _p('retypePass');
         if ($pass === $pass1) {
             $_POST['password'] = sha1($salt . $pass . $salt);
             $_POST['salt'] = $salt;
             $_POST['n_status'] = 0;
             $_POST['register_date'] = date('Y-m-d H:i:s');
             $_POST['login_count'] = 0;
             $_POST['type'] = 2;
             $_POST['email_token'] = $this->token;
             if ($_POST['receiveNotif']) {
                 $_POST['data'] = serialize(array('getNotif' => 1));
             }
             $signup = $this->contentHelper->saveData($_POST, "_users");
             if ($signup) {
                 $data['table'] = "bsn_users";
                 $data['condition'] = array('email' => $_POST['email']);
                 $checkData = $this->contentHelper->fetchData($data);
                 if ($checkData) {
                     // send mail
                     $dataSend['email'] = $checkData[0]['email'];
                     $dataSend['email_token'] = $checkData[0]['email_token'];
                     $serial = encode($dataSend);
                     $this->view->assign('encode', $serial);
                     $this->view->assign('email', $checkData[0]['email']);
                     $this->view->assign('password', $pass);
                     $this->view->assign('name', $checkData[0]['name']);
                     $this->view->assign('text', "Your request for new account.");
                     $link = "<a href='{$basedomain}home/verified/?token={$serial}'>{$LOCALE['default']['email_verification']}</a>";
                     $this->view->assign('link', $link);
                     $html = $this->loadView('emailTemplate');
                     $send = sendGlobalMail(trim($checkData[0]['email']), $CONFIG['email']['EMAIL_FROM_DEFAULT'], $html);
                     logFile($send);
                     if ($send) {
                         redirect($basedomain . 'home/register_confirmation/?status=1');
                     }
                 }
             } else {
                 redirect($basedomain . 'home/register');
             }
         }
     }
     return $this->loadView('akun/register');
 }
 /**
  * @todo insert data transaction
  * 
  * @param $table = table name
  * @param $data = array data to insert
  * @param $db2 = boolean using second database or not
  * 
  * @return $insert = status and last id of inserted data
  * 
  * */
 function insertTransaction($table = false, $data = array())
 {
     global $CONFIG, $basedomain;
     if (!$table and empty($data)) {
         return false;
     }
     $startTransaction = $this->begin();
     if (!$startTransaction) {
         return false;
     }
     logFile('====one by one: TRANSACTION READY====');
     /*if($table == 'person'){
           $username = $data['username'];
           unset($data['username']);
       }*/
     // if table det
     if ($table == 'det') {
         $kewid = $data['kewid'];
         $fam = $data['family'];
         $gen = $data['genus'];
         $sp = $data['species'];
         unset($data['kewid'], $data['family'], $data['genus'], $data['species']);
         if (empty($data['taxonID'])) {
             if (empty($data['taxonID']) && !empty($data['kewid'])) {
                 $check_exist = $this->data_exist('taxon', 'kewid', $kewid);
                 if ($check_exist) {
                     $data['taxonID'] = $check_exist['id'];
                 } else {
                     $dataPlantlist = $this->data_exist('plantlist', 'kewid', $kewid);
                     $insertPlantlist = $this->move_plantlist($dataPlantlist);
                     $data['taxonID'] = $insertPlantlist['lastid'];
                 }
             } else {
                 $select = $this->select_plantlist($fam, $gen, $sp);
                 $select_exist = $this->data_exist('taxon', 'kewid', $select['kewid']);
                 if ($select_exist) {
                     $data['taxonID'] = $select_exist['id'];
                 } else {
                     $insertSelected = $this->move_plantlist($select);
                     $data['taxonID'] = $insertSelected['lastid'];
                 }
             }
         }
     }
     // end if table det
     $insert = $this->insertData($table, $data);
     if ($insert['status'] == 0) {
         $this->rollback();
         logFile('====one by one: failed insert data====');
         $return['status'] = false;
     } else {
         // if table person, insert generated password
         if ($table == 'person') {
             $salt = $CONFIG['default']['salt'];
             $register_date = date('Y-m-d H:i:s');
             $token = sha1(CODEKIR . date('ymdhis'));
             //this is the generated password
             $genPass = $this->generate_pass();
             //this is the encrypted password
             $password = sha1($genPass . $salt);
             //this is the generated username
             $username = $this->generate_pass();
             //insert to table florakb_person
             $dataPass = array('id' => $insert['lastid'], 'password' => $password, 'username' => $username, 'salt' => $salt, 'register_date' => $register_date, 'email_token' => $token);
             $insert_dataPas = $this->insertData('florakb_person', $dataPass, true);
             if ($insert_dataPas['status'] == 0) {
                 $this->rollback();
                 logFile('====onebyone: failed insert to florakb_person====');
                 $return['status'] = false;
             } else {
                 /* EMAIL */
                 // send mail before activate account
                 $dataArr['email'] = $data['email'];
                 $dataArr['username'] = $username;
                 //logFile('onebyone: generate account '.serialize($dataArr));
                 $generateMail = $this->activityHelper->generateEmail($dataArr['email'], $dataArr['username'], 2, $token);
                 if (is_array($generateMail)) {
                     $sendUserAccount = sendGlobalMail($generateMail['to'], $generateMail['from'], $generateMail['msg'], true);
                     logFile('onebyone: generate account success ' . serialize($sendUserAccount));
                     if ($sendUserAccount['result']) {
                         $this->activityHelper->updateEmailLog(false, $data['email'], 'account', 1);
                         logFile('onebyone: send account to email success');
                         $this->commit();
                         $return['status'] = true;
                         $return['lastid'] = $insert['lastid'];
                     } else {
                         logFile('onebyone: send account to email failed');
                         $this->rollback();
                         $return['status'] = false;
                     }
                 } else {
                     logFile('onebyone: generate email failed');
                     $this->rollback();
                     $return['status'] = false;
                 }
                 /* EMAIL */
             }
             // insert to table florakb_person
         } else {
             $this->commit();
             logFile('====onebyone: success inserting data====');
             $return['status'] = true;
             $return['lastid'] = $insert['lastid'];
         }
     }
     return $return;
     exit;
 }
Пример #9
0
 function ins_balas()
 {
     global $basedomain, $CONFIG;
     //get FILES first
     foreach ($_POST as $index => $string) {
         if (strpos($string, 'fileUploadKey|') !== FALSE) {
             $matches[] = $string;
             unset($_POST[$index]);
         }
     }
     foreach ($matches as $key => $value) {
         $tmp[$key] = explode("|", $value);
         $files[$key]['nama'] = $tmp[$key][1];
         $files[$key]['path'] = $tmp[$key][2];
         $files[$key]['size'] = $tmp[$key][3];
     }
     $_POST['idUser'] = $this->user['idUser'];
     $_POST['isi'] = htmlentities(htmlspecialchars($_POST['isi'], ENT_QUOTES));
     $_POST['tanggal'] = date("Y-m-d");
     // db($_POST);
     $this->model->insert_balas($_POST);
     $idComment = $this->model->getLatestId('bsn_comment');
     if (!empty($files)) {
         $pathFile = $CONFIG['default']['upload_path'];
         foreach ($files as $key => $val) {
             //copy & remove file
             $moved = copy($pathFile . "tmp/" . $val['nama'], $pathFile . $val['nama']);
             deleteFile($val['nama'], 'tmp');
             $data['nama'] = $val['nama'];
             $data['path'] = $val['path'];
             $data['size'] = $val['size'];
             $data['type'] = 1;
             $data['idComment'] = $idComment['id'];
             $data['n_status'] = 1;
             $this->model->insert_file($data);
         }
     }
     //kirim email
     $dataPengaduan = $this->model->getPengaduanOnly($_POST['idPengaduan']);
     if (!empty($dataPengaduan['disposisi'])) {
         $destination = $dataPengaduan['disposisi'];
     } else {
         $destination = 3;
         $admin = 1;
     }
     $userToEmail = $this->model->getAllUserSatker($destination, $admin);
     foreach ($userToEmail as $key => $val) {
         $this->view->assign('name', $val['name']);
         $this->view->assign('judul', $dataPengaduan['judul']);
         $this->view->assign('tanggal', $dataPengaduan['tanggalformat']);
         $this->view->assign('idLaporan', $dataPengaduan['idLaporan']);
         $this->view->assign('id', $_POST['idPengaduan']);
         $html = $this->loadView('pengaduan/emailBalasan');
         $send = sendGlobalMail(trim($val['email']), $CONFIG['email']['EMAIL_FROM_DEFAULT'], $html);
     }
     echo "<script>alert('Data Berhasil Masuk');window.location.href='" . $basedomain . "pengaduan/detail/?id={$_POST['idPengaduan']}'</script>";
     exit;
 }
 /**
  * @todo insert person from posted data
  * */
 public function insertPerson()
 {
     $data = $_POST;
     ob_start();
     $insertData = $this->insertonebyone->insertTransaction('person', $data);
     //manual submission form
     /*if($insertData){
           if($insertData['status']){
               $this->msg->add('s', 'Update Person Success');
           }else{
               $this->msg->add('e', 'Update Person Failed');
           }
       }else{
           $this->msg->add('e', 'Update Person Failed');
       }
       header('Location: ../onebyone/detContent');*/
     //ajax form
     if ($insertData) {
         if (isset($insertData['msg'])) {
             $data['msg'] = $insertData['msg'];
         }
         if ($insertData['status']) {
             //sending email
             $email = $insertData['dataEmail'];
             $msg = null;
             $this->view->assign('username', $email['username']);
             $this->view->assign('email', $email['email']);
             $this->view->assign('encode', $email['encode']);
             $msg .= "<p>Hi " . $email['username'] . "!</p>";
             $msg .= $this->loadView('emailTemplate');
             // try to send mail
             $sendUserAccount = sendGlobalMail($email['to'], $email['from'], $msg, true);
             logFile('onebyone: generate account success ' . serialize($sendUserAccount));
             ob_end_clean();
             if ($sendUserAccount['result']) {
                 $this->activityHelper->updateEmailLog(false, $email['email'], 'account', 1);
                 logFile('onebyone: send account to email success');
                 $data['id'] = $insertData['lastid'];
                 $data['status'] = 'success';
                 echo json_encode($data);
                 //$this->insertonebyone->commitTransaction();
             } else {
                 $this->activityHelper->updateEmailLog(false, $email['email'], 'account', 0);
                 logFile('onebyone: send account to email failed');
                 $data['status'] = 'error';
                 $data['msg'] = 'Gagal mengirim akun data melalui email';
                 echo json_encode($data);
                 //$this->insertonebyone->rollbackTransaction();
             }
             //sending email
         } else {
             $data['status'] = 'error';
             echo json_encode($data);
         }
     } else {
         if (isset($insertData['msg'])) {
             $data['msg'] = $insertData['msg'];
         }
         $data['status'] = 'error';
         echo json_encode($data);
     }
     exit;
 }
 function passrecover()
 {
     global $basedomain;
     $str = randString(8);
     if ($_POST['token']) {
         $is_email_valid = false;
         $email_validate = $_POST['email'];
         if (filter_var($email_validate, FILTER_VALIDATE_EMAIL)) {
             $is_email_valid = true;
         }
         if (!$is_email_valid) {
             logFile('email not valid = ' . $email_validate);
             redirect($basedomain . 'register');
             exit;
         }
         $getdata = $this->userHelper->getUserData('email', $_POST['email']);
         if ($getdata) {
             $pass = sha1($getdata['salt'] . $str . $getdata['salt']);
             $updatedata = $this->userHelper->recovepass($getdata['idUser'], $pass);
             $this->view->assign('email', $getdata['email']);
             $this->view->assign('username', $getdata['username']);
             $this->view->assign('name', $getdata['name']);
             $this->view->assign('newpass', $str);
             $html = $this->loadView('akun/emailRecovery');
             // db($register);
             // logFile($msg);
             // $html = "klik link berikut ini {$basedomain}register/validate/?ref={$msg}";
             $send = sendGlobalMail($getdata['email'], false, $html);
             echo "<script>alert('Email recovery anda sudah di kirim. Silahkan cek email anda.')</script>";
             redirect($basedomain);
         } else {
             redirect($basedomain . 'register');
         }
         exit;
     }
 }