public function getProducts()
 {
     $db_handle = new DBController();
     $conn = $db_handle->connectDB();
     $results = $db_handle->runQuery($conn, "SELECT * FROM tblproduct ORDER BY id ASC");
     return $results;
 }
Пример #2
1
 public function create($_post)
 {
     $prepare = $this->prepare($_post);
     $prepare['idskills'] = parent::search($_post, 'a_skill_list');
     // echo "<pre>";
     // print_r($prepare);
     $this->id = parent::create($prepare, $this->table);
 }
Пример #3
1
 public function __construct()
 {
     parent::__construct();
     if (!$_SESSION["currentuser"]) {
         echo "<script>window.location.replace('index.php');</script>";
     }
     //Inicializa las variables
     $this->user = new User();
     $this->voto = new Voto();
 }
Пример #4
1
 public function update($_post)
 {
     $filter = "`userid` = " . $this->getUser()->id;
     $data = $this->prepare($_post);
     $success = parent::update($data, $filter, $this->table);
     if ($success) {
         return $_post;
     } else {
         throw new Exception("Update failed.", 1);
     }
 }
Пример #5
1
<?php

session_start();
if (isset($_SESSION["username"])) {
    header("location:home.php");
    exit;
}
require_once "dbcontroller.php";
$db_handle = new DBController();
$conn = $db_handle->connectDB();
$error = "";
if (isset($_POST['username']) && isset($_POST['password'])) {
    $username = mysqli_real_escape_string($conn, $_POST['username']);
    $password = mysqli_real_escape_string($conn, $_POST['password']);
    $query = $db_handle->runQuery("SELECT id,username,password FROM doctor where username='******' and password='******'");
    if (!empty($query)) {
        $_SESSION["id"] = $query[0]['id'];
        $_SESSION["username"] = $query[0]['username'];
        header("location:home.php");
        exit;
    } else {
        $error = "Invalud username or password";
    }
}
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>login</title>
    <style media="screen">
Пример #6
1
<?php

require_once "dbcontroller.php";
$db_handle = new DBController();
if (!empty($_POST["submit"])) {
    $result = mysql_query("UPDATE contacts set name = '" . $_POST["name"] . "', phone1 = '" . $_POST["phone1"] . "', phone2 = '" . $_POST["phone2"] . "', email = '" . $_POST["email"] . "', notes = '" . $_POST["notes"] . "' WHERE  id=" . $_GET["id"]);
    if (!$result) {
        $message = "Problem in Editing! Please Retry!";
    } else {
        echo "<script>alert('Contact Saved!');</script>";
        echo "<script>window.location='index.php'</script>";
    }
}
$result = $db_handle->runQuery("SELECT * FROM contacts WHERE id='" . $_GET["id"] . "'");
?>
<html>
<body>
<p><a href="index.php">Back</a></p>
</body>
</html>
	
