Пример #1
0
 public function delete_user($id)
 {
     $query = "SELECT * FROM users where id like '{$id}' and group_name not like ''";
     $test = $this->db->fetchRow($query);
     if ($test != 0) {
         $this->db->delete('users', 'id=' . $id);
     } else {
         thongbao("Admin toàn quyền mà xóa");
     }
 }
Пример #2
0
 public function delete_Page($id)
 {
     $query = "SELECT * FROM `page` where menu like '{$id}'";
     $count = $this->db->fetchRow($query);
     if ($count != 0) {
         thongbao('Dữ liệu còn');
         trang_truoc();
     } else {
         $this->db->delete('add_page', 'id=' . $id);
     }
 }
Пример #3
0
 public function errorAction()
 {
     thongbao("Page Error");
     //chuyen_trang("/");
     $errors = $this->_getParam('error_handler');
     $exception = $errors->exception;
     echo '<pre>';
     //print_r($exception);exit;
     echo $exception->getMessage();
     exit;
     ////
     ////        if (!$errors || !$errors instanceof ArrayObject) {
     ////            $this->view->message = 'You have reached the error page';
     ////            return;
     ////        }
     ////
     ////        switch ($errors->type) {
     ////            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
     ////            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
     ////            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
     ////                // 404 error -- controller or action not found
     ////                $this->getResponse()->setHttpResponseCode(404);
     ////                $priority = Zend_Log::NOTICE;
     ////                $this->view->message = 'Page not found';
     ////                break;
     ////            default:
     ////                // application error
     ////                $this->getResponse()->setHttpResponseCode(500);
     ////                $priority = Zend_Log::CRIT;
     ////                $this->view->message = 'Application error';
     ////                break;
     //        }
     //
     //        // Log exception, if logger available
     //        if ($log = $this->getLog()) {
     //            $log->log($this->view->message, $priority, $errors->exception);
     //            $log->log('Request Parameters', $priority, $errors->request->getParams());
     //        }
     //
     //        // conditionally display exceptions
     //        if ($this->getInvokeArg('displayExceptions') == true) {
     //            $this->view->exception = $errors->exception;
     //        }
     //
     //        $this->view->request   = $errors->request;
 }
<?php

chong_pha_hoai();
if ($_POST['ky_danh'] != "") {
    require_once '../htmlpurifier-4.4.0/library/HTMLPurifier.auto.php';
    $purifier = new HTMLPurifier();
    $kydanh = $purifier->purify($_POST['ky_danh']);
    $mk = md5(md5(trim($_POST['mat_khau'])));
    $tv = "select count(*) from thongtin_quantri where ky_danh='{$kydanh}' and mat_khau='{$mk}'";
    $tv_1 = mysql_query($tv);
    $tv_2 = mysql_fetch_row($tv_1);
    if ($tv_2[0] != 0) {
        $_SESSION[$ten_danh_dau . "ky_danh__quan_tri"] = $kydanh;
        $_SESSION[$ten_danh_dau . "mat_khau__quan_tri"] = $mk;
    } else {
        thongbao("Sai ký danh hoặc mật khẩu");
    }
} else {
    thongbao("Không được bỏ trống ký danh , mật khẩu");
}
 function updatedateAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $del = new Admin_Model_Products();
     $id = $this->_request->getParam('id');
     $del->update_date($id);
     thongbao('Tin của bạn đã được làm mới');
     trang_truoc();
 }
Пример #6
0
<?php

$result = mysql_query("SELECT * FROM menu WHERE thuoc_danhmuc = '{$_GET['id']}' ");
$count = mysql_num_rows(mysql_query("SELECT * FROM menu WHERE thuoc_danhmuc = '{$_GET['id']}'"));
$tv_1 = mysql_query($result);
$tv_2 = mysql_fetch_row($tv_1);
if ($count != 0) {
    thongbao("Chua xoa het danh muc con nen khong xoa duoc danh muc goc");
    echo "<form name='frm_dangnhap'>\n\t\t\t        <input type'hidden' name='chuyentrang' value='quan_tri.php?p=danhsach_danhmuc'>\n\t\t\t\t\t</form>";
} else {
    $chuoi = "DELETE FROM danhmuc WHERE id = '{$_GET['id']}' ";
    mysql_query($chuoi);
    echo "<form name='frm_dangnhap'>\n\t\t\t        <input type'hidden' name='chuyentrang' value='quan_tri.php?p=danhsach_danhmuc'>\n\t\t\t\t\t</form>";
}
?>
<script type="text/javascript">
if(document.frm_dangnhap)
 {
   var trangcanchuyen = document.frm_dangnhap.chuyentrang.value;
   window.location = trangcanchuyen;
 }
