예제 #1
0
파일: DBSQL.php 프로젝트: ranmadxs/dorcl
 public static function getInstance()
 {
     if (!self::$dbsql instanceof self) {
         self::$dbsql = new self();
     }
     return self::$dbsql;
 }
예제 #2
0
 public function saveLog($uid, $action)
 {
     global $router, $match;
     $format = "INSERT INTO `" . DB_PRE . "log` (`lid`, `uid`, `action`, `ip`, `ctime`)";
     $format .= " VALUES ('%s', '%d', '%d', '%s', '%d');";
     $sql = sprintf($format, $match['action'], $uid, $action, GetIP(), time());
     parent::Insert($sql);
 }
<?php
include_once './inc/init.php';
include_once './inc/db.inc.php';
require './inc/ajax_order_page.inc.php';



$p = new show_page;
$p->pvar="p";
$p->file='remark_list.php';
$p->prew_img=TRUE;
$p->next_img=TRUE;
$data=new DBSQL();

//如果是删除动作将删除
if ($_GET['sqlaction'])
{
	$dsql="delete from takeorder_tmp_menu_remark where k_id=$_GET[k_id]";
	$data->delete($dsql);
}


$k_id=$_GET['k_id'];
//all
if($_GET['type']=='all'){
//如果有值,将增加
if ($_GET['sort'] && $_GET['content'] && $_GET['k_id'])
{
	$sort=$_GET['sort'];
	$content=$_GET['content'];
	$remark_no=$sort.$content;
예제 #4
0
 public function __construct()
 {
     parent::__construct();
 }
예제 #5
0
<?php
include_once './inc/init.php';
include_once './inc/db.inc.php';
$db=new DBSQL();
  if ($_POST['sub']){
		$sql="select * from takeorder_a_user where login_name='$_POST[username]'";
		$account=$db->select($sql);
        if ($account[0]['login_pass']==$_POST['passwd']){
				$_SESSION['name']=$_POST['username'];
				if($_POST['type']=='simple'){
				alert_msg(FALSE,'simple.php');
				}else{
				 alert_msg(FALSE,'index.php');
				}
		}else {
			$smarty->assign('message','Account Error!');
			$smarty->display('login.htm');
		}

}else {
	$smarty->display("login.htm");
}

?>
예제 #6
0
 <?php 
include_once './inc/init.php';
include_once './inc/db.inc.php';
require './inc/ajax_page.inc.php';
$data = new DBSQL();
if ($_GET['action'] == 'table') {
    $tableno = $_GET['tableno'];
    $time = time();
    $operator = $_SESSION['name'];
    $ifsql = "select count(*) from takeorder_tmp_order_main where table_id='{$tableno}'";
    $list = $data->select($ifsql);
    $num = $list[0][0];
    $st = time();
    $orde_no = rand(10, 99) . $st . rand(10, 99);
    if ($flag == 0) {
        $sql = "insert into takeorder_tmp_order_main(table_id,order_time,order_no,operator) values('{$tableno}','{$time}','{$orde_no}','{$operator}')";
        $k_id = $data->insert($sql);
    } else {
        if ($num > 0) {
            exit;
        } else {
            $sql = "insert into takeorder_tmp_order_main(table_id,order_time,order_no,operator) values('{$tableno}','{$time}','{$orde_no}','{$operator}')";
            $k_id = $data->insert($sql);
        }
    }
    //echo "You had choose NO.".$tableno." customize,Chooes Customize Successfully!";
    echo "<input type='hidden' id='k_id' name='k_id' value='{$k_id}'>";
}
if ($_GET['action'] == 'people') {
    $order_id = $_GET['k_id'];
    $client_id = $_GET['id'];
예제 #7
0
 <?php 
include_once './inc/init.php';
include_once './inc/db.inc.php';
require './inc/ajax_page.inc.php';
$data = new DBSQL();
$oldid = $_GET['oldid'];
$ttsql = "select k_id from takeorder_order_main where order_no='{$oldid}'";
$tmdlist = $data->select($ttsql);
$pk_id = $tmdlist[0][k_id];
$musql = "select k_id from takeorder_order_detail where order_id='{$pk_id}'";
$sblist = $data->select($musql);
for ($i = 0; $i < count($sblist); $i++) {
    $sbid = $sblist[$i][k_id];
    $mbdsql = "delete from takeorder_menu_remark where order_id='{$sbid}'";
    $data->delete($mbdsql);
}
$data->delete("delete from takeorder_order_detail where order_id='{$pk_id}'");
$hhsql = "delete from takeorder_order_main where order_no='{$oldid}'";
$data->delete($hhsql);
$insertsql = "insert into takeorder_order_main(table_id,order_time,price,status,order_no,operator,pay_status) select table_id,order_time,price,status,order_no,operator,pay_status from tmp_order_main";
$insertid = $data->insert($insertsql);
$sub_insertsql = "select * from takeorder_tmp_order_detail";
$sublist = $data->select($sub_insertsql);
for ($i = 0; $i < count($sublist); $i++) {
    $order_id = $insertid;
    $client_id = $sublist[$i][client_id];
    $menu_id = $sublist[$i][menu_id];
    $qty = $sublist[$i][qty];
    $remark_id = $sublist[$i][remark_id];
    $subsql = "insert into takeorder_order_detail(order_id,client_id,menu_id,qty,remark_id) values('{$order_id}','{$client_id}','{$menu_id}','{$qty}','{$remark_id}')";
    $insetlc = $data->insert($subsql);
예제 #8
0
<?php

include_once './inc/init.php';
include_once './inc/db.inc.php';
require './inc/ajax_page.inc.php';
$cache_on = false;
$data = new DBSQL();
$table = $_GET['table'];
$whatid = $table;
$tablsql = "select * from takeorder_tmp_order_main where order_no='{$table}'";
$tablist = $data->select($tablsql);
$table_id = $tablist[0][table_id];
if (count($tablist) == 0) {
    $insertsql = "insert into takeorder_tmp_order_main(table_id,order_time,price,status,order_no,operator,pay_status) select table_id,order_time,price,status,order_no,operator,pay_status from takeorder_order_main where order_no='{$table}'";
    $selectk_id = "select k_id from takeorder_order_main where order_no='{$table}'";
    $idlist = $data->select($selectk_id);
    $oldid = $idlist[0][0];
    $insertid = $data->insert($insertsql);
    $sql = "select * from takeorder_order_detail where order_id='{$oldid}'";
    $sublist = $data->select($sql);
    for ($i = 0; $i < count($sublist); $i++) {
        $order_id = $insertid;
        $client_id = $sublist[$i][client_id];
        $menu_id = $sublist[$i][menu_id];
        $qty = $sublist[$i][qty];
        $remark_id = $sublist[$i][remark_id];
        $subsql = "insert into takeorder_tmp_order_detail(order_id,client_id,menu_id,qty,remark_id) values('{$order_id}','{$client_id}','{$menu_id}','{$qty}','{$remark_id}')";
        $insetlc = $data->insert($subsql);
        $fkid = $sublist[$i][k_id];
        $lcsql = "select * from takeorder_menu_remark where order_id='{$fkid}'";
        $lclist = $data->select($lcsql);
<?php

include_once './inc/init.php';
include_once './inc/db.inc.php';
require './inc/ajax_order_page.inc.php';
$p = new show_page();
$p->pvar = "p";
$data = new DBSQL();
$sql = "select * from takeorder_kind";
$list = $data->select($sql);
$num = count($list);
$p->set(4, $num, "", "newpalce", '');
$sql .= " limit " . $p->limit();
$list = $data->select($sql);
for ($i = 0; $i < count($list); $i++) {
    $id = $list[$i][id];
    $subsql = "select * from  takeorder_kind_sub where id='{$id}'";
    $sublist = $data->select($subsql);
    $list[$i][sub] = $sublist;
}
$pages = $p->output(1);
$smarty->assign("list", $list);
$smarty->assign('pages', $pages);
$smarty->display("getchoseitem.htm");
예제 #10
0
파일: PObject.php 프로젝트: vyouzhis/phpdbi
 function __construct($stdClass = null)
 {
     parent::__construct();
 }
예제 #11
0
파일: ACLInit.php 프로젝트: vyouzhis/phpdbi
 /**
  *
  * @name acl_Login	 
  * @param $name
  * @param $passwd
  * @package $sess_salt
  * @package user login action
  * @return  0 or -1 name error, -2 passwd error
  */
 function acl_Login($name, $passwd, $sess_salt)
 {
     $format = "select uid, cm, passwd,nickname  from " . DB_PRE_CORE . "user_info WHERE types=%d and  name='%s' limit 1 ";
     $sql = sprintf($format, DB_TYPE_DIFFERENCE, $name);
     $res = parent::FetchOne($sql);
     if (is_array($res)) {
         // use the salt in here
         //echo $passwd."--".md5($res['passwd'].$sess_salt);
         if ($passwd != md5($res['passwd'] . $sess_salt)) {
             return -2;
         }
         $cm = md5(time());
         $format = "UPDATE " . DB_PRE_CORE . "user_info SET `cm` = '%s', `ltime`=%d WHERE `types`=%d and `uid`='%d';";
         $sql = sprintf($format, $cm, time(), DB_TYPE_DIFFERENCE, $res['uid']);
         //die($sql);
         parent::Update($sql);
         $ses['cm'] = $cm;
         $ses["uid"] = $res['uid'];
         $ses['nickname'] = $res['nickname'];
         $ses['name'] = $name;
         $this->acl_setSessionInfo($ses);
         return 0;
     } else {
         return -1;
     }
 }
<?php
include_once './inc/init.php';
include_once './inc/db.inc.php';
$data=new DBSQL();
$peopleno=$_GET['peopleno'];
$Customizeno=$_GET['Customizeno'];
$temporder_id=$_GET['temporder_id'];
$sql="insert into takeorder_tmp_order_detail(order_id,client_id,menu_id) values('$temporder_id','$peopleno','$Customizeno')";
$data->insert($sql);

?>
예제 #13
0
<?php

session_start();
//include_once './inc/page.inc.php';
include_once './inc/init.php';
include_once './inc/db.inc.php';
$sql = "select * from main";
$result = s_fetch($sql);
$data = new DBSQL();
$sqlitem = "select distinct(sortname) from takeorder_item";
$listitem = $data->select($sqlitem);
//print_rr($listitem);
$sql = "select * from takeorder_item";
//̨ºÅ
$arrCustomer = array();
if (isset($_GET['cusomizepage'])) {
    $cusomizepage = $_GET['cusomizepage'];
} else {
    $cusomizepage = 1;
}
for ($i = 1; $i <= 6 * $cusomizepage; $i++) {
    $arrCusomize[] = array("id" => $i, "name" => $i);
}
$rowitem = $data->select($sql);
$smarty->assign('rowitem', $rowitem);
$smarty->assign('arrCusomize', $arrCusomize);
$smarty->assign('rows', $result);
$smarty->display("main1.htm");
예제 #14
0
<?php

include_once './inc/init.php';
include_once './inc/db.inc.php';
require './inc/ajax_page.inc.php';
$data = new DBSQL();
$arr = array();
//分页数组构造初始化
$arr['search'] = '1';
//搜索的必要条件
$reholdsql = "select * from takeorder_tmp_order_detail inner join menu_list on menu_list.k_id=tmp_order_detail.menu_id";
$list = $data->select($reholdsql);
$num = count($list);
$p = new show_page();
$p->file = "lcshow.php";
$p->pvar = "p";
$p->setvar($arr);
$p->set(5, $num, "", 'show', '');
$reholdsql .= " limit " . $p->limit();
$list = $data->select($reholdsql);
for ($i = 0; $i < count($list); $i++) {
    $m_id = $list[$i][0];
    $remarksql = "select count(*) from takeorder_tmp_menu_remark where order_id='{$m_id}'";
    $remarklist = $data->select($remarksql);
    if ($remarklist[0][0] > 0) {
        $list[$i]['rm'] = '*';
    } else {
        $list[$i]['rm'] = '';
    }
}
$smarty->assign("list", $list);
예제 #15
0
<?php
include_once './inc/init.php';
include_once './inc/db.inc.php';
require './inc/ajax_inpage.inc.php';
$data=new DBSQL();
$arr=array();			//分页数组构造初始化
$arr['search']='1';	//搜索的必要条件
$showsql="select * from takeorder_tmp_order_detail inner join takeorder_menu_list on menu_list.k_id=tmp_order_detail.menu_id where 1=1 ";
	if($_GET['k_id']){
		$showsql.="and order_id='$_GET[k_id]' ";    //搜索类别
		$arr['k_id']=urlencode($_GET['k_id']);
	}
	if($_GET['id']){
		$showsql.="and client_id='$_GET[id]' ";    //搜索类别
		$arr['id']=urlencode($_GET['id']);
	}

$list=$data->select($showsql);
$num=count($list);
$p = new show_page;
$p->pvar="p";
$p->setvar($arr);
$p->set(5,$num,"",'main_div','');
$list2=array();
$showsql.=" limit ".$p->limit();
$list=$data->select($showsql);
if(count($list)<5){
$num=5-count($list);
for($k=0;$k<$num;$k++){
$list2[]=$k;
$smarty->assign("list2",$list2);
예제 #16
0
 /**
  * @name getList
  * @param $cate 栏目名称
  * @package 获取单个栏目内容
  * @return array or false
  */
 private function getList($c_id, $page, $keywords = "", $limit = 10)
 {
     $select = "article_id,c_id,title,title_pic,keywords,abstract,add_time,out_time,source,author,link,color";
     $order = "add_time desc,sortrank desc";
     $start = ($page - 1) * 10;
     $limits = $start . "," . $limit;
     $where = "WHERE c_id in(" . $c_id . ") AND is_display=1 ";
     if ($c_id == 0) {
         $where = "WHERE 1=1 ";
     }
     if (!empty($keywords)) {
         $where .= " and (";
         $KArray = explode(" ", $keywords);
         foreach ($KArray as $key => $v) {
             $where .= " title like '%" . $v . "%' or ";
             $where .= " keywords like '%" . $v . "%'";
         }
         $where .= " )";
     }
     $format = "SELECT %s FROM " . DB_PRE . "article  %s order by %s limit %s";
     $sql = sprintf($format, $select, $where, $order, $limits);
     //echo $sql."<br />";
     $result = parent::FetchArray($sql);
     return $result;
 }
예제 #17
0
<?php

include_once './inc/init.php';
include_once './inc/db.inc.php';
require './inc/ajax_page.inc.php';
$data = new DBSQL();
$arr = array();
//分页数组构造初始化
$arr['search'] = '1';
//搜索的必要条件
$showsql = "select * from coment where 1=1 ";
if ($_GET['id']) {
    $showsql .= "and id='{$_GET['id']}' ";
    //搜索类别
    $arr['id'] = urlencode($_GET['id']);
}
$list = $data->select($showsql);
$num = count($list);
$p = new show_page();
$p->pvar = "p";
$p->file = "list.php";
$p->setvar($arr);
$p->set(5, $num, "", 'main_div', '');
$showsql .= " ORDER BY id desc ";
$showsql .= " limit " . $p->limit();
$list = $data->select($showsql);
$smarty->assign("list", $list);
$pages = $p->output(1);
$smarty->assign('pages', $pages);
$smarty->display("sublist.htm");
예제 #18
0
 <?php 
include_once './inc/init.php';
include_once './inc/db.inc.php';
require './inc/ajax_page.inc.php';
$data = new DBSQL();
if ($_GET['action'] == 'add') {
    $title = $_GET['title'];
    $context = $_GET['context'];
    $context = preg_replace("/\\[Y\\](.+?)\\[\\/\\Y\\]/", "<img src=images/\\1.gif>", $context);
    $context = ereg_replace("'", "\\'", $context);
    $time = date("Y-m-d");
    $sql = "insert into coment(title,context,time) values('{$title}','{$context}','{$time}')";
    $data->insert($sql);
}
if ($_GET['action'] == 'rq') {
    $title = $_GET['title'];
    $context = $_GET['context'];
    $time = date("Y-m-d");
    $id = $_GET['id'];
    $qsql = "select context from coment where id={$id}";
    $nw = $data->select($qsql);
    $oldcon = $nw[0][0];
    $context = "<div class=newarticle>" . $oldcon . "</div>" . $context;
    $context = preg_replace("/\\[Y\\](.+?)\\[\\/\\Y\\]/", "<img src=images/\\1.gif>", $context);
    $context = ereg_replace("'", "\\'", $context);
    $sql = "insert into coment(title,context,time) values('{$title}','{$context}','{$time}')";
    $data->insert($sql);
}
if ($_GET['action'] == 'show') {
    $id = $_GET['id'];
    $smarty->assign('id', $id);