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


PHP SafeMySQL::getRow方法代码示例

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


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

示例1: SafeMySQL

<?php

require '../../php/main/db_connect.php';
$id_other = filter_input(INPUT_POST, 'page');
$text = filter_input(INPUT_POST, 'text');
if (isset($user_id, $text, $id_other) && $id_other !== $user_id) {
    $string = new SafeMySQL();
    date_default_timezone_set('Europe/London');
    $date = date('Y-m-d H:i:s');
    $x = $string->getRow("SELECT d_id FROM users_dialogs WHERE pioneer_id=?i AND other_id=?i OR other_id=?i AND pioneer_id=?i", $user_id, $id_other, $user_id, $id_other);
    if ($x) {
        $y = $string->query("INSERT INTO users_messages (d_id,user_id,text,date) VALUES (?i,?i,?s,?s)", $x['d_id'], $user_id, $text, $date);
        $query_dialog = $string->query('UPDATE users_dialogs SET date=?s,meter=?i WHERE d_id=?i LIMIT 1', $date, $user_id, $x['d_id']);
        print "success";
    } else {
        $y = $string->query("INSERT INTO users_dialogs (other_id, pioneer_id, date) VALUES (?i, ?i, ?s)", $id_other, $user_id, $date);
        $k = $string->getOne('SELECT d_id FROM users_dialogs WHERE pioneer_id=?i AND other_id=?i', $user_id, $id_other);
        $z = $string->query("INSERT INTO users_messages (d_id,user_id,text,date) VALUES (?i,?i,?s,?s)", $k, $user_id, $text, $date);
        print "success";
    }
} else {
    print 'Пройдите регистрацию или авторизацию.';
}
开发者ID:alexander-shibisty,项目名称:subscribeonme,代码行数:23,代码来源:message_new_dialog.php

示例2: json_encode

<?php

require_once "lib/safemysql.class.php";
$errormsg = "";
$response = [];
try {
    $db = new SafeMySQL(['host' => "s214.webhostingserver.nl", 'user' => "deb12215n7_curl3@s214.webhostingserver.nl", 'pass' => "tofreshdesk3", 'db' => "deb12215n7_curl3"]);
    $tableName = "tickets";
    $sql = "SELECT * FROM {$tableName} ORDER BY dtime DESC LIMIT 1";
    $values = $db->getRow($sql);
    $response["data"] = $values;
} catch (Exception $e) {
    $errormsg = $e->getMessage();
}
if ($errormsg == "") {
    $response["status"] = "ok";
} else {
    $response["status"] = "error";
    $response["message"] = $errormsg;
}
echo json_encode($response);
开发者ID:vmax44,项目名称:vmax.16mb.com,代码行数:21,代码来源:test.php

示例3: json_encode

<?php

require '../php/main/db_connect.php';
require 'mm/parser.php';
$arr = array();
if ($last_id && $page && $user_id) {
    $string_object = new SafeMySQL();
    $writer = new Writer();
    $y = $string_object->getRow("SELECT d_id, other_id, pioneer_id,meter FROM users_dialogs WHERE d_id=?i AND pioneer_id=?i OR d_id=?i AND other_id=?i LIMIT 1", $category, $user_id, $category, $user_id);
    if ($y['d_id']) {
        $dg = $string_object->getAll("SELECT m.text, m.date, m.mes_id, i.avatar, i.category, i.nickname FROM users_messages m, users_information i WHERE m.d_id=?i AND m.mes_id < ?i AND i.user_id = m.user_id ORDER BY m.mes_id DESC LIMIT 10", $y['d_id'], $last_id);
        $avatar = $string_object->getOne('SELECT avatar FROM users_information WHERE user_id=?i', $user_id);
        $avatar = file_exists('../upload_image/avatars/pre_150px/' . $avatar . '.jpg') ? $avatar : 'default';
        $i = 0;
        foreach ($dg as $array) {
            $res = array('n0' => $y['d_id'], 'n1' => $array['mes_id'], 'n2' => $array['avatar'], 'n3' => $array['nickname'], 'n4' => $array['date'], 'n5' => $writer->main($array['text'], 1));
            $i++;
            array_push($arr, $res);
        }
        unset($array);
    }
}
print json_encode($arr);
开发者ID:alexander-shibisty,项目名称:subscribeonme,代码行数:23,代码来源:str.php

示例4: SafeMySQL

<?php

