function getLocation($status, $data)
{
    $DB = new conn();
    $DB->connect();
    $location = "";
    if ($status == 1) {
        // Get Office Location
        $sql = "select storagelocation_name from storagelocations where storagelocation_id = " . $data;
        $location = $DB->query_scalar($sql) . "<br /><br />";
    }
    if ($status == 2) {
        // Get Employee Address
        $sql = "select Username from users where user_id = " . $data;
        $location = $DB->query_scalar($sql) . "<br /><br />";
    }
    if ($status == 3) {
        $location = "Transferred<br/>";
    }
    if ($status == 4 || $status == 5) {
        // Get customer address
        $sql = "select contacts.* from orders join contacts on orders.contact_id = contacts.contact_id where orders.order_id = " . $data;
        $result = $DB->query($sql);
        if ($result) {
            $row = mysql_fetch_assoc($result);
            $location = $row["contact_address"] . "<br />" . $row["contact_city"] . " " . $row["contact_state"] . ", " . $row["contact_zipcode"];
        }
    }
    return $location;
}
Exemple #2
0
 public function LoadData()
 {
     $DB = new conn();
     $DB->connect();
     $sql = "SELECT * FROM finance_options";
     $result = $DB->query($sql);
     while ($row = mysql_fetch_assoc($result)) {
         $financeDetails[] = $row;
     }
     $DB->close();
     return $financeDetails;
 }
Exemple #3
0
<?php