<script>
function validate() {
	var valid = true;	
	$(".demoInputBox").css('background-color','');
	$(".info").html('');
	
	if(!$("#name").val()) {
		$("#name-info").html("(required)");
		$("#name").css('background-color','#FFFFDF');
		valid = false;
Пример #7
1
 function getRoutesFromDB()
 {
     $relations = array();
     $relations = $this->getRelations();
     $json_relations = JSONRouteRelation::getJSONRelations();
     if (count($json_relations) > 0) {
         foreach ($json_relations as $route => $relation) {
             if (isset($relations[$route])) {
                 $relations[$route] = array_merge($relations[$route], $relation);
             } else {
                 $relations[$route] = $relation;
             }
         }
     }
     $result = DBController::Query("SHOW TABLES");
     if ($result === false) {
         exit(ApiResponse::errorResponse(404));
     } else {
         if (empty($result) === true) {
             exit(ApiResponse::errorResponse(204));
         } else {
             foreach ($result as $k => $v) {
                 $route = reset($v);
                 $route = new Route();
                 $route->routeName = reset($v);
                 if (isset($relations[$route->routeName])) {
                     $route->routeFields = $this->getRouteFields($route, $relations[$route->routeName]);
                 } else {
                     $route->routeFields = $this->getRouteFields($route);
                 }
                 ResterUtils::Log("*** PRIMARY KEY: " . $route->routeName . " => " . $route->primaryKey->fieldName);
                 $routes[$route->routeName] = $route;
             }
         }
     }
     ApiCacheManager::saveValueToCache(ROUTE_CACHE_KEY, $routes);
     return $routes;
 }
Пример #8
1
<?php

require_once "dbcontroller.php";
$db_handle = new DBController();
if (!empty($_POST["keyword"])) {
    $query = "SELECT * FROM lokasi WHERE alamat like '" . $_POST["keyword"] . "%' ORDER BY alamat";
    $result = $db_handle->runQuery($query);
    if (!empty($result)) {
        ?>
		<ul id="country-list"> 
		<?php 
        foreach ($result as $lokasi) {
            ?>
			<li onClick="selectAlamat('<?php 
            echo $lokasi["alamat"];
            ?>
');"><?php 
            echo $lokasi["alamat"];
            ?>
</li> <?php 
        }
        ?>
 
		</ul> <?php 
    } else {
        ?>
	<ul id="country-list"> 
		<li onClick="selectAlamat('<?php 
        echo $lokasi["alamat"];
        ?>
');">rusak</li> <?php 
Пример #9
0
 public function update($_post)
 {
     $this->prepare($_post);
     $filter = "`id` = " . $_post['id'] . " and`userid` = " . self::jsid();
     // echo $filter;exit;
     $this->id = parent::update($_post, $filter, 'a_language');
 }
Пример #10
0
 public function Drop()
 {
     $builder = DBController::GetBuilder();
     $stat = new $builder($builder::T_DROP_TABLE);
     $stat->SetTableName($this->table_name);
     $result = DBController::DropTable($stat->GetParams());
     return $result;
 }
Пример #11
0
 public function __construct()
 {
     parent::__construct();
     //Inicializa la variable
     $this->user = new User();
     //Inicializa la variable
     $this->concurso = new Concurso();
 }
Пример #12
0
 public function __construct()
 {
     parent::__construct();
     /*if(!$_SESSION["currentuser"]){
     			echo "<script>window.location.replace('index.php');</script>";
     		}*/
     $this->pincho = new Pincho();
     $this->codvoto = new CodVoto();
     $this->concurso = new Concurso();
 }
Пример #13
0
 public function unlink($_post)
 {
     // $this->prepare($_post);
     for ($i = 0; $i < count($_post); $i++) {
         $filter = "`id` = '" . $_post . "'";
         // return $filter;
         $this->id = parent::unlink($filter, $this->table);
         // return $this->id;
     }
     // return $filter;
     // $this->id = parent::unlink($filter, $this->table);
 }
Пример #14
0
 public static function parseLogin()
 {
     $email = $_POST['email'];
     $senha = $_POST['senha'];
     $temp = DBController::init();
     $usuarios = $temp->db_user;
     $all = iterator_to_array($usuarios->find(["email" => $email, "senha" => $senha]));
     if ($all != array()) {
         foreach ($all as $key => $value) {
             $obj = array('token' => $key, 'nome' => $value['nome'], 'email' => $value['email'], 'senha' => $value['senha'], 'status' => true, 'message' => "Login feito com sucesso");
         }
         SessionController::set("user", $obj);
     } else {
         $obj = array('email' => $email, 'senha' => $senha, 'status' => false, 'message' => "Email ou senha incorretos", 'status' => false);
     }
     RotaController::res($obj);
 }
Пример #15
0
<?php

include 'css.php';
session_start();
require_once "dbcontroller.php";
$db_handle = new DBController();
if (!empty($_GET["action"])) {
    switch ($_GET["action"]) {
        case "add":
            if (!empty($_POST["quantity"])) {
                $productByCode = $db_handle->runQuery("SELECT * FROM tblproduct WHERE code='" . $_GET["code"] . "'");
                $itemArray = array($productByCode[0]["code"] => array('name' => $productByCode[0]["name"], 'code' => $productByCode[0]["code"], 'quantity' => $_POST["quantity"], 'price' => $productByCode[0]["price"]));
                if (!empty($_SESSION["cart_item"])) {
                    if (in_array($productByCode[0]["code"], $_SESSION["cart_item"])) {
                        foreach ($_SESSION["cart_item"] as $k => $v) {
                            if ($productByCode[0]["code"] == $k) {
                                $_SESSION["cart_item"][$k]["quantity"] = $_POST["quantity"];
                            }
                        }
                    } else {
                        $_SESSION["cart_item"] = array_merge($_SESSION["cart_item"], $itemArray);
                    }
                } else {
                    $_SESSION["cart_item"] = $itemArray;
                }
            }
            break;
        case "remove":
            if (!empty($_SESSION["cart_item"])) {
                foreach ($_SESSION["cart_item"] as $k => $v) {
                    if ($_GET["code"] == $k) {
    ?>
<!-- 您已登入    -->
<!-- header('refresh:3;url=HasCookie.php'); -->
<h3>You have logged , Welcome to M&amp;M | Shopping Space</h3>
<h4><i><u><?php 
    echo 'Hello ' . htmlspecialchars($_COOKIE["login"]) . '!';
}
?>
</i></u></h4>
<!-- Get Cookie_End -->



<?php 
require_once "dbcontroller.php";
$db_handle = new DBController();
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1">

	<title>Logged</title>


	<!-- Loading third party fonts -->
	<link href="http://fonts.googleapis.com/css?family=Roboto:100,300,400,700|" rel="stylesheet" type="text/css">
	<link href="fonts/font-awesome.min.css" rel="stylesheet" type="text/css">
	<link href="fonts/lineo-icon/style.css" rel="stylesheet" type="text/css">
<?php

require_once "dbcontroller.php";
$db_handle = new DBController();
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Music</title>

    <!-- Bootstrap Core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="css/clean-blog.min.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href='http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>

    
Пример #18
0
</style>

<!-- js -->
<script type="text/javascript" src="../media_datatables/complete.js"></script>
<script type="text/javascript" src="../media_datatables/jquery.min.js"></script>
<script type="text/javascript" src="../media_datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="../media_datatables/jquery.dataTables.editable.js"></script>
<script type="text/javascript" src="../media_datatables/jquery.jeditable.js"></script>
<script type="text/javascript" src="../media_datatables/jquery-ui.js"></script>
<script type="text/javascript" src="../media_datatables/jquery.validate.js"></script>

<!-- php general var -->
<?php 
// to do merge with __css_js_crud.php
$db_handle = new DBController();
$types = $db_handle->runQuery($GET_ALL_TB_TYPES);
$n_types = count($types);
$products = $db_handle->runQuery($GET_ALL_TB_PRODUCTS);
// to do merge with __css_js_crud.php
if (explode("_", $this_filename)[1] == "products") {
    $GET_ALL_TB_ELEMENTS = $GET_ALL_TB_PRODUCTS;
    $sql_table = $TB_PRODUCTS;
}
if (explode("_", $this_filename)[1] == "types") {
    $GET_ALL_TB_ELEMENTS = $GET_ALL_TB_TYPES;
    $sql_table = $TB_TYPES;
}
$elements = $db_handle->runQuery($GET_ALL_TB_ELEMENTS);
//////////////////////////////////////////////// GET or create colum name ///////////////////////////////////////////
$arrayNameCols = array();
// Inspect IPN validation result and act accordingly
// Split response headers and payload, a better way for strcmp
$tokens = explode("\r\n\r\n", trim($res));
$res = trim(end($tokens));
if (strcmp($res, "VERIFIED") == 0) {
    // assign posted variables to local variables
    $item_name = $_POST['item_name'];
    $item_number = $_POST['item_number'];
    $payment_status = $_POST['payment_status'];
    $payment_amount = $_POST['mc_gross'];
    $payment_currency = $_POST['mc_currency'];
    $txn_id = $_POST['txn_id'];
    $receiver_email = $_POST['receiver_email'];
    $payer_email = $_POST['payer_email'];
    include "dbcontroller.php";
    $db = new DBController();
    // check whether the payment_status is Completed
    $isPaymentCompleted = false;
    if ($payment_status == "Completed") {
        $isPaymentCompleted = true;
    }
    // check that txn_id has not been previously processed
    $isUniqueTxnId = false;
    $result = $db->selectQuery("SELECT * FROM payments WHERE txn_id = '{$txn_id}'");
    if (empty($result)) {
        $isUniqueTxnId = true;
    }
    // check that receiver_email is your PayPal email
    // check that payment_amount/payment_currency are correct
    if ($isPaymentCompleted && $isUniqueTxnId && $payment_amount == "0.01" && $payment_currency == "USD") {
        $payment_id = $db->insertQuery("INSERT INTO payment(item_number, item_name, payment_status, payment_amount, payment_currency, txn_id) VALUES('{$item_number}', '{$item_name}', {$payment_status}, '{$payment_amount}', '{$payment_currency}', '{$txn_id}')");
Пример #20
0
<?php

session_start();
require_once "dbcontroller.php";
$db_handle = new DBController();
if (!empty($_GET["action"])) {
    switch ($_GET["action"]) {
        case "add":
            if (!empty($_POST["quantity"])) {
                $productByCode = $db_handle->runQuery("SELECT * FROM khanaman.tblproduct WHERE code='" . $_GET["code"] . "'");
                $itemArray = array($productByCode[0]["code"] => array('name' => $productByCode[0]["name"], 'code' => $productByCode[0]["code"], 'quantity' => $_POST["quantity"], 'price' => $productByCode[0]["price"]));
                if (!empty($_SESSION["cart_item"])) {
                    if (in_array($productByCode[0]["code"], $_SESSION["cart_item"])) {
                        foreach ($_SESSION["cart_item"] as $k => $v) {
                            if ($productByCode[0]["code"] == $k) {
                                $_SESSION["cart_item"][$k]["quantity"] = $_POST["quantity"];
                            }
                        }
                    } else {
                        $_SESSION["cart_item"] = array_merge($_SESSION["cart_item"], $itemArray);
                    }
                } else {
                    $_SESSION["cart_item"] = $itemArray;
                }
            }
            break;
            /*starts*/
        /*starts*/
        case "increase":
            //if(empty($_SESSION["cart_item"])) {
            //  $_SESSION["cart_item"] = $itemArray;
Пример #21
0
 public function unlink($_post)
 {
     $filter = "idskill`='{$_post['idskill']}' AND `to_userid`='{$_post['by_userid']}' AND `by_userid`='{$_post['to_userid']}'";
     // echo $filter;exit;
     $this->id = parent::unlink($_post, $this->table);
 }
Пример #22
0
<?php

session_start();
require_once "dbcontroller.php";
$db_handle = new DBController();
$res_id = $_GET['res_id'];
if (empty($_SESSION['login_user'])) {
    include 'header.php';
} else {
    include 'user_home.php';
}
?>
<html>
<head>
  <title>Review's</title>
  <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0"/>
  <link rel="stylesheet" type="text/css" href="menu_items_info.css">
  <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">


<style>
body{
  background-color: #4D2121;
}
.de{
  background-color:black;
}
.cat_menu{
      background-color: black;
    width: 20%;
    height: auto;
<?php

session_start();
$current_page_uri = $_SERVER['REQUEST_URI'];
$part_url = explode("/", $current_page_uri);
require_once "controller/dbcontroller.php";
$db_handle = new DBController();
$conn = $db_handle->connectDB();
if (!empty($_POST["action"])) {
    switch ($_POST["action"]) {
        case "add":
            if (!empty($_POST["quantity"])) {
                $productByCode = $db_handle->runQuery($conn, "SELECT * FROM tblproduct WHERE code='" . $_POST["code"] . "'");
                $itemArray = array($productByCode[0]["code"] => array('name' => $productByCode[0]["name"], 'code' => $productByCode[0]["code"], 'quantity' => $_POST["quantity"], 'price' => $productByCode[0]["price"]));
                if (!empty($_SESSION["cart_item"])) {
                    if (in_array($productByCode[0]["code"], $_SESSION["cart_item"])) {
                        foreach ($_SESSION["cart_item"] as $k => $v) {
                            if ($productByCode[0]["code"] == $k) {
                                $_SESSION["cart_item"][$k]["quantity"] = $_POST["quantity"];
                            }
                        }
                    } else {
                        $_SESSION["cart_item"] = array_merge($_SESSION["cart_item"], $itemArray);
                    }
                } else {
                    $_SESSION["cart_item"] = $itemArray;
                }
            }
            break;
        case "remove":
            if (!empty($_SESSION["cart_item"])) {
Пример #24
0
<?php

session_start();
require_once "dbcontroller.php";
$db_handle = new DBController();
if (!empty($_GET["action"])) {
    switch ($_GET["action"]) {
        case "add":
            if (!empty($_POST["quantity"])) {
                $productByid = $db_handle->runQuery("SELECT * FROM bakeryproducts WHERE id='" . $_GET["id"] . "'");
                $itemArray = array($productByid[0]["id"] => array('name' => $productByid[0]["name"], 'id' => $productByid[0]["id"], 'quantity' => $_POST["quantity"], 'price' => $productByid[0]["price"]));
                if (!empty($_SESSION["cart_item"])) {
                    if (in_array($productByid[0]["id"], $_SESSION["cart_item"])) {
                        foreach ($_SESSION["cart_item"] as $k => $v) {
                            if ($productByid[0]["id"] == $k) {
                                $_SESSION["cart_item"][$k]["quantity"] = $_POST["quantity"];
                            }
                        }
                    } else {
                        $_SESSION["cart_item"] = array_merge($_SESSION["cart_item"], $itemArray);
                    }
                } else {
                    $_SESSION["cart_item"] = $itemArray;
                }
            }
            break;
        case "remove":
            if (!empty($_SESSION["cart_item"])) {
                foreach ($_SESSION["cart_item"] as $k => $v) {
                    if ($_GET["id"] == $k) {
                        unset($_SESSION["cart_item"][$k]);
Пример #25
0
    }
    /* Validation to check if gender is selected */
    if (!isset($message)) {
        if (!isset($_POST["gender"])) {
            $message = " Gender field is required";
        }
    }
    /* Validation to check if Terms and Conditions are accepted */
    if (!isset($message)) {
        if (!isset($_POST["terms"])) {
            $message = "Accept Terms and conditions before submit";
        }
    }
    if (!isset($message)) {
        require_once "dbcontroller.php";
        $db_handle = new DBController();
        $query = "INSERT INTO reg(first_name, last_name, DOB, contact, email, gender, nationality, occupation, home_addr) VALUES\n\t\t( '" . $_POST["firstName"] . "', '" . $_POST["lastName"] . "', '" . $_POST["dob"] . "', '" . $_POST["cnumber"] . "',  '" . $_POST["userEmail"] . "' ,  '" . $_POST["gender"] . "',  '" . $_POST["nationality"] . "', '" . $_POST["occ"] . "', '" . $_POST["home_add"] . "')";
        $result = $db_handle->insertQuery($query);
        if (!empty($result)) {
            $message = "You have registered successfully!";
            unset($_POST);
        } else {
            $message = "Problem in registration. Try Again!";
        }
    }
}
?>
<html>
<head>
<title>PHP User Registration Form</title>
<style>
Пример #26
0
<?php

require_once "dbcontroller.php";
require_once "pagination.class.php";
$db_handle = new DBController();
$name = "";
$code = "";
$perPage = new PerPage();
$queryCondition = "";
if (!empty($_POST["name"])) {
    $queryCondition .= " WHERE name LIKE '" . $_POST["name"] . "%'";
}
if (!empty($_POST["code"])) {
    if (!empty($queryCondition)) {
        $queryCondition .= " AND ";
    } else {
        $queryCondition .= " WHERE ";
    }
    $queryCondition .= " code LIKE '" . $_POST["code"] . "%'";
}
$orderby = " ORDER BY id desc";
$sql = "SELECT * FROM toy " . $queryCondition;
$paginationlink = "getresult.php?page=";
$page = 1;
if (!empty($_GET["page"])) {
    $page = $_GET["page"];
}
$start = ($page - 1) * $perPage->perpage;
if ($start < 0) {
    $start = 0;
}
Пример #27
0
<?php

include 'util/DBController.php';
$db = new DBController();
if (isset($_POST['eventname']) && isset($_POST['date'])) {
    if (isset($_POST['description'])) {
        $description = $_POST['description'];
    } else {
        $description = "";
    }
    if (isset($_POST['location'])) {
        $location = $_POST['location'];
    } else {
        $location = "";
    }
    $album_ID = $db->insert_album($_POST['eventname'], $description, $location, $_POST['date']);
    header('Location: album.php?id=' . $album_ID);
    die;
}
Пример #28
0
<?php

if (isset($_POST['entry'])) {
    include_once '/db/DBController.php';
    include_once '/log/Logger.php';
    include_once 'plain.php';
    $logger = new Logger('Add.php');
    $logger->info('Request to add a new entry received.');
    try {
        $db = new DBController();
        echo @$db->addEntry($_POST['entry']);
        $logger->info('Added new entry: ' . $_POST['entry']);
    } catch (Exception $e) {
        echo 0;
    }
}
Пример #29
-1
 public function unlink($_post)
 {
     $this->prepare($_post);
     $filter = "`id` = " . $_post['id'] . " and`userid` = " . self::jsid();
     // echo $filter;exit;
     $this->id = parent::unlink($filter, $this->table);
 }