Esempio n. 1
0
 public function __construct()
 {
     $dbobj = new database();
     $this->db = $dbobj->get();
     $this->session = new session($this->db);
     $this->email = new email();
 }
Esempio n. 2
0
?>
">ผู้สั่งซื้อ</a>
                            </th>
                            <th id="user-grid_c4" style="text-align: right;">
                                <a class="sort-link" href="<?php 
echo $uri;
?>
">ราคา(บาท)</a>
                            </th>
                            <th class="button-column" id="user-grid_c6">&nbsp;</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
$i = 0;
while ($rs_or = $db->get($query_or_page)) {
    $tr = $i % 2 == 0 ? "odd" : "even";
    //สถานะ
    switch ($rs_or['order_status']) {
        case 'pending':
            $order_status = 'ยังไม่ชำระเงิน';
            $btnorder = 'แจ้งชำระเงิน';
            $btnstat = '';
            break;
        case 'payments':
            $order_status = 'กำลังจัดส่งสินค้า';
            $btnorder = 'ชำระเงินแล้ว';
            $btnstat = 'disabled';
            break;
        case 'shipping':
            $order_status = 'จัดส่งสินค้าแล้ว';
 /**
  * Table builder constructor.
  * Database class initialization, don't create too many instances of table builder,
  * because it will create many database instances which will decrease performance.
  * By default this class would create a `id` field INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, unless
  * you'll set second parameter FALSE.
  * 
  * @param PDO|null $db - PDO instance (it can be a \helper\database instance)
  * @param boolean  $id - A flag to add or not to add `id` field automatically
  */
 public function __construct(PDO $db = NULL, $id = TRUE)
 {
     // If database is not given, create new database instance.
     // database is in the same namespace, we don't need to specify namespace
     $this->_db = !$db ? database::get() : $db;
     if ($id === TRUE) {
         $this->addField('id', 'INT(11)', FALSE, self::AUTO_INCREMENT);
         $this->setPK('id');
     }
 }
Esempio n. 4
0
<?php

require base_path() . "/library/uploadimg.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $db = new database();
    $option_im = array("table" => "products", "fields" => "image", "condition" => "id='{$_POST['id']}'");
    $query_im = $db->select($option_im);
    $rs_im = $db->get($query_im);
    if (checkimg() == TRUE) {
        $filename = date('YmdHis') . rand(0, 9);
        $type = end(explode(".", $_FILES["image"]["name"]));
        $image = $filename . "." . $type;
        $path = base_path() . "/upload/product/";
        uploadimg($filename, 600, 600, $path);
        uploadimg("thumb_" . $filename, 400, 400, $path);
        uploadimg("md_" . $filename, 150, 150, $path);
        uploadimg("sm_" . $filename, 70, 70, $path);
        if ($rs_im['image'] != "ecimage.jpg") {
            @unlink($path . $rs_im['image']);
            @unlink($path . "thumb_" . $rs_im['image']);
            @unlink($path . "md_" . $rs_im['image']);
            @unlink($path . "sm_" . $rs_im['image']);
        }
    } else {
        $image = $rs_im['image'];
    }
    $value_pd = array("name" => trim($_POST['name']), "price" => trim($_POST['price']), "brandname" => trim($_POST['brandname']), "detail" => trim($_POST['detail']), "image" => $image, "product_categorie_id" => trim($_POST['product_categorie_id']));
    $query_pd = $db->update("products", $value_pd, "id='{$_POST['id']}'");
    if ($query_pd == TRUE) {
        header("location:" . $baseUrl . "/back/product");
    }
Esempio n. 5
0
<?php

/*
 * php code///////////**********************************************************
 */
if (isset($_SESSION[_ss . 'msg_result'])) {
    $msg_result = $_SESSION[_ss . 'msg_result'];
    unset($_SESSION[_ss . 'msg_result']);
} else {
    $msg_result = false;
}
$db = new database();
$option_user = array("table" => "users", "condition" => "id='1'");
$query_user = $db->select($option_user);
$rs_user = $db->get($query_user);
$title = 'เปลี่ยนรหัสผ่าน : ' . $rs_user['username'];
/*
 * php code///////////**********************************************************
 */
/*
 * header***********************************************************************
 */
require 'template/back/header.php';
/*
 * header***********************************************************************
 */
?>
<script type="text/javascript" src="<?php 
echo $baseUrl;
?>
/js/jquery.form-validator.min.js"></script>
Esempio n. 6
0
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $db = new database();
    $option_uw = array("table" => "users", "fields" => "password", "condition" => "id='{$_POST['id']}'");
    $query_uw = $db->select($option_uw);
    $rs_uw = $db->get($query_uw);
    if ($rs_uw['password'] == trim(salt_pass($_POST['oldpassword']))) {
        $value_pw = array("password" => trim(salt_pass($_POST['pass'])));
        $query_pw = $db->update("users", $value_pw, "id='{$_POST['id']}'");
        if ($query_pw == TRUE) {
            header("location:" . $baseUrl . "/back/user");
        }
    } else {
        $_SESSION[_ss . 'msg_result'] = TRUE;
        header("location:" . $baseUrl . "/back/user/changepassword");
    }
    mysql_close();
}
Esempio n. 7
0
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $db = new database();
    $password = salt_pass($_POST['password']);
    $option_pw = array("table" => "users", "fields" => "id,username,user_type", "condition" => "username='******'username']}' AND password='******'");
    $query_pw = $db->select($option_pw);
    $rows_pw = $db->rows($query_pw);
    if (1) {
        $rs_pw = $db->get($query_pw);
        $_SESSION[_ss . 'username'] = '******';
        $_SESSION[_ss . 'id'] = '1234';
        $_SESSION[_ss . 'levelaccess'] = 'admin';
        header('location:' . $baseUrl . '/back/home/index');
    } else {
        header('location:' . $baseUrl . '/back/user/login');
    }
    mysql_close();
}
Esempio n. 8
0
<?php