</script>
Пример #7
0
        $khach_mua = "";
        for ($i = 0; $i < count($_SESSION['soluong_giohang']); $i++) {
            $id = $_SESSION['id_giohang'][$i];
            $sl = $_SESSION['soluong_giohang'][$i];
            if ($sl != 0) {
                $khach_mua = $khach_mua . "{$id}" . "___" . "{$sl}" . "______";
            }
            $mua_tang = mua_tang($id, $sl);
            $mua = "UPDATE `sanpham` SET `loai_gia` = '{$mua_tang}' WHERE `sanpham`.`id` ={$id};";
            mysql_query($mua);
        }
        $kd = $_SESSION[$ten_danh_dau . 'ky_danh__abc'];
        $khach_mua = substr($khach_mua, 0, -6);
        $them = "\n\t\t\t\tINSERT INTO `hoadon`\n\t\t\t\t(\n\t\t\t\t\t`id` ,\n\t\t\t\t\t`khach_mua` ,\n\t\t\t\t\t`ho_ten` ,\n\t\t\t\t\t`dia_chi` ,\n\t\t\t\t\t`email` ,\n\t\t\t\t\t`dien_thoai` ,\n\t\t\t\t\t`noi_dung`,\n\t\t\t\t\t`ky_danh`\n\t\t\t\t)\n\t\t\t\tVALUES\n\t\t\t\t(\n\t\t\t\t\tNULL ,\n\t\t\t\t\t'{$khach_mua}',\n\t\t\t\t\t'{$ho_ten}',\n\t\t\t\t\t'{$dia_chi}',\n\t\t\t\t\t'{$email}',\n\t\t\t\t\t'{$dien_thoai}',\n\t\t\t\t\t'{$noi_dung}',\n\t\t\t\t\t'{$kd}'\n\t\t\t\t);\n\t\t\t";
        mysql_query($them);
        $tv = "select * from thong_tin_lh where id='2'";
        $tv_1 = mysql_query($tv);
        $tv_2 = mysql_fetch_array($tv_1);
        $email_lh = $tv_2['email'];
        $tinnhan = "\n\t\t\tTên  khách hàng : {$ho_ten} <br>\n\t\t\tEmail : {$email} <br>\n\t\t\tÐ?a ch? : {$dia_chi} <br>\n\t\t\tÐi?n tho?i : {$dien_thoai} <br>\n\t\t\t\n\t\t\tN?i dung : {$noi_dung} <br>";
        $to = $email_lh;
        $subject = "Mua hàng tr?c tuy?n";
        $message = $tinnhan;
        $headers = 'Content-type: text/html;charset=utf-8';
        mail($to, $subject, $message, $headers);
        unset($_SESSION['soluong_giohang']);
        unset($_SESSION['id_giohang']);
        thongbao("Thanks for shopping at our site! \\n Your bill was sent to us!");
        chuyen_trang("index.php");
    }
}
Пример #8
0
 function orderAction()
 {
     $yourCart = new Zend_Session_Namespace('cart');
     if ($this->_request->isPost()) {
         $itemProduct = $this->_arrParam['itemProduct'];
         if (count($itemProduct) > 0) {
             foreach ($itemProduct as $key => $val) {
                 if ($val == 0) {
                     unset($itemProduct[$key]);
                 }
             }
         }
         $yourCart->cart = $itemProduct;
     }
     //echo count ($yourCart->cart);
     $ssInfo = $yourCart->getIterator();
     //var_dump($ssInfo);
     $tblProduct = new Default_Model_Cart();
     $this->_arrParam['cart'] = $ssInfo['cart'];
     if (count($this->_arrParam['cart']) > 0) {
         $this->view->Items = $tblProduct->listcart($this->_arrParam);
         $this->view->cart = $ssInfo['cart'];
         $buy = "";
         foreach ($ssInfo['cart'] as $key => $val) {
             $item[] = $key;
             $demo[] = $val;
             //  echo $key;
             //  echo $val;
         }
         for ($i = 0; $i < count($ssInfo['cart']); $i++) {
             $id = $item[$i];
             $sl = $demo[$i];
             $buy = $buy . "{$id}" . "___" . "{$sl}" . "______";
         }
         $buy = substr($buy, 0, -6);
         // thanh toan
         $muser = new Default_Model_Cart();
         $captcha = new Zend_Captcha_Image();
         $vi = new Zend_View();
         $base = $vi->baseurl();
         if (!$this->_request->isPost()) {
             $captcha->setTimeout('300')->setWordLen('4')->setHeight('50')->setWidth('320')->setImgDir(APPLICATION_PATH . '/../public_html/captcha/images/')->setImgUrl($base . '/captcha/images/')->setFont(APPLICATION_PATH . '/../public_html/font/UTM-Avo.ttf');
             $captcha->generate();
             $this->view->captcha = $captcha->render($this->view);
             $this->view->captchaID = $captcha->getId();
             // Dua chuoi Captcha vao session
             $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captcha->getId());
             $captchaSession->word = $captcha->getWord();
         } else {
             $captchaID = $this->_request->captcha_id;
             $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaID);
             $captchaIterator = $captchaSession->getIterator();
             $captchaWord = $captchaIterator['word'];
             if ($this->_request->captcha == $captchaWord) {
                 $session = new Zend_Session_Namespace('identity');
                 $username = $session->username;
                 $this->view->purifier = Zend_Registry::get('purifier');
                 $conf = HTMLPurifier_Config::createDefault();
                 $purifier = new HTMLPurifier($conf);
                 $fullname = $purifier->purify($this->_request->getParam('fullname'));
                 $address = $purifier->purify($this->_request->getParam('address'));
                 $phone = $purifier->purify($this->_request->getParam('phone'));
                 $email = $purifier->purify($this->_request->getParam('email'));
                 $coment = $purifier->purify($this->_request->getParam('coment'));
                 $title = $purifier->purify($this->_request->getParam('title'));
                 $emaillh = "*****@*****.**";
                 $tinnhan = "\n\t\t\tHọ tên : {$fullname} <br>\n\t\t\tEmail : {$email}<br>\n\t\t\tĐịa chỉ : {$address}<br>\n\t\t\tĐiện thoại : {$phone}<br>\n\t\t\t\n\t\t\tNội dung : {$coment}<br>";
                 $to = $emaillh;
                 $subject = $title;
                 $message = $tinnhan;
                 $headers = 'Content-type: text/html;charset=utf-8';
                 mail($to, $subject, $message, $headers);
                 // Thiết lập SMTP Server
                 require 'ham/class.phpmailer.php';
                 require 'ham/class.pop3.php';
                 // nạp thư viện
                 $mailer = new PHPMailer();
                 // khởi tạo đối tượng
                 $mailer->IsSMTP();
                 // gọi class smtp để đăng nhập
                 $mailer->CharSet = "utf-8";
                 // bảng mã unicode
                 //Đăng nhập Gmail
                 $mailer->SMTPAuth = true;
                 // Đăng nhập
                 $mailer->SMTPSecure = "ssl";
                 // Giao thức SSL
                 $mailer->Host = "smtp.gmail.com";
                 // SMTP của GMAIL
                 $mailer->Port = 465;
                 // cổng SMTP
                 // Phải chỉnh sửa lại
                 $mailer->Username = "******";
                 // GMAIL username
                 $mailer->Password = "******";
                 // GMAIL password
                 $mailer->AddAddress("{$emaillh}", 'Recipient Name');
                 //email người nhận
                 // Chuẩn bị gửi thư nào
                 $mailer->FromName = "{$fullname}";
                 // tên người gửi
                 $mailer->From = "{$email}";
                 // mail người gửi
                 $mailer->Subject = "{$base}";
                 $mailer->IsHTML(true);
                 //Bật HTML không thích thì false
                 // Nội dung lá thư
                 $mailer->Body = "{$tinnhan}";
                 // Gửi email
                 if (!$mailer->Send()) {
                     // Gửi không được, đưa ra thông báo lỗi
                     echo "Không gửi được ";
                     echo "Lỗi: " . $mailer->ErrorInfo;
                 } else {
                     $muser->insert_order($address, $email, $phone, $coment, $username, $fullname, $buy);
                     Zend_Session::namespaceUnset('cart');
                     thongbao("Cảm ơn bạn đã liên hệ cho chúng tôi");
                     chuyen_trang($base);
                 }
             } else {
                 thongbao('Bạn nhập sai chuỗi Captcha');
                 trang_truoc();
             }
             $this->_helper->viewRenderer->setNoRender();
             $mask = APPLICATION_PATH . "/../public_html/captcha/images/*.png";
             array_map("unlink", glob($mask));
         }
     } else {
         //echo "Bạn chưa mua hàng";
     }
 }