if ($id && $category) {
    $string_object = new SafeMySQL();
    $o = $string_object->getRow('SELECT video FROM posts_videos WHERE v_id=?i', $id);
    preg_match("/(?:https?:\\/\\/)?(?:www\\.)?((?:\\w|-){1,50})\\.(?:(?:\\w|-\\?\\/){1,500})/", $o['video'], $result);
    $parsing = mb_strtolower($result[1]);
    switch ($parsing) {
        case 'youtube':
        case 'youtu':
            preg_match("/^(?:https?:\\/\\/)?(?:www\\.)?youtube\\.com\\/watch\\?(?=.*v=((?:\\w|-){11}))(?:\\S+)?\$/", $o['video'], $video_result);
            print '<iframe src="//www.youtube.com/embed/' . $video_result[1] . '?wmode=opaque" frameborder="0" allowfullscreen></iframe>
                   <nav id="modal_nav">
                        <button></button>
                        <button></button>
                        <button></button>
                        <button></button>
                   </nav>
                   <section id="modal_in"></section>
                   <section id="modal_comments"></section>
                   <div id="modal_str"></div>';
            break;
    }
}
开发者ID:alexander-shibisty,项目名称:subscribeonme,代码行数:24,代码来源:video.php

示例5: SafeMySQL

<?php

ini_set('display_errors', 1);
include 'mysql.php';
$db = new SafeMySQL();
$posts = json_decode(file_get_contents('https://api.vk.com/method/wall.get?owner_id=-99252033&count=30&filter=owner'));
print_r($posts);
for ($i = 1; $i < 25; $i++) {
    if ($i == 1) {
        $toBase['is_pinned'] = 1;
    } else {
        $toBase['is_pinned'] = 0;
    }
    $toBase['text'] = substr($posts->response[$i]->text, 0, strpos($posts->response[$i]->text, ' ', 240));
    $toBase['img'] = $posts->response[$i]->attachment->photo->src_big;
    $toBase['link'] = 'wall-99252033_' . $posts->response[$i]->id;
    $toBase['reposts_count'] = $posts->response[$i]->reposts->count;
    $test = trim($toBase['text']);
    if (empty($test) or $posts->response[$i]->post_type == 'copy') {
        continue;
    } else {
        //если закреплённый пост не пуст(нет бана) удаляем старый
        if ($i == 1) {
            $db->query("DELETE FROM posts WHERE is_pinned = '1'");
        }
    }
    $is = $db->getRow("SELECT * FROM posts WHERE text = ?s OR img = ?s", $toBase['text'], $toBase['img']);
    if (!$is) {
        $db->query("INSERT INTO posts SET ?u", $toBase);
    }
}
开发者ID:DeadMerc,项目名称:landingVkPage,代码行数:31,代码来源:core.php