/*
 * php code///////////**********************************************************
 */
$db = new database();
$option_pc = array("table" => "product_categories", "condition" => "id='{$_GET['id']}' ");
$query_pc = $db->select($option_pc);
$rs_pc = $db->get($query_pc);
$title = 'แก้ไขหมวดหมู่สินค้า : ' . $rs_pc['name'];
/*
 * php code///////////**********************************************************
 */
/*
 * header***********************************************************************
 */
require 'template/back/header.php';
/*
 * header***********************************************************************
 */
?>
<script type="text/javascript" src="<?php 
echo $baseUrl;
?>
/js/jquery.form-validator.min.js"></script>
<div id="page-warpper">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">แก้ไขข้อมูล <?php 
echo $rs_pc['name'];
?>
Esempio n. 9
0
 /**
  * Helper function to update into database
  */
 protected static function get_database()
 {
     $class = get_called_class();
     return database::get($class::$database);
 }
Esempio n. 10
0
<?php

/*
 * php code///////////**********************************************************
 */
$db = new database();
$option_pc = array("table" => "product_categories");
$query_pc = $db->select($option_pc);
$option_pd = array("table" => "products", "condition" => "id='{$_GET['id']}' ");
$query_pd = $db->select($option_pd);
$rs_pd = $db->get($query_pd);
$title = 'แก้ไขสินค้า : ' . $rs_pd['name'];
/*
 * php code///////////**********************************************************
 */
/*
 * header***********************************************************************
 */
require 'template/back/header.php';
/*
 * header***********************************************************************
 */
?>
<script type="text/javascript" src="<?php 
echo $baseUrl;
?>
/js/jquery.form-validator.min.js"></script>
<script type="text/javascript" src="<?php 
echo $baseUrl;
?>
/ckeditor/ckeditor.js"></script>
Esempio n. 11
0
 private static function update($user_id, $key, $value)
 {
     $conn = database::get('dating');
     database::queryf($conn, 'UPDATE user_profiles SET value = %s, date_updated = UNIX_TIMESTAMP() WHERE user_id = %d AND attribute = %s', $value, $user_id, $key);
     return true;
 }
Esempio n. 12
0
        </div>
        <div class="col-lg-6">
            <table class="table" style="font-size: 12px;">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>ชื่อสินค้า</th>
                        <th style="text-align: right;">ราคา(บาท)</th>
                        <th style="text-align: right;">จำนวน</th>
                        <th style="text-align: right;">รวม</th>
                    </tr>
                </thead>
                <tbody>
                    <?php 