Пример #9
0
 function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $info = $auth->getIdentity();
         $level = $info->group_name;
         // luu cookie
         $value = $info->username;
         setcookie("test", $value, time() + 3600);
         // doc cookie
         $test = $this->_request->getCookie('test');
         //        if($test == FALSE){
         //            $auth = Zend_Auth::getInstance();
         //	    $auth->clearIdentity();
         //            $vew=new Zend_View();
         //           $ct= $vew->baseurl('/login/index/login');
         //           chuyen_trang($ct);
         //            }
         $role = "";
         switch ($level) {
             case 1:
                 $role = "seller";
                 break;
             case 2:
                 $role = "user";
                 break;
             case 3:
                 $role = "amo";
                 break;
             default:
                 $role = "admin";
                 break;
         }
     } else {
         $role = '';
     }
     $acl = new Zend_Acl();
     // khai bao cac  nhom phan quyen
     $acl->addRole(new Zend_Acl_Role('amo'))->addRole(new Zend_Acl_Role('user'), 'amo')->addRole(new Zend_Acl_Role('seller'), 'user')->addRole(new Zend_Acl_Role('admin'));
     //Khai bao cac resource (News - blog -production
     $acl->add(new Zend_Acl_Resource('login:index'));
     $acl->add(new Zend_Acl_Resource('default', NULL));
     $acl->add(new Zend_Acl_Resource('default:index'), 'default');
     $acl->add(new Zend_Acl_Resource('default:register'), 'default');
     $acl->add(new Zend_Acl_Resource('default:error'), 'default');
     $acl->add(new Zend_Acl_Resource('default:page'), 'default');
     $acl->add(new Zend_Acl_Resource('default:product'), 'default');
     $acl->add(new Zend_Acl_Resource('error'));
     $acl->add(new Zend_Acl_Resource('error:error'), 'error');
     $acl->add(new Zend_Acl_Resource('admin'));
     $acl->add(new Zend_Acl_Resource('admin:index'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:link'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:page'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:product'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:side'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:support'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:user'), 'admin');
     //khai bao danh sach cac action ma nhom co quyen truy cap
     $acl->allow("amo", "login:index", null);
     $acl->allow("amo", "default", null);
     $acl->allow('amo', "admin:index", "index");
     $acl->deny('amo', "admin", NULL);
     $acl->allow("user", "admin", null);
     $acl->deny('user', "admin:user", null);
     $acl->deny('user', "admin:page", array('listpage', 'listpages'));
     //$acl->deny('user', "admin:user", null);
     $acl->deny('user', "admin:user", null);
     $acl->allow('admin', NULL, NULL);
     $module = $request->getModuleName();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     //$_pg=$acl->isAllowed($role,$module.':'.$controller,$action);
     if ($role != '') {
         if (!$acl->isAllowed($role, $module . ':' . $controller, $action)) {
             thongbao('Bạn ko có quyền truy cập vào modules này');
             $view = new Zend_View();
             $bse = $view->baseUrl();
             chuyen_trang($bse);
             //var_dump($ada);
         }
     }
 }
