当前位置: 首页>>代码示例>>PHP>>正文


PHP medoo::get方法代码示例

本文整理汇总了PHP中medoo::get方法的典型用法代码示例。如果您正苦于以下问题:PHP medoo::get方法的具体用法?PHP medoo::get怎么用?PHP medoo::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在medoo的用法示例。


在下文中一共展示了medoo::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * @param      $table
  * @param      $columns
  * @param null $where
  * @return bool|array
  */
 public function get($table, $columns, $where = NULL)
 {
     if (empty($this->_reader)) {
         return $this->_writer->get($table, $columns, $where);
     } else {
         return $this->_reader->get($table, $columns, $where);
     }
 }
开发者ID:dalinhuang,项目名称:StudentManage,代码行数:14,代码来源:sql.php

示例2: login

 function login()
 {
     if (session_id() == '') {
         session_start();
     }
     if (isset($_POST["mail"]) & isset($_POST["password"]) & isset($_POST["cre"])) {
         if ($_POST["mail"] != "" and $_POST["password"] != "" and $_POST["cre"] != "") {
             $mail = $_POST["mail"];
             $password = $_POST["password"];
             $role = $_POST["cre"];
             require_once 'SessionManager.php';
             $session_manager = new SessionManager();
             require_once 'medoo.min.php';
             $database = new medoo();
             $count = $database->count("triotrack_users", ["email" => "{$mail}"]);
             if ($count > 0) {
                 $profile = $database->get("triotrack_users", ["username", "password", "salt", "client"], ["email" => "{$mail}"]);
                 if ($role === "admin") {
                     if ($profile["password"] === sha1($password . $profile["salt"])) {
                         $username = $profile["username"];
                         $client = $profile["client"];
                         $cookie = array("email" => "{$mail}", "username" => "{$username}", "password" => "{$password}", "client" => "{$client}", "role" => "{$role}");
                         $encoded_cookie = $session_manager->encode_session(json_encode($cookie));
                         $_SESSION["user_id"] = $encoded_cookie;
                         setcookie("user_id", $encoded_cookie, time() + 86400 * 1, "/");
                         // 86400 = 1 day
                         echo "admin";
                         exit;
                     } else {
                         echo "failed";
                         exit;
                     }
                 } else {
                     if ($profile["client"] === $password) {
                         $username = $profile["username"];
                         $client = $profile["client"];
                         $cookie = array("email" => "{$mail}", "username" => "{$username}", "password" => "{$password}", "client" => "{$client}", "role" => "{$role}");
                         $encoded_cookie = $session_manager->encode_session(json_encode($cookie));
                         $_SESSION["user_id"] = $encoded_cookie;
                         setcookie("user_id", $encoded_cookie, time() + 86400 * 1, "/");
                         // 86400 = 1 day
                         echo "client";
                         exit;
                     } else {
                         echo "failed";
                         exit;
                     }
                 }
             }
         } else {
             echo "failed";
         }
         exit;
     }
 }
开发者ID:venusdharan,项目名称:Codex-PHP-Framework,代码行数:55,代码来源:AuthenticationManager.php

示例3: medoo

<?php

require_once 'meedoo.php';
require_once 'config.php';
$database = new medoo();
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
$email = $_POST["email"];
$name = $_POST["name"];
$password1 = $_POST["password"];
$password = md5($password1 . $salt);
//check if user exists
$profile = $database->get("users", ["email"], ["email" => $email]);
$profile_email = $profile['email'];
if ($profile_email) {
    echo 'emailTaken';
} else {
    //if not...
    $add = $database->insert('users', ['email' => $email, 'password' => $password, 'name' => $name]);
    if ($add) {
        $_SESSION['user'] = $email;
        echo 'good';
    } else {
        echo 'bad';
    }
}
开发者ID:ltlam93,项目名称:meals,代码行数:28,代码来源:user-create.php

示例4:

<?php

error_reporting(E_ALL);
require_once __DIR__ . '/../vendor/autoload.php';
$db = new \medoo(['database_type' => 'mysql', 'database_name' => 'dbal_wrap', 'server' => 'localhost', 'username' => 'root', 'password' => '', 'charset' => 'utf8']);
$data = $db->get('goods', '*', ['id' => 12]);
print_r($data);
开发者ID:dongww,项目名称:simple-db,代码行数:7,代码来源:medoo.php

示例5: dbHasError

