Esempio n. 1
0
$vobj = new Validation();
session_start();
if (!isset($_SESSION['uid'])) {
    echo "You are not authoriezed to enter this page. You have to login first";
    exit;
}
$uid = $_SESSION['uid'];
// if(!$vobj->ifSuperUserId($uid)){
//   echo "You are not authoriezed to enter this page. Only for admins.";
//   exit;
// }
$procOrds = $dbobj->SelectColumn('oid', 'orders', 'processing', 1);
$flag = true;
do {
    foreach ($procOrds as $outoid) {
        $outOrds = $dbobj->Select("SELECT `oid` FROM `orders` WHERE `processing`=0 AND `oid`='{$outoid}'");
        if (isset($outOrds[0])) {
            $flag = false;
            $oid = $outOrds[0];
            break;
        }
        // sleep(1);
    }
    clearstatcache();
    sleep(1);
} while ($flag);
// // do{
//  // $updated_processing = $dbobj->SelectColumn('processing','orders','oid',$oid);
//    $aliveOrds = $dbobj->SelectColumn('oid','orders','alive',1);
//    // foreach ($aliveOrds as $aoid) {
//      // $outOrd = $dbobj->Select("SELECT `oid` from `orders` WHERE `alive`=0 AND `oid`='$aiod");
Esempio n. 2
0
<?php

require_once "../include/Validation.php";
// deconnection already included in Validation
$dbobj = new dbconnection();
$vobj = new Validation();
session_start();
//$uid = $_GET['uid'];
if (!isset($_SESSION['uid'])) {
    echo "You are not authoriezed to enter this page. You have to login first";
    exit;
}
$uid = $_SESSION['uid'];
// $_SESSION['uid'] = $uid;
$activeusersArr = $dbobj->Select('select * from user,room where user.rid=room.rid');
$users = array();
foreach ($activeusersArr as $row) {
    if (!$row['admin']) {
        array_push($users, $row['uname']);
    }
}
// $users = $dbobj->SelectColumn('uname','user',null,null);
$rooms = $dbobj->SelectColumn('rname', 'room', null, null);
$uname = $dbobj->SelectColumn('uname', 'user', 'uid', $uid);
$uname = $uname[0];
$imgname = $dbobj->SelectColumn('imgname', 'user', 'uid', $uid);
$imgname = $imgname[0];
$img = "../images/user/" . $imgname;
include "common/header.php";
?>
<html>
Esempio n. 3
0
<?php

require_once "../include/Validation.php";
// deconnection already included in Validation
$dbobj = new dbconnection();
$vobj = new Validation();
session_start();
//$uid = $_GET['uid'];
if (!isset($_SESSION['uid'])) {
    echo "You are not authoriezed to enter this page. You have to login first";
    exit;
}
$uid = $_SESSION['uid'];
// $_SESSION['uid'] = $uid;
$activeusersArr = $dbobj->Select('select * from user,room where user.rid=room.rid');
$users = array();
foreach ($activeusersArr as $row) {
    if (!$row['admin']) {
        array_push($users, $row['uname']);
    }
}
// $users = $dbobj->SelectColumn('uname','user',null,null);
$rooms = $dbobj->SelectColumn('rname', 'room', null, null);
$uname = $dbobj->SelectColumn('uname', 'user', 'uid', $uid);
$uname = $uname[0];
$imgname = $dbobj->SelectColumn('imgname', 'user', 'uid', $uid);
$imgname = $imgname[0];
$img = "../images/user/" . $imgname;
include "common/header.php";
?>
Esempio n. 4
0
// deconnection already included in Validation
$dbobj = new dbconnection();
$vobj = new Validation();
session_start();
if (!isset($_SESSION['uid'])) {
    echo "You are not authoriezed to enter this page. You have to login first";
    exit;
}
$uid = $_SESSION['uid'];
if (!$vobj->ifSuperUserId($uid)) {
    echo "You are not authoriezed to enter this page. Only for admins.";
    exit;
}
$_users_img = "../images/user/";
$_products_img = "../images/product/";
$activeusersArr = $dbobj->Select('select * from user,room where user.rid=room.rid');
$usersArr = array();
foreach ($activeusersArr as $row) {
    if (!$row['admin']) {
        array_push($usersArr, $row);
    }
}
$uname = $dbobj->SelectColumn('uname', 'user', 'uid', $uid);
$uname = $uname[0];
$imgname = $dbobj->SelectColumn('imgname', 'user', 'uid', $uid);
$imgname = $imgname[0];
$_controller = "../controller";
$_layout = "../layout";
$_add_user = "******";
$img = $_users_img . $imgname;
$processingOrders = $dbobj->Select('select uname,rname,odate,ext,otime,user.uid,orders.oid,user.imgname from user,room,orders where user.uid=orders.uid AND user.rid=room.rid AND orders.processing=true;');
Esempio n. 5
0
$vobj = new Validation();
session_start();
if (!isset($_SESSION['uid'])) {
    echo "You are not authoriezed to enter this page. You have to login first";
    exit;
}
$uid = $_SESSION['uid'];
if (!$vobj->ifSuperUserId($uid)) {
    echo "You are not authoriezed to enter this page. Only for admins.";
    exit;
}
$aliveOrds = $dbobj->SelectColumn('oid', 'orders', 'alive', 1);
$flag = true;
do {
    foreach ($aliveOrds as $aoid) {
        $deadOrds = $dbobj->Select("SELECT `oid` FROM `orders` WHERE `alive`=0 AND `oid`='{$aoid}'");
        if (isset($deadOrds[0])) {
            $flag = false;
            $oid = $deadOrds[0];
            break;
        }
        // sleep(1);
    }
    clearstatcache();
    sleep(1);
} while ($flag);
// // do{
// 	// $updated_processing = $dbobj->SelectColumn('processing','orders','oid',$oid);
//    $aliveOrds = $dbobj->SelectColumn('oid','orders','alive',1);
//    // foreach ($aliveOrds as $aoid) {
//      // $outOrd = $dbobj->Select("SELECT `oid` from `orders` WHERE `alive`=0 AND `oid`='$aiod");
Esempio n. 6
0
<?php