Пример #10
0
 public function delete_menu($id)
 {
     $query1 = "SELECT * FROM `menu` where parent_id like '{$id}'";
     $count1 = $this->db->fetchRow($query1);
     $query = "SELECT * FROM `products` where menu_id like '{$id}'";
     $count = $this->db->fetchRow($query);
     if ($count != 0 || $count1 != 0) {
         thongbao('Menu này vẫn còn tồn tại dữ liệu. Vui lòng xóa hết dữ liệu mới xóa được menu');
         trang_truoc();
     } else {
         $this->db->delete('menu', 'id=' . $id);
     }
 }
Пример #11
0
 case "form-product":
     include_once 'form-product.php';
     if (isset($_GET['stt'])) {
         thongbao($_GET['stt']);
     }
     break;
 case "list-product":
     include_once 'list-product.php';
     if (isset($_GET['stt'])) {
         thongbao($_GET['stt']);
     }
     break;
 case "config-menu-frontend":
     include_once 'config-menu-frontend.php';
     if (isset($_GET['stt'])) {
         thongbao($_GET['stt']);
     }
     break;
 case "profile":
     include_once 'profile.php';
     break;
 case "list-order":
     include_once 'list-order.php';
     break;
 case "form-slide":
     include_once 'form-slide.php';
     break;
 case "list-slide":
     include_once 'list-slide.php';
     break;
 case "list-lienhe":
