Exemplo n.º 1
0
 private function set_last_login()
 {
     $sql = 'UPDATE admin SET last_login = NOW() WHERE id = ' . $this->id;
     $res = parent::query($sql, $rows, $num_rows, $last_id);
     if ($res) {
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 public function get_district($id)
 {
     $sql = "select * from district where DISTRICT_ID = " . $id . ";";
     $result = parent::query($sql, $rows, $num_rows);
     if ($result) {
         return $rows;
     } else {
         echo $result;
     }
 }
Exemplo n.º 3
0
 public function get_report($stmt)
 {
     if ($stmt == 'work or study report') {
         $sql = 'select * from research where do_present = "working";';
         $res = parent::query($sql, $rows, $num_rows);
         if ($res) {
             print 'Rows: ' . $num_rows;
         } else {
             print $res;
         }
     } else {
     }
 }
Exemplo n.º 4
0
 public function set_medical()
 {
     if (parent::connection()) {
         /*
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Array
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     [hospital] => 6
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     [typeofmedical] => 9999
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     [organ] => ไส้ติ่งขาด
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     [date_start] => 2015-11-05
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     [date_end] => 2015-11-06
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     [cost] => 18900
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     [amountofmedicine] => 2
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     [medicine_1] => 1A 656/2531
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     [medicine_2] => A656T43
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     )
         */
         $sql = "INSERT INTO `medical`(`medical_id`, `organ`, `cost`, `date_start`, `date_end`, `rating`, `hospital_id`, `profile_id`, `medical_type_id`, `date_added`, `comment`)\n                VALUES (NULL,?,?,?,?,?,?,?,?,NOW(),?)";
         if ($stmt = $this->mysqli->prepare($sql)) {
             $stmt->bind_param('sisssisis', $this->medical_detail['organ'], $this->medical_detail['cost'], $this->medical_detail['date_start'], $this->medical_detail['date_end'], $this->medical_detail['rating'], $this->medical_detail['hospital'], $_SESSION['profile_detail']['profile_username'], $this->medical_detail['typeofmedical'], $this->medical_detail['comment']);
             $stmt->execute();
             if ($stmt->affected_rows) {
                 $insert_id = $stmt->insert_id;
                 $stmt->close();
                 if (!$this->set_medicine_order($insert_id)) {
                     return false;
                 }
                 if (!$this->set_rating()) {
                     return false;
                 }
                 parent::close_connection();
                 return true;
             } else {
                 print "Create medical error: " . $stmt->error;
             }
         } else {
             print "Prepare medical error: " . $this->mysqli->error;
         }
     }
 }
Exemplo n.º 5
0
<?php

session_start();
if (!isset($_SESSION["admin"]) || $_SESSION["admin"] != "logon") {
    session_unset();
    session_destroy();
    header("Location: index.php");
    exit;
} else {
    include '../php/config/autoload.inc.php';
}
use classes as cls;
use config\database as db;
$db = new db();
$pv = new cls\provinces();
?>
    <!DOCTYPE html>
    <html lang="en">

    <head>
        <meta charset="UTF-8">
        <title>Admin Management</title>
        <link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.min.css">
    </head>

    <body>
        <article class="container-fluid" style="">
            <?php 
include "header.php";
?>
                <section>
Exemplo n.º 6
0
 public function get()
 {
     $sql = 'select * from research where 1;';
     parent::query($sql, $rows, $num_rows, $last_id);
     print_r($rows);
 }
Exemplo n.º 7
0
<?php

@(require_once 'config/autoload.inc.php');
use config\database;
$conndb = new database();
// $_POST['find'] = '';
if ($_POST['find'] == 'province') {
    $conndb->query('select * from province where 1;', $rows, $num_rows, $last_id);
} elseif ($_POST['find'] == 'amphur') {
    $sql = 'select *  FROM `amphur` WHERE `PROVINCE_ID` = ' . $_POST['ref_id'];
    $conndb->query($sql, $rows, $num_rows, $last_id);
} else {
    // $sql = 'select *  FROM `district` WHERE `AMPHUR_ID` = ' . $_POST['ref_id'];
    $sql = 'select *  FROM `district` ';
    $conndb->query($sql, $rows, $num_rows, $last_id);
}
// $json = json_encode($rows, true);
// $handle = fopen('district.txt', 'w');
// fwrite($handle, print_r($json, 1));
// fclose($handle);
// echo $json;
Exemplo n.º 8
0
<?php

@(require_once 'config/autoload.inc.php');
use config\database as db;
$db = new db();
$sql = 'select * from year where 1;';
$res = $db->query($sql, $rows, $num_rows, $last_id);
if ($res) {
    $json = json_encode($rows);
    $handle = fopen('logs/gen.txt', 'w');
    fwrite($handle, print_r($json, 1));
    fclose($handle);
    // print json_encode($rows);
}
Exemplo n.º 9
0
 public function set()
 {
     /*
             Array
             (
             [username] => panchai
             [password] => 489329
             [title] => นาย
             [firstname] => พันชัย
             [lastname] => ประสมเพชร
             [birthday] => 1988-12-21
             [tel] => 0875435550
             [email] => thongtank@hotmail.com
             [address] => 213 หมู่ 12
             [province] => 23
             [amphur] => 325
             [district] => 2947
             [zipcode] => 34140
             [lat] =>
             [lng] =>
     
             )
     */
     $age = $this->get_age();
     $gender = "M";
     if ($this->pf['title'] == 'นางสาว' || $this->pf['title'] == 'นาง') {
         $gender = "F";
     }
     $sql = "INSERT INTO `profile`(`profile_username`, `profile_pwd`, `firstname`, `lastname`, `age`, `title`, `gender`, `birthday`, `tel`, `email`, `address`, `province`, `amphur`, `district`, `zipcode`, `lat`, `lng`, `date_added`)\n            VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW())";
     if (parent::connection()) {
         if ($stmt = $this->mysqli->prepare($sql)) {
             $stmt->bind_param('ssssissssssiiiiss', $this->pf['username'], $this->pf['password'], $this->pf['firstname'], $this->pf['lastname'], $age, $this->pf['title'], $gender, $this->pf['birthday'], $this->pf['tel'], $this->pf['email'], $this->pf['address'], $this->pf['province'], $this->pf['amphur'], $this->pf['district'], $this->pf['zipcode'], $this->pf['lat'], $this->pf['lng']);
             $stmt->execute();
             if ($stmt->affected_rows) {
                 $stmt->close();
                 parent::close_connection();
                 return true;
             } else {
                 echo $stmt->error;
                 return false;
             }
         } else {
             echo $this->mysqli->error;
         }
     }
 }