Пример #1
0
 public function login($username, $password)
 {
     $username = strip_tags($username);
     $username = stripslashes($username);
     $username = mysql_real_escape_string($username);
     $passHash = md5($password);
     // Applies MD5 encoded hash to the password
     $connection = new MySQLConnection();
     $connection->connect();
     $sql = "SELECT * FROM mymembers WHERE my_username = '******' AND my_password = '******' LIMIT 1";
     $query = mysql_query($sql);
     if ($query) {
         $count = mysql_num_rows($query);
     } else {
         die(mysql_error());
     }
     if ($count > 0) {
         while ($row = mysql_fetch_array($query)) {
             $_SESSION['username'] = $username;
             $_SESSION['pw'] = $password;
             $uid = $row['uid'];
             session_name($username . $uid);
             setcookie(session_name(), '', time() + 42000, '/');
             $connection->close();
             die("login=1");
         }
         die("login=0&error=Invalid username or password");
     } else {
         $connection->close();
         die("login=0&error=Invalid username or password");
     }
 }
Пример #2
0
function orders_condition_check()
{
    $query = "SELECT * FROM SHEK_orders WHERE status > 0 AND status < 4";
    $connection = MySQLConnection::get_connection();
    $query_obj = $connection->query($query);
    if ($query_obj->num_rows == 0) {
        return;
    }
    $final_result = array();
    while ($result = $query_obj->fetch_assoc()) {
        array_push($final_result, new Order($result));
    }
    foreach ($final_result as $order) {
        $separeted_conditions_array = $order->get_separated_conditions();
        foreach ($separeted_conditions_array as $condition) {
            $from_obj = date_create($condition[2]);
            $from = date_format($from_obj, "Y/m/d H:i:s");
            $to_obj = date_create($condition[3]);
            $to = date_format($to_obj, "Y/m/d H:i:s");
            $now = date("Y/m/d H:i:s");
            if ($to <= $now) {
                $condition[5] = 4;
                $order->change_progress($condition[4]);
            } elseif ($from <= $now) {
                $condition[5] = 2;
            }
        }
        $order->change_conditions_array($separeted_conditions_array);
        $order->change_conditions();
    }
}
Пример #3
0
 public static function connect()
 {
     MySQLConnection::$db_connection = mysqli_init();
     $connected = @mysqli_real_connect(MySQLConnection::$db_connection, MySQLConfiguration::host, MySQLConfiguration::username, MySQLConfiguration::password, MySQLConfiguration::database, MySQLConfiguration::port, MySQLConfiguration::socket, MYSQLI_CLIENT_COMPRESS);
     if (!$connected) {
         //Output error details
         Error::halt(503, 'service unavailable', 'Temporarily unable to process request. Failed to establish a connection with MySQL. Please retry.');
     }
 }
 public function change($newMessage)
 {
     $newMessage = strip_tags($newMessage);
     $newMessage = stripslashes($newMessage);
     $newMessage = mysql_real_escape_string($newMessage);
     //$newMessage = eregi_replace( "`", "", $newMessage );
     $connection = new MySQLConnection();
     $connection->connect();
     $uid = $this->uid;
     $sql = "UPDATE mymembers SET status_message = '{$newMessage}' WHERE uid = {$uid}";
     $query = mysql_query($sql);
     $connection->close();
     if ($query) {
         echo "result=1";
     } else {
         die("result=0");
     }
 }
Пример #5
0
function getsimplequeryjson($query)
{
    require_once 'dbconnection.php';
    $ret_val = array();
    $mysqli = MySQLConnection::Open();
    if ($result = $mysqli->query($query)) {
        $ret_val = make_json_array($result);
    }
    MySQLConnection::Close($mysqli);
    return $ret_val;
}
Пример #6
0
 public function grab()
 {
     $connection = new MySQLConnection();
     $connection->connect();
     $uid = $this->uid;
     $sql = "SELECT * FROM mymembers WHERE uid = {$uid} LIMIT 1";
     $query = mysql_query($sql);
     if ($query) {
         while ($row = mysql_fetch_array($query)) {
             $xml = "<user id='{$uid}'>\n";
             $xml .= "\t<firstName>" . $row['first_name'] . "</firstName>\n";
             $xml .= "\t<lastName>" . $row['last_name'] . "</lastName>\n";
             $xml .= "\t<email>" . $row['email'] . "</email>\n";
             $xml .= "\t<country>" . $row['country'] . "</country>\n";
             $xml .= "\t<statusMessage>" . $row['status_message'] . "</statusMessage>\n";
             $xml .= "</user>";
             $this->xml = $xml;
         }
     } else {
         die("<error>Failed to grab user data.</error>");
     }
 }