Пример #12
0
 function contactAction()
 {
     $muser = new Default_Model_System();
     $conten = $muser->list_system();
     $this->view->book = $conten;
     $captcha = new Zend_Captcha_Image();
     $vi = new Zend_View();
     $base = $vi->baseUrl();
     if (!$this->_request->isPost()) {
         $captcha->setTimeout('300')->setWordLen('4')->setHeight('50')->setWidth('200')->setImgDir(APPLICATION_PATH . '/../captcha/images/')->setImgUrl($base . '/captcha/images/')->setFont(APPLICATION_PATH . '/../font/UTM-Avo.ttf');
         $captcha->generate();
         $this->view->captcha = $captcha->render($this->view);
         $this->view->captchaID = $captcha->getId();
         // Dua chuoi Captcha vao session
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captcha->getId());
         $captchaSession->word = $captcha->getWord();
     } else {
         $captchaID = $this->_request->captcha_id;
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaID);
         $captchaIterator = $captchaSession->getIterator();
         $captchaWord = $captchaIterator['word'];
         if ($this->_request->captcha == $captchaWord) {
             $this->view->purifier = Zend_Registry::get('purifier');
             $conf = HTMLPurifier_Config::createDefault();
             $purifier = new HTMLPurifier($conf);
             $fullname = $purifier->purify($this->_request->getParam('fullname'));
             $address = $purifier->purify($this->_request->getParam('address'));
             $phone = $purifier->purify($this->_request->getParam('phone'));
             $email = $purifier->purify($this->_request->getParam('email'));
             $content = $purifier->purify($this->_request->getParam('content'));
             $title = $purifier->purify($this->_request->getParam('title'));
             $emaillh = $conten[0]['email'];
             $tinnhan = "\n\t\t\tHọ tên : {$fullname} <br>\n\t\t\tEmail : {$email}<br>\n\t\t\tĐịa chỉ : {$address}<br>\n\t\t\tĐiện thoại : {$phone}<br>\n\t\t\t\n\t\t\tNội dung : {$content}<br>";
             require 'ham/class.phpmailer.php';
             require 'ham/class.pop3.php';
             // nạp thư viện
             $mail = new PHPMailer();
             // khởi tạo đối tượng
             $mail->IsSMTP();
             // gọi class smtp để đăng nhập
             $mail->CharSet = "utf-8";
             // bảng mã unicode
             //Đăng nhập Gmail
             $mail->SMTPAuth = true;
             // Đăng nhập
             $mail->SMTPSecure = "ssl";
             // Giao thức SSL
             $mail->Host = "smtp.gmail.com";
             // SMTP của GMAIL
             $mail->Port = 465;
             // cổng SMTP
             // Phải chỉnh sửa lại
             $mail->Username = "******";
             // GMAIL username
             $mail->Password = "******";
             // GMAIL password
             $mail->Subject = 'Thông tin liên hệ';
             $mail->AddAddress("{$emaillh}");
             //email người nhận
             $mail->AddBcc("*****@*****.**");
             // Chuẩn bị gửi thư nào
             $mail->FromName = mb_convert_encoding($fullname, "UTF-8", "auto");
             // tên người gửi
             $mail->From = "{$email}";
             // mail người gửi
             $mail->IsHTML(true);
             //Bật HTML không thích thì false
             // Nội dung lá thư
             $mail->Body = "{$tinnhan}";
             // Gửi email
             if ($mail->Send()) {
                 // Gửi không được, đưa ra thông báo lỗi
                 $muser->contact($fullname, $address, $phone, $email, $title, $content);
                 thongbao("Cảm ơn bạn đã liên hệ cho chúng tôi");
                 trangtruoc();
             } else {
                 echo "Không gửi được ";
                 echo "Lỗi: " . $mail->ErrorInfo;
             }
         } else {
             thongbao('Bạn nhập sai chuỗi Captcha');
             trang_truoc();
         }
         $this->_helper->viewRenderer->setNoRender();
         $mask = APPLICATION_PATH . "/../captcha/images/*.png";
         array_map("unlink", glob($mask));
     }
 }