require_once "../include/Validation.php";
// deconnection already included in Validation
session_start();
$notes = $_POST['notes'];
$room = $_POST['rooms'];
$total = $_POST['total'];
$user = $_POST['user'];
//echo $_POST['mokka'];
$dbobj = new dbconnection();
if (!isset($_SESSION['uid'])) {
    echo "You are not authoriezed to enter this page. You have to login first";
    exit;
}
$arr = $dbobj->Select("select pname from product where available=1");
//print_r($arr);
$product = array();
for ($i = 0; $i < count($arr); $i++) {
    $x = $arr[$i]['pname'];
    if (isset($_POST[$x])) {
        $product[$x] = $_POST[$x];
    }
}
//print_r($product);
$res = $dbobj->Select("select uid from user where uname='" . $user . "'");
$dbobj->Insert("insert into orders (uid,odate,notes,processing,totalamount,otime) values('" . $res[0]['uid'] . "',CURDATE(),'" . $notes . "',1,'" . $total . "',CURTIME())");
foreach ($product as $key => $value) {
    $arr = $dbobj->Select("select pid,price from product where pname = '" . $key . "'");
    $arr2 = $dbobj->Select("select oid from orders order by oid desc limit 1");
    //print_r($arr[0]);
Esempio n. 7
0
<?php

$_admin_order = "../layout/ManualOrders.php";
$_user_order = "../layout/UserOrders.php";
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
require_once "../include/Validation.php";
// deconnection already included in Validation
$dbobj = new dbconnection();
$vobj = new Validation();
$crruname = trim($_POST['username']);
$crrpwd = md5(trim($_POST['pwd']));
if (!$vobj->ifUserExists($crruname)) {
    echo "User not found";
    exit;
}
$urecord = $dbobj->Select("select `uid`,`password`,`admin` from `user` where `uname`='{$crruname}'");
$urecord = $urecord[0];
if ($crrpwd != $urecord['password']) {
    echo "Passwords did not match";
    exit;
}
$_SESSION['uid'] = $urecord['uid'];
if ($urecord['admin']) {
    header("location:" . $_admin_order . "?uid=" . $urecord['uid']);
} else {
    header("location:" . $_user_order . "?uid=" . $urecord['uid']);
}
// print_r($urecord);
//
Esempio n. 8
0
        <div class="form-group">
        <div class="col-sm-offset-10 col-sm-2">
          <input type="submit" class="btn btn-sm btn-default" value="Confirm">
        </div>
      </div>
        <!--hakammel hena-->
      </form>
    </div>
    <div class="col-lg-7">
      <label>Latest Order</label>
      <br>
      <div class="col-lg-12">
        <table class="table table-striped">
        <?php 
$imgCounter = 0;
$result = $dbobj->Select("select pname,imgname from product,orders,order_detail where product.pid=order_detail.pid and orders.oid=order_detail.oid and orders.uid='" . $_SESSION['uid'] . "' order by odate desc limit 1");
for ($i = 0; $i < count($result); $i++) {
    if ($imgCounter == 0) {
        echo "<tr>";
    }
    if ($imgCounter != 2) {
        echo "<td><figure><img src='../images/product/" . $result[$i]['imgname'] . "' width='200px' height='200px'/><figcaption align='center'>" . $result[$i]['pname'] . "</figcaption></figure></td>";
        $imgCounter++;
    } elseif ($imgCounter == 2) {
        echo "<td><figure><img src='../images/product/" . $result[$i]['imgname'] . "' width='200px' height='200px'/><figcaption align='center'>" . $result[$i]['pname'] . "</figcaption></figure></td></tr>";
        $imgCounter = 0;
    }
}
?>
      </table>
      </div>
Esempio n. 9
0
$dbobj = new dbconnection();
//-----------------------p1_where for query----------------
$p1_where = " where orders.uid = user.uid and alive= 1 ";
if ($fdate != null) {
    $p1_where .= " and `odate` >= '{$fdate}' ";
}
if ($fdate != null) {
    $p1_where .= " and `odate` <= '{$tdate}' ";
}
if ($uid != null) {
    $p1_where .= " and `uname` = '{$uid}' ";
}
$p1_where .= " group by user.uid; ";
//-----------------
$query = "select user.uid uid,uname,sum(totalamount)total from orders,user" . $p1_where;
$orders = $dbobj->Select($query);
//-----------------------p2_where for query----------------
$p2_where = " where orders.uid = user.uid ";
if ($fdate != null) {
    $p2_where .= " and `odate` >= '{$fdate}' ";
}
if ($fdate != null) {
    $p2_where .= " and `odate` <= '{$tdate}' ";
}
if ($uid != null) {
    $p2_where .= " and `uname` = '{$uid}' ";
}
$p2_where .= "; ";
$details_query = " select user.uid,oid,odate,time_format(otime,'%h:%i %p') otime,totalamount from orders,user " . $p2_where;
$order_details = $dbobj->Select($details_query);
//-----------------------------------
Esempio n. 10
0
$dbobj = new dbconnection();
$vobj = new Validation();
session_start();
//$uid = $_GET['uid'];
if (!isset($_SESSION['uid'])) {
    echo "You are not authoriezed to enter this page. You have to login first";
    exit;
}
$uid = $_SESSION['uid'];
if (!$vobj->ifSuperUserId($uid)) {
    echo "You are not authoriezed to enter this page. Only for admins.";
    exit;
}
$pid = $_GET['pid'];
$categories = $dbobj->SelectColumn('cname', 'category', null, null);
$pro_rec = $dbobj->Select("select `pname`,`price`,`cid`,`imgname` from product where `pid`='{$pid}'");
$pro_rec = $pro_rec[0];
$pname = $pro_rec['pname'];
$price = $pro_rec['price'];
$cid = $pro_rec['cid'];
$imgname = $pro_rec['imgname'];
$cname = $dbobj->SelectColumn("cname", "category", "cid", $cid);
$cname = $cname[0];
$_edit_product = "../../controller/edit_product.php";
?>
<html>
<head>
	<title></title>
	
</head>
<body>
Esempio n. 11
0
// deconnection already included in Validation
$dbobj = new dbconnection();
$vobj = new Validation();
session_start();
//$uid = $_GET['uid'];
if (!isset($_SESSION['uid'])) {
    echo "You are not authoriezed to enter this page. You have to login first";
    exit;
}
$uid = $_SESSION['uid'];
if (!$vobj->ifSuperUserId($uid)) {
    echo "You are not authoriezed to enter this page. Only for admins.";
    exit;
}
$edtuid = $_GET['uid'];
$edt_rec = $dbobj->Select("select `uname`,`email`,`rid`,`ext`,`fname`,`lname` from user where `uid`='{$edtuid}'");
$edt_rec = $edt_rec[0];
$uname = $edt_rec['uname'];
$email = $edt_rec['email'];
$rid = $edt_rec['rid'];
$ext = $edt_rec['ext'];
$fname = $edt_rec['fname'];
$lname = $edt_rec['lname'];
$rname = $dbobj->SelectColumn('rname', 'room', 'rid', $rid);
$rname = $rname[0];
$_edit_user = "******";
?>
<html>
<head>
	<title></title>