示例6: header

        <?php 
}
/* ------------------------ DELETE ------------------------ */
// Delete node ($_GET['section_id']) from the tree wihtout deleting it's children
// All children apps to one level
if (!empty($_GET['action']) && 'delete' == $_GET['action']) {
    $dbtree->Delete((int) $_GET['section_id']);
    header('Location:dbtree_demo.php');
    exit;
}
/* ------------------------ EDIT ------------------------ */
/* ------------------------ EDIT OK ------------------------ */
// Update node ($_GET['section_id']) info
if (!empty($_GET['action']) && 'edit_ok' == $_GET['action']) {
    $sql = 'SELECT * FROM test_sections WHERE section_id = ' . (int) $_GET['section_id'];
    $section = $db->getRow($sql);
    if (false == $section) {
        echo 'section_not_found';
        exit;
    }
    $sql = 'UPDATE test_sections SET ?u WHERE section_id = ?i';
    $db->query($sql, $_POST['section'], $_GET['section_id']);
    header('Location:dbtree_demo.php');
    exit;
}
/* ------------------------ EDIT FORM ------------------------ */
// Node edit form
if (!empty($_GET['action']) && 'edit' == $_GET['action']) {
    $sql = 'SELECT section_name FROM test_sections WHERE section_id = ' . (int) $_GET['section_id'];
    $section = $db->getOne($sql);
    ?>
开发者ID:ssgonchar,项目名称:DbTree,代码行数:31,代码来源:dbtree_demo.php

示例7: array

                    <p>Что-то пошло не так.</p>
                </div>');
            array_push($arr, $res);
        }
        mysqli_close($load);
    } else {
        $res = array('head' => '<div id="material_null">
                                <p>Данные не сошлись.</p>
                            </div>');
        array_push($arr, $res);
    }
} else {
    if (preg_match('/^(?:\\d+)_(?:\\w+)$/', $category) && !filter_input(INPUT_COOKIE, 'RememberMe')) {
        require '../php/main/SafeMySQL.php';
        $o = new SafeMySQL();
        $x = $o->getRow('SELECT password, email, nickname, category, rules FROM users_registration WHERE key_reg=?s', $category);
        if (!$x) {
            $res = array('head' => '<div id="material_null">
                                    <p>МАТЕРИАЛОВ НЕТ</p>
                                </div>');
            array_push($arr, $res);
            print json_encode($arr);
            exit;
        }
        $res = array('head' => '<style>
                            #material_null input {
                                width:174px;
                                height:30px;
                                border:none;
                                padding:3px;
                                border-bottom: 2px #db9b9b solid;
开发者ID:alexander-shibisty,项目名称:subscribeonme,代码行数:31,代码来源:block.php

示例8: SafeMySQL

                         <div id="user_nickname">
                         <p>' . $y['nickname'] . '</p>
                         </div>
                         </section>
                     <nav id="content_menu">
                         <a href="pl&cat=all" class="new_local"><p>ПРОФИЛЬ</p></a>
                         <a href="pl&cat=content" class="new_local"><p>КОНТЕНТ</p></a>
                         <a href="pl&cat=comunity" class="new_local"><p>СООБЩЕСТВА</p></a>
                         <a href="pl&cat=rating" class="new_local"><p>РЕЙТИНГ</p></a>
                     </nav>');
     array_push($arr, $res);
 } else {
     if ($get_var !== $user_id) {
         //Вывод профиля другого пользователя
         $string_object = new SafeMySQL();
         $y = $string_object->getRow($query = "SELECT nickname, avatar FROM users_information WHERE user_id=?i", $get_var);
         if ($y) {
             $i = file_exists('../upload_image/avatars/' . $y['avatar'] . '.jpg') ? $y['avatar'] : 'default';
             $res = array('head' => '<section id="user_profile">
                             <section id="user_information" style="background: #000 no-repeat center url(upload_image/avatars/' . $i . '.jpg);">
                             <div id="user_nickname">
                             <p>' . $y['nickname'] . '</p>
                             </div>
                             <nav id="user_buttom">
                             <div class="user_buttom"><p>НАПИСАТЬ СООБЩЕНИЕ</p></div>
                             <div class="user_buttom"><p>ПОДПИСЧИКИ</p><div id="sub_meter"><p>0</p></div></div>
                             <div class="user_buttom">
                             <div id="user_lvl">
                             <p>0</p>
                             <div>
                             <div id="user_progress">
开发者ID:alexander-shibisty,项目名称:subscribeonme,代码行数:31,代码来源:profile.php

示例9: stdClass

session_start();
$set = new stdClass();
// stores general settings
$page = new stdClass();
// stores page details(title,... etc.)
$page->navbar = array();
// stores the navbar items
define("MLS_ROOT", dirname(dirname(__FILE__)));
// the root path
include "settings.php";
include MLS_ROOT . "/lib/mysql.class.php";
include MLS_ROOT . "/lib/users.class.php";
include MLS_ROOT . "/lib/presets.class.php";
include MLS_ROOT . "/lib/options.class.php";
$db = new SafeMySQL(array('host' => $set->db_host, 'user' => $set->db_user, 'pass' => $set->db_pass, 'db' => $set->db_name));
if (!($db_set = $db->getRow("SELECT * FROM `" . MLS_PREFIX . "settings` LIMIT 1"))) {
    // if we have no data in db we need to run the install.php
    header("Location: install.php");
    exit;
}
// we grab the settings and we merge them into $set
$set = (object) array_merge((array) $set, (array) $db_set);
$presets = new presets();
$user = new User($db);
$options = new Options();
// we check for cookies to autologin
if (!$user->islg() && isset($_COOKIE['user']) && isset($_COOKIE['pass'])) {
    if ($usr = $db->getRow("SELECT `userid` FROM `" . MLS_PREFIX . "users` WHERE `username` = ?s AND `password` = ?s", $_COOKIE['user'], $_COOKIE['pass'])) {
        $_SESSION['user'] = $usr->userid;
        $user = new User($db);
    }
开发者ID:amoskarugaba,项目名称:master-login-system,代码行数:31,代码来源:init.php


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