defined("LIBRARY_PATH") or define("LIBRARY_PATH", realpath(dirname(__FILE__) . '/lib'));
include LIBRARY_PATH . '/medoo.min.php';
if (isset($_GET['install']) and !file_exists(LIBRARY_PATH . '/database.db') and isset($_POST['username']) and isset($_POST['pwd']) and isset($_POST['rpt']) and $_POST['pwd'] == $_POST['rpt']) {
    $db = new medoo(LIBRARY_PATH . '/database.db');
    $db->query("CREATE TABLE users (username TEXT,password TEXT);");
    $db->query("CREATE TABLE settings (setting TEXT,value TEXT);");
    $db->query("CREATE TABLE hosts (domain TEXT,checkInTime TEXT,description TEXT);");
    $db->insert("users", ["username" => strtolower($_POST['username']), "password" => password_hash($_POST['pwd'], PASSWORD_DEFAULT)]);
    $db->insert("settings", ["setting" => "secretKey", "value" => rand()]);
    if (!$db->error()[0] == "00000") {
        unlink(LIBRARY_PATH . '/database.db');
        $noticeMessage = "An error occurred while saving the database.";
    } else {
        $noticeMessage = "Successfully installed DropPoint control. Please login.";
    }
}
if (!file_exists(LIBRARY_PATH . '/database.db')) {
    include TEMPLATES_PATH . '/setup.php';
    exit;
}
$db = new medoo(LIBRARY_PATH . '/database.db');
$secretCode = $db->get("settings", "value", ["setting" => "secretKey"]);
function dbHasError()
{
    global $db;
    if ($db->error()[0] == "00000") {
        return false;
    } else {
        return true;
    }
}
开发者ID:bhassani,项目名称:dropPoint,代码行数:31,代码来源:droppoint.php

示例6: medoo

<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);
require_once 'meedoo.php';
require_once 'config.php';
$database = new medoo();
// echo 'Request: ' . $_SERVER['REQUEST_METHOD'].'. ';
$mealID = $_GET['mealID'];
$meal = $database->get("meals", ["mealID", "id", "datecreated", "name", "type", "ingredients", "instructions", "status", "user"], ["mealID" => $mealID]);
$dataJSON = json_encode($meal);
if ($meal) {
    echo $dataJSON;
} else {
    echo 'bad';
}
?>


开发者ID:ltlam93,项目名称:meals,代码行数:17,代码来源:meal-get-single.php