Пример #7
0
/**
 * This function return order with order id and user object.If any error occurs returns -1;
 * @param $id:int
 * @param $user_id:WP_USER
 * @returns int|NULL|array
 */
function get_order($id, $user_id)
{
    $connection = MySQLConnection::get_connection();
    $query = "SELECT * FROM SHEK_orders WHERE id = ? AND owner_id = ?";
    if ($prepare = $connection->prepare($query)) {
        $prepare->bind_param("ii", $ID, $ownerId);
        $ID = $id;
        $ownerId = $user_id;
        if ($prepare->execute()) {
            $get_result = $prepare->get_result();
            return $get_result->fetch_assoc();
        } else {
            return -1;
        }
    } else {
        return -1;
    }
}
Пример #8
0
 public static function delete_recipes(array $recipe_ids)
 {
     //Smart quote each recipe id
     $recipe_ids = array_map(function ($element) {
         return MySQLConnection::smart_quote($element);
     }, $recipe_ids);
     $SQL = "DELETE FROM recipes\n\t\t\t              WHERE `id` IN (" . implode(',', $recipe_ids) . ")";
     MySQLConnection::query($SQL) or Error::db_halt(500, 'internal server error', 'Unable to execute request, SQL query error.', __FUNCTION__, MySQLConnection::error(), $SQL);
 }