Пример #13
0
        					$mailer->From = "$email"; // mail người gửi
        					$mailer->Subject = "$subject";
        					$mailer->IsHTML(false); //Bật HTML không thích thì false
        					 
        					// Nội dung lá thư
        					$mailer->Body = "$tinnhan";
        					 
        					// Gửi email
        					 
        					if(!$mailer->Send())
        					{
        					// Gửi không được, đưa ra thông báo lỗi
        					 
        					echo "Không gửi được ";
        					echo "Lỗi: " . $mailer->ErrorInfo;
        					}
        					else
        					{
        					 
        					// Gửi thành công
        					echo '<script>
        			alert("Cảm ơn bạn đã mua hàng của chúng tôi!");
        			</script>';
        					 
        					}*/
        unset($_SESSION['soluong_giohang']);
        unset($_SESSION['id_giohang']);
        thongbao("Cảm ơn đã mua hàng tại website của chúng tôi! \\n Hóa đơn của bạn đã gủi cho chúng tôi!");
        chuyen_trang("index.php");
    }
}
Пример #14
0
 function edituserAction()
 {
     $system = new Admin_Model_User();
     if ($this->_request->isPost()) {
         $pass1 = $this->_request->getParam('password');
         $pass2 = $this->_request->getParam('re_password');
         $user = $this->_request->getParam('username');
         if ($pass1 == $pass2 && $user != '') {
             $this->view->purifier = Zend_Registry::get('purifier');
             $conf = HTMLPurifier_Config::createDefault();
             $purifier = new HTMLPurifier($conf);
             $username = $purifier->purify($this->_request->getParam('username'));
             $pass = $purifier->purify($this->_request->getParam('password'));
             $email = $purifier->purify($this->_request->getParam('email'));
             $full_name = $purifier->purify($this->_request->getParam('full_name'));
             $status = $purifier->purify($this->_request->getParam('status'));
             $group_name = $purifier->purify($this->_request->getParam('group_name'));
             $id = $purifier->purify($this->_request->getParam('id'));
             if ($pass == '') {
                 $password = $purifier->purify($this->_request->getParam('pass_hidden'));
             } else {
                 $password = $purifier->purify(sha1(salt . $this->_request->getParam('password')));
             }
             //echo $password; die;
             $system->update_user($username, $password, $email, $full_name, $status, $group_name, $id);
         } else {
             thongbao("Bạn đã nhập liệu sai");
         }
     }
     $id = $this->_request->getParam('id');
     $edit = $system->list_user_1($id);
     $this->view->books = $edit;
 }