示例7: medoo

    include 'assets/html/login_success.html';
    include 'phpAPI/home.php';
    //header("Location: /wedstrijdplatform/#/spelpagina"); //dit mag hier niet, zorgt voor eindeloze redirect ( na post ziet hij dat er al een sessie is dus komt hij hier en gaat hij nogmaals doorverwijzen
    //naar spelpagina, en dit blijft zich herhalen, dit stond hier omdat je als je al ingelogd bent, dat je automatisch de spelpagina ziet en niet opnieuw moet inloggen)
    include "assets/html/footer.html";
    //session_destroy(); //moet weg, staat hier enkel voor test
} else {
    if (isset($_POST['inputEmail'], $_POST['inputPassword'])) {
        $database = new medoo();
        $email = trim($_POST['inputEmail']);
        /* Check for correct email and password */
        $emailExists = $database->count("gebruikers", ["AND" => ["email" => $email]]);
        /* If exectly one user has been found */
        if ($emailExists == 1) {
            $enteredPassword = trim($_POST['inputPassword']);
            $user = $database->get("gebruikers", "*", ["AND" => ["email" => $email]]);
            //print_r($user);
            $dbpassword = $user['wachtwoord'];
            if (password_verify($enteredPassword, $dbpassword)) {
                $_SESSION['email'] = $email;
                $_SESSION['isLoggedIn'] = "true";
                /*include 'html/nav.html';
                		echo "<h1>User was get from post!</h1>"; /////////////////////////////////delete
                		include 'html/login_success.html';
                		echo "<h1>Normal user logged in.</h1>";
                		include 'php/home.php';*/
                header("Location: /wedstrijdplatform/#/spelpagina");
            } else {
                include 'assets/html/nav.html';
                include 'assets/html/failed_login.html';
                include 'phpAPI/home.php';
开发者ID:EuroGijbelsPXL,项目名称:Wedstrijdplatform,代码行数:31,代码来源:index.php

示例8: isset

}
// Logged in?
$user = isset($_SESSION["user_connected"]) ? $_SESSION["user_connected"] : '0';
$uid = isset($_SESSION["uid"]) ? $_SESSION["uid"] : '';
$email = isset($_SESSION["email"]) ? $_SESSION["email"] : '';
// Set variables
$user_exist = isset($user_exist) ? $user_exist : '';
$user_email = isset($user_email) ? $user_email : '';
$datas = isset($datas) ? $datas : '';
$user_id = isset($user_id) ? $user_id : '';
// DB
require_once 'lib/medoo/medoo.php';
$database = new medoo(['database_type' => 'mysql', 'database_name' => 'table_name', 'server' => 'localhost', 'username' => 'root', 'password' => '', 'charset' => 'utf8']);
// Get logged in user's name
if ($user) {
    $data = $database->get("users2", "*", ["email" => $email]);
    $name = $data["name"];
    $user_id = $data['id'];
} else {
    if ($uid) {
        $data = $database->get("users2", "*", ["hybridauth_provider_uid" => $uid]);
        $name = $data["name"];
        $user_id = $data['id'];
    }
}
// Forgotten password variables for email:
$headers = 'From: admin@yoursite.com' . "\r\n" . 'Reply-To: admin@yoursite.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
// Main action for switcher.
$a = isset($_GET['a']) ? $_GET['a'] : '';
switch ($a) {
    // DASHBOARD
开发者ID:alijaffar,项目名称:PHP-Login-Framework,代码行数:31,代码来源:index.php

示例9: get

 /**
  * @param string $table
  * @param array $join
  * @param string|array $column
  * @param array $where
  * @return bool|array
  *
  * Or,
  * @param string $table
  * @param string|array $column
  * @param array $where
  * @return bool|array
  */
 public function get($table, $join = null, $column = null, $where = null)
 {
     $re = parent::get($table, $join, $column, $where);
     $this->lastSql = $this->last_query();
     $this->lastError = $this->error();
     return $re;
 }
开发者ID:wwtg99,项目名称:data_pool,代码行数:20,代码来源:MedooPlus.php

示例10: function

<?php

$app->get('/invoice/:id', function ($id) use($app) {
    global $billingInfo;
    global $dbCredentials;
    $database = new medoo($dbCredentials);
    $invoice = $database->get("invoice", ["id", "modified", "company", "name", "address", "type", "currency"], ["id" => $id]);
    if ($invoice) {
        $invoice['lines'] = $database->select("line", ["id", "description", "charge", "quantity", "is_hours"], ["invoice_id" => $invoice['id'], "ORDER" => "id ASC"]);
    } else {
        $app->response->setStatus(404);
    }
    $app->render('invoice.html.twig', ['invoice' => $invoice, 'billing' => $billingInfo]);
})->setName('invoice');
开发者ID:scriptist,项目名称:invoice.scripti.st,代码行数:14,代码来源:invoice.php

示例11: medoo

<?php

/**
 * Created by IntelliJ IDEA.
 * User: nicko
 * Date: 02.02.2016
 * Time: 23:38
 */
require_once 'vendor/autoload.php';
//open database connection
$database = new medoo(['database_type' => 'mysql', 'database_name' => 'r8db', 'server' => '172.16.2.109', 'username' => 'admin', 'password' => 'admin', 'charset' => 'utf8']);
$user_id = $database->select("user", ["[>]entry" => "user_id"], ["entry.entry_id"], ["entry_id" => 10]);
$user = $database->get('user', ['[>]entry' => "user_id"], ['user_id', 'email', 'username', 'admin', 'nsfw'], ['entry_id' => 10]);
$html = '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"><div class="container"><div class="row">';
$html .= '<form class="clearfix" method="get">
<div class="form-group col-sm-4"><label for="action">Action</label><select class="form-control" name="action" id="action"><option value="show">show</option><option value="delete">delete</option><option value="add">add</option><option value="set">set</option></select></div>
<div class="form-group col-sm-4"><label for="amount">Amount</label><input class="form-control" type="number" name="amount" id="amount" value=""></div>
<div class="form-group col-sm-4"><label>Functions</label><div><button type="submit" class="btn btn-primary">Submit</button> <button type="reset" class="btn btn-warning">Reset</button></div></div>
</form>';
$html .= '</div><div class="row"><div class="col-sm-12">';
$count = $database->count('entry');
$database->query('ALTER TABLE "entry" AUTO_INCREMENT = ' . ($count + 1));
if (isset($_GET['action'])) {
    $amount = isset($_GET['amount']) && is_numeric($_GET['amount']) ? intval($_GET['amount']) : 100;
    if ($_GET['action'] == 'delete' && $count != 0) {
        $database->delete('entry', ['ORDER' => 'entry_id DESC', 'LIMIT' => $amount]);
    } elseif ($_GET['action'] == 'delete') {
        $html .= 'Where nothing is, nothing can be removed.';
    } elseif ($_GET['action'] == 'add') {
        for ($i = $count + 1; $i < $count + $amount + 1; ++$i) {
            $data = ['user_id' => 1, 'category_id' => 1, 'title' => 'Dummy #' . $i, 'desc' => 'Lorem Ipsum', 'image' => 'https://placehold.it/400x400'];
开发者ID:thedodobird2,项目名称:M307,代码行数:31,代码来源:entryDB.php

示例12: full

/**
 * Controlla che l'aula studio non sia piena
 * 
 * @param medoo $database Connessione con il database
 * @param int $id
 * @return boolean
 */
function full($database, $id)
{
    return $database->count("pomeriggio", array("AND" => array("aula" => $id, "stato" => 0))) >= $database->get("aule", "max", array("id" => $id));
}
开发者ID:Dasc3er,项目名称:Sito-studentesco,代码行数:11,代码来源:default.php

示例13: define

 * Date: 2016/10/14
 * Time: 下午2:30
 * Desc: 获取用户的关注专题/文集、关注用户、粉丝、文章
 */
ini_set('display_errors', 'ON');
error_reporting(E_ALL);
header("Content-type:text/html;charset=utf-8");
defined('ROOT_PATH') or define('ROOT_PATH', dirname(__FILE__));
include ROOT_PATH . '/medoo.php';
include ROOT_PATH . '/Curl.php';
$db = new medoo(array('database_type' => 'mysql', 'database_name' => 'jianshu', 'server' => 'localhost', 'username' => 'root', 'password' => '123456', 'port' => 3306, 'charset' => 'utf8', 'option' => array(PDO::ATTR_CASE => PDO::CASE_NATURAL)));
$curl = new Curl();
$str = file_get_contents('user.txt');
$id = intval($str);
while (true) {
    $userArr = $db->get('user', '*', array('id[>]' => $id, 'LIMIT' => 1));
    if (!is_array($userArr) || empty($userArr)) {
        echo "Over!\r\n";
        break;
    }
    //关注专题/文集
    collection($userArr);
    //构造数据
    //    $userArr = array('id' => 7231, 'name' => 'f93e84d2e162');
    //关注用户
    following($userArr);
    //粉丝
    follower($userArr);
    //文章
    articles($userArr);
    $id = $userArr['id'];
开发者ID:playgamelxh,项目名称:lxh,代码行数:31,代码来源:user.php

示例14: json_encode

<?php

require '../vendor/autoload.php';
require '../secrets.php';
$data = json_decode(urldecode($_GET['data']), true);
$data['address'] = $_SERVER['REMOTE_ADDR'];
$output = array();
$disableDB = false;
if (!$disableDB) {
    try {
        $database = new medoo(['database_type' => 'mysql', 'database_name' => $dbname, 'server' => $dbhost, 'username' => $dbuser, 'password' => $dbpass, 'port' => $dbport, 'charset' => 'utf8']);
    } catch (Exception $e) {
        die("Failed to connect to the database\r\n");
    }
    $record = $database->get("server", "id", ["id" => $data['serverId']]);
    if (empty($record)) {
        $database->insert("server", ["id" => $data['serverId'], "address" => $data['address'], "port" => $data['port'], "providertoken" => $data['providerId'], "notlegacy" => 1, "lastupdate" => time()]);
        $database->insert("server_details", ["serverid" => $data['serverId'], "players" => $data['currentPlayers'], "slots" => $data['maxPlayers'], "memory" => $data['systemRam']]);
    } else {
        $database->update("server", ["id" => $data['serverId'], "address" => $data['address'], "port" => $data['port'], "providertoken" => $data['providerId'], "lastupdate" => time()], ["id" => $data['serverId']]);
        $database->update("server_details", ["serverid" => $data['serverId'], "players" => $data['currentPlayers'], "slots" => $data['maxPlayers'], "memory" => $data['systemRam']], ["serverid" => $data['serverId']]);
    }
}
$output["success"] = true;
echo json_encode($output);
开发者ID:WhiteXZ,项目名称:Yuuki,代码行数:25,代码来源:submit.php

示例15: message_error

    $json = array('error' => false, 'message_id' => $message_id, 'message' => $message_list[$message_id]);
    if ($data) {
        $json['data'] = $data;
    }
    echo json_encode($json);
}
/* 统一输出函数 */
function message_error($message)
{
    echo json_encode(array('error' => true, 'message' => $message));
}
if (isset($_GET['application'], $_GET['method'], $_GET['apikey'])) {
    $appid = (int) $_GET['application'];
    $method = $_GET['method'];
    $apikey = $_GET['apikey'];
    $application = $database->get('application', array('id', 'apikey'), array('id' => $appid));
    if ($application) {
        if ($apikey === $application['apikey']) {
            $apikey = $application['apikey'];
            if ($method == 'new_order') {
                /* 方法 new_order 开始 */
                if (isset($_POST['sig'], $_POST['tradeNo'], $_POST['desc'], $_POST['time'], $_POST['username'], $_POST['userid'], $_POST['amount'], $_POST['status'])) {
                    /**
                     * 给软件的接口,将订单添加到数据库
                     * 这段代码采用 echo 而不是标准输出函数输出,因为是给别的程序看的
                     **/
                    $sig = $_POST['sig'];
                    //签名
                    $tradeNo = $_POST['tradeNo'];
                    //交易号
                    $payname = $_POST['desc'];
开发者ID:ss098,项目名称:payment,代码行数:31,代码来源:pay.php


注:本文中的medoo::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。