Пример #9
0
if (!CSRF::is_valid()) {
    Error::halt(400, 'bad request', 'Missing required security token.');
}
$result = MySQLQueries::get_recipe($_POST['recipe']);
$recipe = MySQLConnection::fetch_object($result);
if (empty($recipe)) {
    //Output error details
    Error::halt(400, 'bad request', 'The recipe \'' . $_POST['recipe'] . '\' does not exist.');
}
//Default group handling
if (count($_POST['groups']) === 1 && empty($_POST['groups'][0])) {
    $_POST['groups'] = array();
}
$servers = array();
$results = MySQLQueries::get_servers_by_groups($_POST['groups']);
while ($row = MySQLConnection::fetch_object($results)) {
    $servers[] = $row;
}
$returned_results = array();
foreach ($servers as $server) {
    try {
        $ssh = new SSH($server->address, $server->ssh_port, THROW_ERROR);
    } catch (Exception $ex) {
        $ex = json_decode($ex->getMessage());
        $returned_results[] = array("server" => $server->id, "server_label" => $server->label, "stream" => "error", "result" => $ex->error->message);
        continue;
    }
    try {
        $ssh_auth = $ssh->auth($server->ssh_username, SSH_PUBLIC_KEY_PATH, SSH_PRIVATE_KEY_PATH, THROW_ERROR);
    } catch (Exception $ex) {
        $ex = json_decode($ex->getMessage());
Пример #10
0
/**
 * @param string $discount_code
 * @return bool|array
 */
function get_discount_percent($discount_code)
{
    $query = "SELECT percent FROM SHEK_discounts WHERE code = ? ";
    $connection = MySQLConnection::get_connection();
    if ($prepare = $connection->prepare($query)) {
        $prepare->bind_param("s", $discountCode);
        $discountCode = $discount_code;
        if ($prepare->execute()) {
            $get_result = $prepare->get_result();
            return is_null($result = $get_result->fetch_array()) ? false : val_($result[0]);
        }
        return false;
    }
    return -1;
}
Пример #11
0
/**
 * This function adds meta_value to the end of existing value of that meta_key ;
 * @param $user_id:int
 * @param $meta_key:string
 * @param $meta_value:string
 * @return bool|int
 */
function portal_concat_user_meta($user_id, $meta_key, $meta_value)
{
    $query = "UPDATE wp_usermeta SET meta_value = CONCAT(meta_value,?) WHERE {$user_id} = ? AND meta_key = ?";
    $connection = MySQLConnection::get_connection();
    if ($prepare = $connection->prepare($query)) {
        $prepare->bind_param("sis", $metaValue, $userId, $metaKey);
        $metaValue = $meta_value;
        $userId = $user_id;
        $metaKey = $meta_key;
        if ($prepare->execute()) {
            return true;
        }
        return false;
    }
    return -1;
}
Пример #12
0
 /**
  * This method adds new order to the database If that does not added before;
  * @return bool|int
  */
 public function create()
 {
     $query = " INSERT INTO SHEK_orders(owner_id,title,description,status,progress,installments,price,paid,discount,";
     $query .= "create_date,delivery_date,settlement_date,expire_date,conditions)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
     $connection = MySQLConnection::get_connection();
     // checking if this is a duplicate order
     if ($check_prepare = $connection->prepare("SELECT id FROM SHEK_orders WHERE owner_id = ? AND title = ?")) {
         $check_prepare->bind_param("is", $ID, $checkTitle);
         $ID = $this->owner_id;
         $checkTitle = $this->title;
         if ($check_prepare->execute()) {
             $check_get_result = $check_prepare->get_result();
             if (!is_null($check_get_result->fetch_array())) {
                 return "-1";
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
     if ($prepare = $connection->prepare($query)) {
         $prepare->bind_param("issiisiidsssss", $ownerId, $Title, $Description, $Status, $Progress, $Installments, $Price, $Paid, $Discount, $createDate, $deliveryDate, $settlementDate, $expireDate, $Conditions);
         $ownerId = $this->owner_id;
         $Title = $this->title;
         $Description = $this->description;
         $Status = $this->status;
         $Progress = $this->progress;
         $Installments = $this->installments;
         $Price = $this->price;
         $Paid = $this->paid;
         $Discount = $this->discount;
         $createDate = date("Y/m/d H:i:s");
         $deliveryDate = $this->delivery_date;
         $settlementDate = $this->settlement_date;
         $expireDate = $this->expire_date;
         $Conditions = $this->conditions;
         if ($prepare->execute()) {
             $this->id = $connection->insert_id;
             $this->add_invoices();
             return true;
         }
         return -1;
     }
     return -1;
 }
Пример #13
0
<?php

defined("MYSQLCLASS") || define("MYSQLCLASS", true);
require_once '../__Classes/class.MySQL.php';
defined("FAKE") || define("FAKE", true);
require_once "../common/fake_handler.php";
defined("USERGETTER") || define("USERGETTER", true);
require_once "../common/get_user.php";
defined("COMMONC") || define("COMMONC", true);
require_once "../common/users_common.php";
if (get_user_from_cookie()) {
    header("Location: ../dashboard");
    exit;
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $connection = MySQLConnection::get_connection();
    $query = $connection->query("SELECT ID FROM wp_users WHERE user_email = '" . $_POST['email'] . "'");
    if (is_null($id = $query->fetch_array())) {
        echo "0";
        exit;
    } else {
        if ($meta = portal_get_user_meta($id[0], "forget-password")) {
            $meta_array = explode("|", $meta);
            $date_create = date_create($meta_array[count($meta_array) - 1]);
            $date = date_format($date_create, "Y/m/d H:i:s");
            $new_date = date("Y/m/d H:i:s", strtotime("-7 days"));
            if ($new_date < $date) {
                echo "شما به تازگی پسورد خود را بازیابی کرده اید.امکان بازیابی دوباره ی رمز عبور پیش از یک هفته وجود ندارد";
                exit;
            }
        }
Пример #14
0
<?php

require_once "classes/MySQLConnection.php";
if (isset($_POST['username'])) {
    $connection = new MySQLConnection();
    $connection->connect();
    $username = $_POST['username'];
    $sql = "SELECT * FROM mymembers WHERE my_username = '******' LIMIT 1";
    $query = mysql_query($sql);
    while ($row = mysql_fetch_array($query)) {
        $uid = $row['uid'];
        $xml = '<user id="' . $uid . '">' . "\n";
        $xml .= "\t<firstName>" . $row['first_name'] . "</firstName>\n";
        $xml .= "\t<lastName>" . $row['last_name'] . "</lastName>\n";
        $xml .= "\t<country>" . $row['country'] . "</country>\n";
        $xml .= "\t<statusMessage>" . $row['status_message'] . "</statusMessage>\n";
        $xml .= "</user>\n";
    }
    echo $xml;
    $connection->close();
    exit;
}
?>

		
 /**
  * Execute any statement
  *
  * @param   mixed* args
  * @return  rdbms.mysql.MySQLResultSet or FALSE to indicate failure
  * @throws  rdbms.SQLException
  */
 public function query()
 {
     $args = func_get_args();
     $sql = $this->_prepare($args);
     $res = parent::query($sql);
     if (TRUE !== $res || !$this->shadow) {
         return $res;
     }
     // Get the affected rows / insert_id of the query on the bugs db to check for
     // midway collisions. Otherwise you get the affected rows / insert_id of the
     // shadow db insert
     $this->_affected = mysql_affected_rows($this->handle);
     $this->_insert_id = mysql_insert_id($this->handle);
     // This was an SQL update, insert or delete, or: something that does
     // not return a resultset. Write it into the shadow log
     mysql_query($this->_prepare(array('insert into shadowlog (command) values (%s)', $sql)), $this->handle);
     return $res;
 }
Пример #16
0
/**
 *  returns an array of Invoice objects;
 * @param int $limit
 * @return array|void
 */
function get_invoices($limit = 1000)
{
    defined("INVOICECLASS") || define("INVOICECLASS", true);
    require_once "../__Classes/class.Invoice.php";
    $query = "SELECT * FROM Shek_invoices ORDER BY create_date DESC LIMIT " . strval($limit);
    $connection = MySQLConnection::get_connection();
    $query_object = $connection->query($query);
    if ($query_object->num_rows < 1) {
        return;
    }
    $final_result = array();
    while ($result = $query_object->fetch_assoc()) {
        array_push($final_result, new Invoice($result));
    }
    return $final_result;
}
Пример #17
0
<?php

$root = realpath($_SERVER["DOCUMENT_ROOT"]);
include_once $root . "/Gestarea/util/MySQLConnection.php";
include_once $root . "/Gestarea/modelo/service/ServiceTarea.php";
$msql = new MySQLConnection();
$connection = $msql->getConnection();
$sql = "SELECT ID, FECHA_ALTA, DESCRIPCION, FECHA_INICIO, HORA_INICIO, FECHA_FIN, HORA_FIN, HORAS_TAREA, TOTAL_HORAS FROM TAREA \r\n\t\t\t\tWHERE ID = '1'";
$connection->query($sql);
if ($row = $result->num_rows > 0) {
    echo $row["ID"];
    $tarea = new tarea($row["ID"], $row["FECHA_ALTA"], $row["DESCRIPCION"], $row["FECHA_INICIO"], $row["HORA_INICIO"], $row["FECHA_FIN"], $row["HORA_FIN"], $row["HORAS_TAREA"], $row["TOTAL_HORAS"]);
}
$msql->close();
Пример #18
0
 public static function get_timezone_offset()
 {
     if (defined("TIMEZONE_OFFSET")) {
         return TIMEZONE_OFFSET;
     }
     //Get settings
     $settings = null;
     $result = MySQLQueries::get_settings(false);
     $row = MySQLConnection::fetch_object($result);
     if (isset($row->data)) {
         $row->data = json_decode($row->data);
     }
     $settings = $row;
     if (isset($settings->data->timezone_offset)) {
         if (isset($settings->data->timezone_daylight_savings) && $settings->data->timezone_daylight_savings) {
             $hours = substr($settings->data->timezone_offset, 0, 3);
             $offsetted_hours = $hours + 1;
             if ($offsetted_hours < 0 && substr($offsetted_hours, 0, 1) == "-") {
                 $offsetted_hours = "-" . str_pad(str_replace("-", "", $offsetted_hours), 2, "0", STR_PAD_LEFT);
             } else {
                 $offsetted_hours = "+" . str_pad($offsetted_hours, 2, "0", STR_PAD_LEFT);
             }
             define("TIMEZONE_OFFSET", str_replace($hours, $offsetted_hours, $settings->data->timezone_offset));
         } else {
             define("TIMEZONE_OFFSET", $settings->data->timezone_offset);
         }
     } else {
         define("TIMEZONE_OFFSET", "+00:00");
     }
     return TIMEZONE_OFFSET;
 }
Пример #19
0
 public static function get_db_version()
 {
     $SQL = "SELECT `current`\n\t\t\t          FROM db_version";
     return MySQLConnection::query($SQL);
 }
Пример #20
0
<?php

include "functions.lib.php";
include "database.lib.php";
include "classes.php";
session_start();
// local copy
//$db = new MySQLConnection("p:127.0.0.1", "riccardo", "DyuAH2vBVGYYD3Yy", "registro_elettronico");
// seeweb copy
//$db = new MySQLConnection("sql.inrich.it.cloud.seeweb.it", "admin", "oiQu1ea2", "registro_elettronico", "3306");
//$db->set_charset("utf-8");
// keliweb copy
$db = new MySQLConnection("localhost", "rbachisn_reg", "C}iyHFFRX^Pg", "rbachisn_regelett", "3306");
$db->set_charset("utf-8");
//print "Connection ok";
/*inserisco la visita
$page = $_SERVER["SCRIPT_FILENAME"];
$ip = $_SERVER["REMOTE_ADDR"];
$tipo_utente = "anonimo";
$uid = 0;
$uri = $_SERVER["REQUEST_URI"];
if(isset($_SESSION['__uid__'])){
	$uid = $_SESSION['__uid__'];
	if($_SESSION['__parent'] == 1)
		$tipo_utente = "genitore";
	else if($_SESSION['__student__'] == 1)
		$tipo_utente = "studente";
	else
		$tipo_utente = "scuola";
}
$ins = "INSERT INTO visite (data_ora, ip_address, page, utente, tipo_utente, uri) VALUES (NOW(), '$ip', '$page', $uid, '$tipo_utente', '$uri')";
Пример #21
0
 public static function get_db_version()
 {
     $result = MySQLQueries::get_db_version();
     if ($result !== false) {
         $row = MySQLConnection::fetch_object($result);
         return $row->current;
     }
     return null;
 }
Пример #22
0
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
$_SERVER['SCRIPT_NAME'] !== "/controller.php" ? require_once __DIR__ . "/classes/Requires.php" : (Links::$pretty = true);
Functions::check_required_parameters(array($_GET['param1']));
//Get recipe
$result = MySQLQueries::get_recipe($_GET['param1']);
$recipe = MySQLConnection::fetch_object($result);
$recipe = Functions::format_dates($recipe);
$interpreters = array("shell", "bash", "perl", "python", "node.js");
Header::set_title("Commando.io - Edit Recipe");
Header::render(array("chosen", "codemirror"));
Navigation::render("recipes");
?>
 
    <div class="container">
           
      <div class="row">
      	<div class="span12">
      		<h1 class="header" style="float: left;"><?php 
echo $recipe->name;
?>
</h1> 
Пример #23
0
/**
 * @param int $user_id
 * @param string $new_email
 * @return bool
 */
function update_user_email($user_id, $new_email)
{
    $query = "UPDATE wp_users SET user_email = ? WHERE ID = ?";
    $connection = MySQLConnection::get_connection();
    if ($prepare = $connection->prepare($query)) {
        $prepare->bind_param("si", $newEmail, $id);
        $newEmail = $new_email;
        $id = $user_id;
        if ($prepare->execute()) {
            if (portal_get_user_meta($user_id, "change-email") !== false) {
                portal_concat_user_meta($user_id, "change-email", date("Y/m/d H:i:s") . "|");
            } else {
                portal_add_user_meta($user_id, "change-email", date("Y/m/d H:i:s") . "|");
            }
            return true;
        }
    }
    return false;
}
Пример #24
0
 /**
  * This method adds current ticket to the database;
  * @return bool|int
  */
 public function create()
 {
     $query = "INSERT INTO SHEK_tickets(applicant_id,related_ticket,related_order,status,create_date,title,content,";
     $query .= "attachments,other,tracking_code,department) VALUES(?,?,?,?,?,?,?,?,?,?,?)";
     $connection = MySQLConnection::get_connection();
     if ($prepare = $connection->prepare($query)) {
         $prepare->bind_param("iiiissssssi", $apId, $relatedTicket, $relatedOrder, $Status, $crDate, $Title, $Content, $attch, $Other, $trCode, $department);
         $apId = $this->applicant_id;
         $relatedTicket = $this->related_ticket;
         $relatedOrder = $this->related_order;
         $Status = $this->status;
         $crDate = date("Y/m/d H:i:s");
         $Title = $this->title;
         $Content = $this->content;
         $attch = $this->attachments;
         $Other = $this->other;
         $trCode = $this->tracking_code;
         $department = $this->department;
         if ($prepare->execute()) {
             $this->id = $connection->insert_id;
             return true;
         }
         return false;
     }
     return -1;
 }
Пример #25
0
 /**
  * This method adds invoice to the database if not exists.If exists, update that;
  * @return bool|int
  */
 public function create()
 {
     $query = "INSERT INTO Shek_invoices(owner_id,order_id,price,discount,create_date,expire_date,settlement_date,";
     $query .= "status,installment_number) VALUES(?,?,?,?,?,?,?,?,?)";
     $connection = MySQLConnection::get_connection();
     if ($check_prepare = $connection->prepare("SELECT id FROM Shek_invoices WHERE owner_id = ? AND order_id = ? AND installment_number = ?")) {
         $check_prepare->bind_param("iii", $owner_Id, $order_Id, $instNum);
         $owner_Id = $this->owner_id;
         $order_Id = $this->order_id;
         $instNum = $this->installment_number;
         if ($check_prepare->execute()) {
             $check_get_result = $check_prepare->get_result();
             if (!is_null($check_get_result->fetch_array())) {
                 $this->update();
                 exit;
             }
         } else {
             return false;
         }
     }
     if ($prepare = $connection->prepare($query)) {
         $prepare->bind_param("iiidsssii", $ownerId, $orderId, $Price, $Discount, $CreateDate, $exDate, $setDate, $Status, $instNumber);
         $ownerId = $this->related_user();
         $orderId = $this->related_order();
         $Price = $this->get_price();
         $Discount = $this->get_discount_percent();
         $CreateDate = $this->get_create_date();
         $exDate = $this->get_expire_date();
         $setDate = $this->get_settlement_date();
         $Status = $this->status;
         $instNumber = $this->installment_number;
         if ($prepare->execute()) {
             $this->id = $connection->insert_id;
             return true;
         }
         return -1;
     }
     return -1;
 }
Пример #26
0
 private function __construct()
 {
     MySQLConnection::$_instance = new mysqli(PORTAL_DB_HOST, PORTAL_DB_USERNAME, PORTAL_DB_PASSWORD, PORTAL_DB_NAME);
 }
Пример #27
0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
$_SERVER['SCRIPT_NAME'] !== "/controller.php" ? require_once __DIR__ . "/classes/Requires.php" : (Links::$pretty = true);
$diffs_to_execute = array();
if ($handle = opendir(__DIR__ . "/schema/diffs")) {
    while (false !== ($diff = readdir($handle))) {
        if ($diff != "." && $diff != "..") {
            $diff = basename($diff, ".sql");
            if (version_compare($diff, Version::db, ">=")) {
                $diffs_to_execute[] = $diff;
            }
        }
    }
    closedir($handle);
}
foreach ($diffs_to_execute as $diff) {
    $SQL = str_replace("\n", "", file_get_contents(__DIR__ . "/schema/diffs/" . $diff . ".sql"));
    MySQLConnection::multi_query($SQL) or Error::db_halt(500, 'internal server error', 'Unable to execute request, SQL query error.', __FUNCTION__, MySQLConnection::error(), $SQL);
}
Functions::redirect("/");
Пример #28
0
<?php

/*
# Copyright 2012 NodeSocket, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
$result = MySQLQueries::get_settings();
$settings = null;
$result = MySQLQueries::get_settings();
$row = MySQLConnection::fetch_object($result);
if (isset($row->data)) {
    $row->data = json_decode($row->data);
}
$settings = $row;
Functions::format_dates($settings);
echo json_encode($settings);
Пример #29
0
    $relatedPosts = PostFactory::GetRelatedPosts($postid);
    MySQLConnection::Close($GLOBALS['mysqli']);
    //allow cors
    cors();
    echo json_encode($relatedPosts);
});
$app->get('/getrecentposts/', function () {
    require_once 'common/dbconnection.php';
    require_once 'category.php';
    require_once 'post.php';
    require_once 'posttype.php';
    require_once 'userresponse.php';
    require_once 'userreply.php';
    $GLOBALS['mysqli'] = MySQLConnection::Open();
    $relatedPosts = PostFactory::GetRecentPosts();
    MySQLConnection::Close($GLOBALS['mysqli']);
    //allow cors
    cors();
    echo json_encode($relatedPosts);
});
$app->run();
class User
{
    public function __construct($username, $password)
    {
        $this->UserName = $username;
        $this->Password = $password;
        if ($username == 'gapeterb' && $password == 'danielb') {
            $this->IsValidUser = TRUE;
        }
    }