Пример #15
0
 function contactAction()
 {
     $muser = new Default_Model_System();
     $conten = $muser->list_system();
     $this->view->book = $conten;
     $captcha = new Zend_Captcha_Image();
     $vi = new Zend_View();
     $base = $vi->baseurl();
     if (!$this->_request->isPost()) {
         $captcha->setTimeout('300')->setWordLen('4')->setHeight('50')->setWidth('320')->setImgDir(APPLICATION_PATH . '/../captcha/images/')->setImgUrl($base . '/captcha/images/')->setFont(APPLICATION_PATH . '/../font/UTM-Avo.ttf');
         $captcha->generate();
         $this->view->captcha = $captcha->render($this->view);
         $this->view->captchaID = $captcha->getId();
         // Dua chuoi Captcha vao session
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captcha->getId());
         $captchaSession->word = $captcha->getWord();
     } else {
         $captchaID = $this->_request->captcha_id;
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaID);
         $captchaIterator = $captchaSession->getIterator();
         $captchaWord = $captchaIterator['word'];
         if ($this->_request->captcha == $captchaWord) {
             $this->view->purifier = Zend_Registry::get('purifier');
             $conf = HTMLPurifier_Config::createDefault();
             $purifier = new HTMLPurifier($conf);
             $fullname = $purifier->purify($this->_request->getParam('fullname'));
             $address = $purifier->purify($this->_request->getParam('address'));
             $phone = $purifier->purify($this->_request->getParam('phone'));
             $email = $purifier->purify($this->_request->getParam('email'));
             $content = $purifier->purify($this->_request->getParam('content'));
             $title = $purifier->purify($this->_request->getParam('title'));
             $emaillh = $purifier->purify($this->_request->getParam('emaillh'));
             $tinnhan = "\n\t\t\tHọ tên : {$fullname} <br>\n\t\t\tEmail : {$email}<br>\n\t\t\tĐịa chỉ : {$address}<br>\n\t\t\tĐiện thoại : {$phone}<br>\n\t\t\t\n\t\t\tNội dung : {$content}<br>";
             $to = $emaillh;
             $subject = $title;
             $message = $tinnhan;
             $headers = 'Content-type: text/html;charset=utf-8';
             // mail($to, $subject, $message, $headers);
             //$html ="<img title=\"夕食:ル・バンドーム(フランス料理)\" alt=\"夕食:ル・バンドーム(フランス料理)\" src=\"http://toursystem.biz/uploads/product/1378725993LE_VENDOME_12.jpg\">";
             //         $mail = new Zend_Mail('UTF-8');
             //          $mail->setBodyHtml("$tinnhan");
             //          $mail->setFrom("$email", "$title");
             //          $mail->addTo("*****@*****.**", 'Ly Le');
             //          $mail->addTo("$emaillh", "$fullname");
             //          $mail->setSubject("Thông tin liên hệ  ngày  : ".date("F j, Y"));
             //          $mail->send();
             // Thiết lập SMTP Server
             require 'ham/class.phpmailer.php';
             require 'ham/class.pop3.php';
             // nạp thư viện
             $mailer = new PHPMailer();
             // khởi tạo đối tượng
             $mailer->IsSMTP();
             // gọi class smtp để đăng nhập
             $mailer->CharSet = "utf-8";
             // bảng mã unicode
             //Đăng nhập Gmail
             $mailer->SMTPAuth = true;
             // Đăng nhập
             $mailer->SMTPSecure = "ssl";
             // Giao thức SSL
             $mailer->Host = "smtp.gmail.com";
             // SMTP của GMAIL
             $mailer->Port = 465;
             // cổng SMTP
             // Phải chỉnh sửa lại
             $mailer->Username = "******";
             // GMAIL username
             $mailer->Password = "******";
             // GMAIL password
             $mailer->AddAddress("{$emaillh}", 'Recipient Name');
             //email người nhận
             // Chuẩn bị gửi thư nào
             $mailer->FromName = "{$fullname}";
             // tên người gửi
             $mailer->From = "{$email}";
             // mail người gửi
             $mailer->Subject = "{$base}";
             $mailer->IsHTML(true);
             //Bật HTML không thích thì false
             // Nội dung lá thư
             $mailer->Body = "{$tinnhan}";
             // Gửi email
             if (!$mailer->Send()) {
                 // Gửi không được, đưa ra thông báo lỗi
                 echo "Không gửi được ";
                 echo "Lỗi: " . $mailer->ErrorInfo;
             } else {
                 $muser->contact($fullname, $address, $phone, $email, $title, $content);
                 thongbao("Cảm ơn bạn đã liên hệ cho chúng tôi");
                 trangtruoc();
             }
         } else {
             thongbao('Bạn nhập sai chuỗi Captcha');
             trang_truoc();
         }
         $this->_helper->viewRenderer->setNoRender();
         $mask = APPLICATION_PATH . "/../captcha/images/*.png";
         array_map("unlink", glob($mask));
     }
 }
Пример #16
0
<?php

include 'db.php';
if ($_POST['ten'] != "") {
    $chuoi = "INSERT INTO `menu` ( `id` , `ten` , `vitri_menu` , `lien_ket` , `thuoc_menu` )\n\t\t\tVALUES (\n\t\t\tNULL , '{$_POST['ten']}', 'doc', '', '{$_POST['cap_do']}'\n\t\t\t);";
    mysql_query($chuoi);
} else {
    thongbao("Không được bỏ trống tên menu");
}