$grand_total = 0;
while ($rs_od = $db->get($query_od)) {
    $total_price = $rs_od['price'] * $rs_od['quantity'];
    $grand_total = $total_price + $grand_total;
    ?>
                        <tr>
                            <td>
                                <img src="<?php 
    echo base_url();
    ?>
/upload/product/sm_<?php 
    echo $rs_od['image'];
    ?>
">
                            </td>
                            <td><?php 
    echo $rs_od['name'];
Esempio n. 13
0
?>
">รหัส</a>
                            </th>
                            <th id="user-grid_c4">
                                <a class="sort-link" href="<?php 
echo $uri;
?>
">สร้าง</a>
                            </th>
                            <th class="button-column" id="user-grid_c6">&nbsp;</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
$i = 0;
while ($rs_pc = $db->get($query_pc_page)) {
    $tr = $i % 2 == 0 ? "odd" : "even";
    ?>
                            <tr class="<?php 
    echo $tr;
    ?>
">
                                <td>
                                    <a class="load_data" href="<?php 
    echo $baseUrl;
    ?>
/back/productcategorie/update/<?php 
    echo $rs_pc['id'];
    ?>
"><?php 
    echo $rs_pc['name'];
Esempio n. 14
0
?>
/back/user/index?User_sort=user_type">ประเภท</a>
                            </th>
                            <th id="user-grid_c5">
                                <a class="sort-link" href="<?php 
echo $baseUrl;
?>
/back/user/index?User_sort=created">สร้าง</a>
                            </th>
                            <th class="button-column" id="user-grid_c6">&nbsp;</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
$i = 0;
while ($rs_user = $db->get($query_user)) {
    $tr = $i % 2 == 0 ? "odd" : "even";
    ?>
                            <tr class="<?php 
    echo $tr;
    ?>
">
                                <td>
                                    <a class="load_data" href="<?php 
    echo $baseUrl;
    ?>
/back/user/<?php 
    echo $rs_user['id'];
    ?>
"><?php 
    echo $rs_user['username'];
Esempio n. 15
0
echo $uri;
?>
">หมวดหมู่</a>
                            </th><th id="user-grid_c4">
                                <a class="sort-link" href="<?php 
echo $uri;
?>
">สร้าง</a>
                            </th>
                            <th class="button-column" id="user-grid_c6">&nbsp;</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
$i = 0;
while ($rs_pd = $db->get($query_pd_page)) {
    $tr = $i % 2 == 0 ? "odd" : "even";
    ?>
                            <tr class="<?php 
    echo $tr;
    ?>
">
                                <td>
                                    <a class="load_data" href="<?php 
    echo $baseUrl;
    ?>
/back/product/update/<?php 
    echo $rs_pd['id'];
    ?>
"><?php 
    echo $rs_pd['pname'];
Esempio n. 16
0
<?php

/*
 * php code///////////**********************************************************
 */
if (isset($_SESSION[_ss . 'msg_result'])) {
    $msg_result = $_SESSION[_ss . 'msg_result'];
    unset($_SESSION[_ss . 'msg_result']);
} else {
    $msg_result = false;
}
$db = new database();
$option_py = array("table" => "contents", "condition" => "codename='howtopay' ");
$query_py = $db->select($option_py);
$rs_py = $db->get($query_py);
$title = 'วิธีการสั่งซื้อสินค้า';
/*
 * php code///////////**********************************************************
 */
/*
 * header***********************************************************************
 */
require 'template/back/header.php';
/*
 * header***********************************************************************
 */
?>
<script type="text/javascript" src="<?php 
echo $baseUrl;
?>
/ckeditor/ckeditor.js"></script>
Esempio n. 17
0
 static function cmd_rssex($name, $arg)
 {
     if (!$arg) {
         $arg = database::get($_GET['from'], 'rssex', 'kanal');
         if (!$arg) {
             GGapi::putText('Podaj pełny adres kanału (z http://) lub ustaw domyślny funkcją ');
             GGapi::putRichText('kanal2', TRUE);
             GGapi::putRichText('!' . "\n\n");
             GGapi::putRichText('Przykład:', FALSE, FALSE, TRUE);
             GGapi::putRichText("\n" . 'rss2 http://wiadomosci.onet.pl/2,kategoria.rss');
             return FALSE;
         }
     }
     $rss = self::testurl($arg);
     if (is_array($rss)) {
         GGapi::putText('Nie udało się pobrać wybranego kanału RSS. Błąd: ' . $rss[1]);
         return FALSE;
     } elseif (!is_object($rss)) {
         GGapi::putText('Wystąpił nieznany błąd przy pobieraniu danych. Przepraszamy.');
     }
     GGapi::putRichText(self::p($rss->channel->title), TRUE);
     if ($rss->channel->copyright) {
         GGapi::putRichText("\n" . self::p($rss->channel->copyright));
     }
     foreach ($rss->channel->item as $item) {
         GGapi::putRichText("\n\n" . self::p($item->title), TRUE);
         GGapi::putRichText("\n" . self::p($item->description, $arg == 'bash') . "\n" . self::p($item->link));
         if (GGapi::getLength() > 1700) {
             return;
         }
     }
 }