include "./findconfig.php";
include $_SERVER['DOCUMENT_ROOT'] . "/" . $ROOTPATH . "/Includes/Top.php";
$DB = new conn();
$DB->connect();
$sql = "Select * from StorageLocations";
$result = $DB->query($sql);
if ($result) {
    ?>
 <TABLE class="data">
		<th>id</th>
		<th>Location Name</th>
		<th>Commands</th>
		 <?php 
    while ($row = mysql_fetch_assoc($result)) {
        ?>
		<TR><TD><?php 
        echo $row["storagelocation_id"];
        ?>
</TD>
	    <TD><?php 
        echo $row["storagelocation_name"];
        ?>
 </TD>
		<TD><a href="#">Edit</a></TD>
		</TR>
		<?php 
    }
    ?>
 </TABLE> <?php 
Exemple #4
0
		</div>
	</div>
	<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
	<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
	<script type="text/javascript" src = './js/ptweixin.js'></script>	
	<script type="text/javascript">
	<?php 
require_once './config.php';
require_once './class/conn.class.php';
include './include/function.php';
$user_openid = $_GET['openid'];
$user_ptid = -1;
$con = new conn();
if (bind_check()) {
    $sql = "SELECT `username` FROM `users` WHERE `id` = {$user_ptid} ";
    $result = $con->query($sql);
    $username = $result[0]['username'];
    ?>

			$('#bind-success').html('成功绑定账号:'+<?php 
    echo "'{$username}'";
    ?>
);
			$('#bind-success').show();
			$('#bind-button').attr('disabled','disabled');
		<?php 
}
?>
	</script>
</body>
Exemple #5
0
<?php

/**
 * @author qbuer
 * 建立依赖表
 */
require_once './config.php';
require_once './class/conn.class.php';
$con = new conn();
$sql = "CREATE TABLE IF NOT EXISTS `weixin` (\n\t\t\t`ptid`   int(10) \tNOT NULL COMMENT '同users表的id' ,\n\t\t\t`openid` varchar(128) NOT NULL  COMMENT '微信用户id' ,\n\t\t\tPRIMARY KEY (`ptid`)\n\t\t) DEFAULT CHARSET=utf8 COMMENT='用户表';";
$con->query($sql);
$con->disconnect();
Exemple #6
0
<?php

include "./findconfig.php";
include $_SERVER['DOCUMENT_ROOT'] . "/" . $ROOTPATH . "/Includes/Top.php";
?>


<?php 
$DB = new conn();
$DB->connect();
$sql = "Select * from products where product_type = 'Product' and status != 'deleted'";
?>

<?php 
$result = $DB->query($sql);
if ($result) {
    ?>
 <TABLE class="data">
		<th>product_id</th>
		<th>Product Model</th>
		<th>Product Name</th>
		<th style="width:350px">Product Description</th>
		<th>Status</th>
		<th style="width:150px">Commands</th>
		 <?php 
    while ($row = mysql_fetch_assoc($result)) {
        // Subquery for Accessories
        $sql2 = "select a.product_name from relproducts_accessories r join products a on r.accessory_id = a.product_id where r.product_id = " . $row["product_id"];
        $acc = $DB->query($sql2);
        ?>
		<TR><TD><?php 
Exemple #7
0
require './class/conn.class.php';
require_once './config.php';
include './include/function.php';
require_once '../classes/class_cache.php';
$Cache = new CACHE();
$con = new conn();
if (isset($_GET['openid']) && $_GET['openid'] != '') {
    $user_openid = $con->mres($_GET['openid']);
} else {
    exit;
}
if (isset($_GET['torrent'])) {
    $torrent = $con->mres($_GET['torrent']) * 1;
} else {
    exit;
}
if (bind_check()) {
    $sql = "SELECT * FROM `bookmarks` WHERE `torrentid` = {$torrent} AND `userid` = {$user_ptid}";
    $res = $con->query($sql);
    if (empty($res)) {
        $sql = "INSERT INTO bookmarks (torrentid, userid) VALUES ( {$torrent} , {$user_ptid} )";
        if ($con->query($sql)) {
            echo json_encode(array('status' => 'success'));
            $Cache->delete_value('user_' . $user_ptid . '_bookmark_array');
        } else {
            echo json_encode(array('status' => 'fail', 'errmsg' => '远程下载失败'));
        }
    } else {
        echo json_encode(array('status' => 'fail', 'errmsg' => '已经下载过了!'));
    }
}
Exemple #8
0
<?php

require_once './config.php';
require_once './class/conn.class.php';
include './include/function.php';
$con = new conn();
if (!mkglobal('user:password:openid')) {
    exit(json_encode(array('status' => 'fail', 'errmsg' => '非法操作')));
}
$sql = "SELECT * FROM `weixin` WHERE `openid` = '{$openid}'";
$result = $con->query($sql);
if (!empty($result)) {
    exit(json_encode(array('status' => 'fail', 'errmsg' => '已绑定账户!')));
}
$sql = "SELECT * FROM `users` WHERE `username` = '{$user}' ";
$result = $con->query($sql);
if ($result != NULL) {
    $rs = $result[0];
    if ($rs['status'] == 'pending') {
        echo json_encode(array('status' => 'fail', 'errmsg' => '账户未激活'));
        exit;
    }
    if ($rs['passhash'] != md5($rs['secret'] . $password . $rs['secret'])) {
        var_dump($rs);
        echo md5($rs['secret'] . $password . $rs['secret']);
        echo json_encode(array('status' => 'fail', 'errmsg' => '密码错误!'));
        exit;
    }
    $sql = "INSERT INTO `weixin` (`ptid` , `openid` ) VALUES ('{$rs['id']}','{$openid}')";
    if ($con->query($sql)) {
        echo json_encode(array('status' => 'success', 'errmsg' => '成功!'));
        if ($action == "add") {
            // ALL FORM INPUTS MUST BE SANITIZED
            $ProductID = $DB->sanitize($_REQUEST["hProduct_ID"]);
            $AccessoryID = $DB->sanitize($_REQUEST["Accessory_ID"]);
            $sql = "DELETE from relproducts_accessories WHERE Product_ID = " . $ProductID . " AND Accessory_ID = " . $AccessoryID;
            $result = $DB->execute_nonquery($sql);
            if ($result > 0) {
                ?>
<font color="red">Accessory already associated with this product.</font><br /><br /> <?php 
            }
            $sql = "INSERT into relproducts_accessories (Product_ID, Accessory_ID) VALUES (" . $ProductID . ", " . $AccessoryID . ")";
            $DB->execute_nonquery($sql);
        }
    }
    $sql = "select * from relproducts_accessories r join products on r.accessory_id = products.product_id where r.product_id = " . $product_id;
    $result = $DB->query($sql);
    $sql = "select * from products where product_id = " . $product_id;
    $prodInfo = $DB->query($sql);
    $sql = "select * from products where product_type = 'Accessory' and status = 'Active'";
    $accessories = $DB->query($sql);
    if ($prodInfo) {
        while ($row = mysql_fetch_assoc($prodInfo)) {
            ?>
Product: <b><?php 
            echo $row["product_name"];
            ?>
</b><?php 
        }
    }
    if (!$result) {
        echo "<br /><br />No accessories for product yet.";