本文整理汇总了PHP中smartsql函数的典型用法代码示例。如果您正苦于以下问题:PHP smartsql函数的具体用法?PHP smartsql怎么用?PHP smartsql使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smartsql函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lsCheckSession
public static function lsCheckSession($userid, $convid)
{
global $lsdb;
$result = $lsdb->query('SELECT id FROM ' . DB_PREFIX . 'jrc_sessions WHERE userid = "' . smartsql($userid) . '" AND convid = "' . smartsql($convid) . '" AND ended <= 600 LIMIT 1');
if ($lsdb->affected_rows == 0) {
return true;
}
}
示例2: ls_row_exist
function ls_row_exist($id, $table)
{
global $lsdb;
$result = $lsdb->query('SELECT id FROM ' . $table . ' WHERE id = "' . smartsql($id) . '" LIMIT 1');
if ($lsdb->affected_rows > 0) {
return true;
}
}
示例3: lsCheckSession
public static function lsCheckSession($userid, $convid)
{
$chat_ended = time() + 600;
global $lsdb;
$result = $lsdb->query('SELECT id FROM ' . DB_PREFIX . 'sessions WHERE userid = "' . smartsql($userid) . '" AND id = "' . smartsql($convid) . '" AND ended <= ' . $chat_ended . ' LIMIT 1');
if ($lsdb->affected_rows == 0) {
return true;
}
}
示例4: filter_var
responses = ' . $defaults['ls_responses'] . ',
files = ' . $defaults['ls_files'] . ',
operatorchat = ' . $defaults['ls_chat'] . ',
operatorlist = ' . $defaults['ls_chatlist'] . ',
sound = ' . $defaults['ls_sound'] . ',
ringing = ' . $defaults['ls_ringing'] . ',
emailnot = ' . $defaults['ls_emailnot'] . ',
language = "' . $defaults['ls_lang'] . '",
invitationmsg = "' . $defaults['ls_inv'] . '",
' . $insert . '
email = "' . filter_var($defaults['ls_email'], FILTER_SANITIZE_EMAIL) . '"
WHERE id = ' . $page2);
} else {
$result = $lsdb->query('UPDATE ' . $lstable . ' SET
username = "' . smartsql(trim($defaults['ls_username'])) . '",
name = "' . smartsql(trim($defaults['ls_name'])) . '",
language = "' . $defaults['ls_lang'] . '",
invitationmsg = "' . $defaults['ls_inv'] . '",
tw_days = "' . $tw_days . '",
tw_time_from = "' . $defaults['jak_timefrom'] . ':' . $defaults['jak_timefromm'] . ':00",
tw_time_to = "' . $defaults['jak_timeto'] . ':' . $defaults['jak_timetom'] . ':00",
phonenumber = "' . $defaults['ls_phone'] . '",
dnotify = "' . $defaults['ls_dnotify'] . '",
sound = ' . $defaults['ls_sound'] . ',
ringing = ' . $defaults['ls_ringing'] . ',
' . $insert . '
email = "' . filter_var($defaults['ls_email'], FILTER_SANITIZE_EMAIL) . '"
WHERE id = ' . $page2);
}
if (!$result) {
ls_redirect(BASE_URL . 'index.php?p=error&sp=mysql');
示例5: session_start
<?php
/*======================================================================*\
|| #################################################################### ||
|| # Rhino 2.5 # ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright 2014 Rhino All Rights Reserved. # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- Rhino IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.livesupportrhino.com # ||
|| #################################################################### ||
\*======================================================================*/
// Start the session
session_start();
if (!file_exists('../../config.php')) {
die('ajax/[response.php] config.php not exist');
}
require_once '../../config.php';
if (!$_SERVER['HTTP_X_REQUESTED_WITH'] && !isset($_SESSION['idhash'])) {
die("Nothing to see here");
}
if (!is_numeric($_POST['id'])) {
die("There is no such message!");
}
$result = $lsdb->query('SELECT message FROM ' . DB_PREFIX . 'jrc_responses WHERE id = "' . smartsql($_POST['id']) . '"');
if ($lsdb->affected_rows > 0) {
$row = $result->fetch_assoc();
echo json_encode(array('status' => 1, "html" => $row['message']));
}
示例6: process
protected function process($user, $message)
{
global $socket_url;
global $final_url;
global $lsdb;
// What we have to do
$obj = json_decode($message, true);
if ($obj['user_area'] == 'admin') {
$result = $lsdb->query('SELECT id FROM ' . DB_PREFIX . 'user WHERE idhash = "' . smartsql($obj['ohash']) . '"');
if ($lsdb->affected_rows == 1) {
$row = $result->fetch_assoc();
if (!is_numeric($obj['uid'])) {
$obj['uid'] = $row['id'];
}
if ($obj['oplang'] && file_exists($final_url . 'operator/lang/' . $obj['oplang'] . '.ini')) {
$tl = parse_ini_file($final_url . 'operator/lang/' . $obj['oplang'] . '.ini', true);
} elseif (!$BT_LANGUAGE && file_exists($final_url . 'lang/' . LS_LANG . '.ini')) {
$tl = parse_ini_file($final_url . 'operator/lang/' . LS_LANG . '.ini', true);
} else {
$tl = parse_ini_file($final_url . 'operator/lang/en.ini', true);
}
// Get the special lang var once for the time
define('LS_DAY', $tl['general']['g74']);
define('LS_HOUR', $tl['general']['g75']);
define('LS_MINUTE', $tl['general']['g76']);
define('LS_MULTITIME', $tl['general']['g77']);
define('LS_AGO', $tl['general']['g78']);
switch ($obj['job']) {
case 'check_status':
// Now only get the department for the user
if ($obj['odep'] && is_numeric($obj['odep'])) {
$sqluo = ' AND depid = ' . smartsql($obj['odep']);
$sqlw = 'department = ' . smartsql($obj['odep']) . ' AND status = 1 AND operatorid = 0 OR ';
$sqlwc = 't1.department = ' . smartsql($obj['odep']) . ' AND t1.status = 1 AND t1.operatorid = 0 OR ';
}
if ($obj['odep']) {
$sqluo = ' AND depid IN(' . smartsql($obj['odep']) . ')';
$sqlw = 'department IN(' . smartsql($obj['odep']) . ') AND status = 1 AND operatorid = 0 OR ';
$sqlwc = 't1.department IN(' . smartsql($obj['odep']) . ') AND t1.status = 1 AND t1.operatorid = 0 OR ';
}
if ($obj['odep'] == 0) {
$sqluo = ' AND depid >= 0';
$sqlw = 'department >= 0 AND status = 1 AND operatorid = 0 OR ';
$sqlwc = 't1.department >= 0 AND t1.status = 1 AND t1.operatorid = 0 OR ';
}
$useronline = false;
if ($obj['advanceduo']) {
$result = $lsdb->query('SELECT t1.id, t1.referrer, t1.firstreferrer, t1.agent, t1.hits, t1.ip, t1.lasttime, t1.time, t1.proactive, t1.readtime, t2.initiated, t2.ended FROM ' . DB_PREFIX . 'buttonstats AS t1 LEFT JOIN ' . DB_PREFIX . 'sessions AS t2 ON (t1.session = t2.session) WHERE t1.lasttime > (NOW() - INTERVAL 5 MINUTE)' . $sqluo . ' AND (opid = 0 OR opid = "' . smartsql($obj['uid']) . '") GROUP BY t1.session ORDER BY t1.lasttime DESC LIMIT 50');
if ($lsdb->affected_rows > 0) {
$useronline = '<table class="table table-striped"><thead><th>' . $tl["general"]["g169"] . '</th><th>' . $tl["general"]["g170"] . '</th><th>' . $tl["general"]["g171"] . '</th><th>' . $tl["general"]["g172"] . '</th><th>' . $tl["general"]["g11"] . '</th><th>' . $tl["general"]["g173"] . '</th><th>' . $tl["general"]["g174"] . '</th></thead>';
while ($row = $result->fetch_assoc()) {
// Convert time to minutes and hours
$row['lasttime'] = LS_base::lsTimesince($row['lasttime'], LS_DATEFORMAT, LS_TIMEFORMAT);
$row['time'] = LS_base::lsTimesince($row['time'], LS_DATEFORMAT, LS_TIMEFORMAT);
if ($row['proactive'] != 0) {
$icon = '<span class="glyphicon glyphicon-bell"></span>';
$uclass = ' class="warning"';
} else {
$icon = '<span class="glyphicon glyphicon-user"></span>';
$uclass = '';
}
$button = '<a href="javascript:void(0)" id="usero-' . $row['id'] . '" class="btn btn-default btn-xs rhino-online-user">' . $icon . '</a>';
if ($row['readtime'] == 1) {
$uclass = ' class="danger"';
}
if ($row['readtime'] == 2) {
$uclass = ' class="success"';
}
if ($row['initiated'] && $row['ended'] == 0) {
$button = '<span class="glyphicon glyphicon-comment"></span>';
}
$useronline .= '<tr' . $uclass . '><td>' . $row['referrer'] . '</td><td>' . $row['firstreferrer'] . '</td><td>' . $row['agent'] . '</td><td>' . $row['hits'] . '</td><td>' . $row['ip'] . '</td><td>' . $row['time'] . '</td><td>' . $row['lasttime'] . '</td><td>' . $button . '</td></tr>';
}
$useronline .= '</table>';
}
} else {
$result = $lsdb->query('SELECT t1.id, t1.referrer, t1.proactive, t1.readtime, t1.agent, t1.ip, t2.initiated, t2.ended FROM ' . DB_PREFIX . 'buttonstats t1 LEFT JOIN ' . DB_PREFIX . 'sessions AS t2 ON (t1.session = t2.session) WHERE t1.lasttime > (NOW() - INTERVAL 5 MINUTE)' . $sqluo . ' AND (opid = 0 OR opid = "' . smartsql($obj['uid']) . '") GROUP BY t1.session ORDER BY t1.lasttime DESC LIMIT 5');
if ($lsdb->affected_rows > 0) {
$useronline = '<ul class="list-group">';
while ($row = $result->fetch_assoc()) {
if ($row['proactive'] != 0) {
$icon = '<span class="glyphicon glyphicon-bell"></span>';
$uclass = ' list-group-item-warning';
} else {
$icon = '<span class="glyphicon glyphicon-user"></span>';
$uclass = '';
}
$button = '<div class="pull-right"><a href="javascript:void(0)" id="usero-' . $row['id'] . '" class="btn btn-default btn-xs rhino-online-user" title="' . $row['agent'] . '/' . $row['ip'] . '">' . $icon . '</a></div>';
if ($row['readtime'] == 1) {
$uclass = ' list-group-item-danger';
}
if ($row['readtime'] == 2) {
$uclass = ' list-group-item-success';
}
if ($row['initiated'] && $row['ended'] == 0) {
$button = '<div class="pull-right"><a href="javascript:void(0)" class="btn btn-info btn-xs"><span class="glyphicon glyphicon-comment"></span></a></div>';
}
$useronline .= '<li class="list-group-item' . $uclass . '" title="' . $row['referrer'] . '">' . ls_cut_text($row["referrer"], 35, '...') . $button . '</li>';
}
$useronline .= '</ul>';
//.........这里部分代码省略.........
示例7: die
<?php
/*======================================================================*\
|| #################################################################### ||
|| # Rhino Socket 2.0 # ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright 2014 Rhino All Rights Reserved. # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- Rhino IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.livesupportrhino.com # ||
|| #################################################################### ||
\*======================================================================*/
if (!file_exists('../../config.php')) {
die('ajax/[available.php] config.php not exist');
}
require_once '../../config.php';
if (!$_SERVER['HTTP_X_REQUESTED_WITH'] && !isset($_SESSION['lc_idhash'])) {
die("Nothing to see here");
}
if (!is_numeric($_POST['id'])) {
die("There is no such user!");
}
$result = $lsdb->query('UPDATE ' . DB_PREFIX . 'user SET lastactivity = "' . time() . '" WHERE id = "' . smartsql($_POST['id']) . '"');
示例8: session_start
session_start();
if (!file_exists('../config.php')) {
die('ajax/[retrieve.php] config.php not exist');
}
require_once '../config.php';
// Import the language file
if (file_exists(APP_PATH . 'lang/' . LS_LANG . '.ini')) {
$tl = parse_ini_file(APP_PATH . 'lang/' . LS_LANG . '.ini', true);
} else {
$tl = parse_ini_file(APP_PATH . 'lang/en.ini', true);
}
// Get the special lang var once for the time
define('LS_DAY', $tl['general']['g17']);
define('LS_HOUR', $tl['general']['g18']);
define('LS_MINUTE', $tl['general']['g19']);
define('LS_MULTITIME', $tl['general']['g20']);
define('LS_AGO', $tl['general']['g21']);
if (!$_SERVER['HTTP_X_REQUESTED_WITH'] || !isset($_SESSION['jrc_userid'])) {
die(json_encode(array("status" => 0, "html" => "")));
}
if (is_numeric($_POST['id']) && $_SESSION['jrc_userid'] == $_POST['userid']) {
$result = $lsdb->query('SELECT * FROM ' . DB_PREFIX . 'jrc_transcript WHERE convid = "' . smartsql($_POST['id']) . '" ORDER BY time ASC');
if ($lsdb->affected_rows > 0) {
$chat = '<ul>';
while ($row = $result->fetch_assoc()) {
$chat .= '<li class="' . $row['class'] . '"><span class="response_sum">' . LS_base::lsTimesince($row['time'], LS_DATEFORMAT, LS_TIMEFORMAT) . ' ' . $row['name'] . ' ' . $tl['general']['g14'] . ' :</span><br />' . stripcslashes($row['message']) . '</li>';
}
$chat .= "</ul>";
echo json_encode(array("status" => 1, "html" => $chat));
}
}
示例9: ls_redirect
$result = $lsdb->query($sql);
}
if (!$result) {
ls_redirect(BASE_URL . 'index.php?p=error&sp=mysql');
} else {
ls_redirect(BASE_URL . 'index.php?p=success');
}
}
if (isset($defaults['search'])) {
if (strlen($defaults['jakSH']) < 3) {
$errors['e'] = $tl['search']['s'];
}
if (count($errors) > 0) {
$errors = $errors;
} else {
$searchword = smartsql(strip_tags($defaults['jakSH']));
if (!ls_get_access("leads_all", $lsuser->getVar("permissions"), LS_SUPERADMINACCESS)) {
$sqlw = 't1.operatorid = "' . LS_USERID_RHINO . '" AND ';
}
// The Query
$result = $lsdb->query('SELECT t1.id, t1.operatorname as username, t1.name, t1.email, t1.department, t1.operatorid, t1.ip, t1.initiated, t1.fcontact, t1.notes, t1.countrycode, t1.country, t1.city, t3.title FROM ' . $lstable . ' AS t1 LEFT JOIN ' . $lstable1 . ' AS t2 ON (t1.id = t2.convid) LEFT JOIN ' . DB_PREFIX . 'departments AS t3 ON (t1.department = t3.id) WHERE ' . $sqlw . '(t1.name like "%' . $searchword . '%" OR t1.email like "%' . $searchword . '%" OR t2.message like "%' . $searchword . '%") GROUP BY t1.id ORDER BY t1.initiated DESC LIMIT 10');
while ($row = $result->fetch_assoc()) {
$allLeads[] = $row;
}
// Ouput all leads, well with paginate of course
if (is_array($allLeads)) {
$LEADS_ALL = $allLeads;
$searchstatus = true;
} else {
$errors['e1'] = $tl['search']['s2'];
$errors = $errors;
示例10: smartsql
break;
default:
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$defaults = $_POST;
if (isset($_POST['insert_department'])) {
if (empty($defaults['title'])) {
$errors['e'] = $tl['error']['e2'];
}
if ($defaults['email'] != '' && !filter_var($defaults['email'], FILTER_VALIDATE_EMAIL)) {
$errors['e1'] = $tl['error']['e3'];
}
if (count($errors) == 0) {
$result = $lsdb->query('INSERT INTO ' . $lstable . ' SET
title = "' . smartsql($defaults['title']) . '",
description = "' . smartsql($defaults['description']) . '",
email = "' . smartsql($defaults['email']) . '",
dorder = 2,
time = NOW()');
if (!$result) {
ls_redirect(BASE_URL . 'index.php?p=error&sp=mysql');
} else {
// Now let us delete the define cache file
$cachestufffile = '../' . LS_CACHE_DIRECTORY . '/stuff.php';
if (file_exists($cachestufffile)) {
unlink($cachestufffile);
}
ls_redirect(BASE_URL . 'index.php?p=success');
}
// Output the errors
} else {
$errors = $errors;
示例11: die
if (!file_exists('../../config.php')) {
die('ajax/[available.php] config.php not exist');
}
require_once '../../config.php';
if (!$_SERVER['HTTP_X_REQUESTED_WITH'] && !isset($_SESSION['idhash'])) {
die("Nothing to see here");
}
if (file_exists(APP_PATH . 'operator/lang/' . LS_LANG . '.ini')) {
$tl = parse_ini_file(APP_PATH . 'operator/lang/' . LS_LANG . '.ini', true);
} else {
trigger_error('Translation file not found');
}
if (!is_numeric($_POST['id'])) {
die(json_encode(array('status' => 1, "html" => $tl['general']['g79'])));
}
$result = $lsdb->query('SELECT name, email, convid, initiated FROM ' . DB_PREFIX . 'jrc_sessions WHERE convID = "' . smartsql($_POST['id']) . '"');
if ($lsdb->affected_rows > 0) {
$row = $result->fetch_assoc();
$ts = $row['initiated'];
$ts = strftime("%X %P", $ts);
$userinfo = '<table class="table table-bordered">
<tr>
<th>' . $tl['user']['u'] . '</th>
<th>' . $tl['user']['u1'] . '</th>
<th>' . $tl['general']['g61'] . '</th>
</tr><tr>
<td>' . $row['name'] . '</td>
<td>' . $row['email'] . '</td>
<td><a data-toggle="modal" href="ajax/delconv.php?id=' . $row['convid'] . '" data-target="#inchatModal">' . $tl['general']['g62'] . '</a></td>
</tr>
</table>';
示例12: smartsql
message = "' . smartsql($message) . '",
user = "' . smartsql($_POST['userid']) . '",
convid = "' . smartsql($_POST['conv']) . '",
time = NOW(),
class = "user"');
$lsdb->query('UPDATE ' . DB_PREFIX . 'sessions SET
updated = "' . time() . '",
ended = 0,
status = 1,
u_typing = 0
WHERE userid = "' . smartsql($_POST['userid']) . '"');
die(json_encode(array("status" => 1, "html" => '<li class="list-group-item user"><span class="response_sum">' . LS_base::lsTimesince(time(), LS_DATEFORMAT, LS_TIMEFORMAT) . ' ' . $_POST['name'] . ' ' . $tl['general']['g14'] . ' :</span><br />' . stripcslashes($message) . '</li>')));
} elseif (!$row['status']) {
$lsdb->query('INSERT INTO ' . DB_PREFIX . 'transcript SET
name = "' . smartsql($_POST['name']) . '",
message = "' . smartsql($tl['general']['g13']) . '",
user = "' . smartsql($_POST['userid']) . '",
convid = "' . smartsql($_POST['conv']) . '",
time = NOW(),
class = "notice"');
$lsdb->query('UPDATE ' . DB_PREFIX . 'sessions SET
updated = "' . time() . '",
ended = 0,
u_typing = 0
WHERE userid = "' . smartsql($_POST['userid']) . '"');
die(json_encode(array("status" => 1, "html" => '<li class="list-group-item notice"><span class="response_sum">' . LS_base::lsTimesince(time(), LS_DATEFORMAT, LS_TIMEFORMAT) . ' ' . $_POST['name'] . ' ' . $tl['general']['g14'] . ' :</span><br />' . stripcslashes($tl['general']['g13']) . '</li>')));
} else {
die(json_encode(array("status" => 0, "html" => $tl['error']['e2'])));
}
}
}
示例13: die
}
if (!is_numeric($_GET['id'])) {
die("There is no such user!");
}
$sqlw = '';
// Now only get the department for the user
if ($_SESSION['usr_department'] && is_numeric($_SESSION['usr_department'])) {
$sqlw = 'department = ' . smartsql($_SESSION['usr_department']) . ' AND status = 1 AND operatorid = 0 OR ';
}
if ($_SESSION['usr_department']) {
$sqlw = 'department IN(' . smartsql($_SESSION['usr_department']) . ') AND status = 1 AND operatorid = 0 OR ';
}
if ($_SESSION['usr_department'] == 0) {
$sqlw = 'department >= 0 AND status = 1 AND operatorid = 0 OR ';
}
$result = $lsdb->query('SELECT id, operatorid, answered, updated, transferid, transfermsg FROM ' . DB_PREFIX . 'sessions WHERE ' . $sqlw . 'operatorid = ' . smartsql($_GET['id']) . ' AND status = 1 OR department = 0 AND status = 1 AND operatorid = 0 OR transferid = ' . smartsql($_GET['id']) . ' AND status = 1');
if ($lsdb->affected_rows > 0) {
while ($row = $result->fetch_assoc()) {
// We have a transfer, need to display it!
if ($row['transferid'] == $_GET['id']) {
if ($row["transfermsg"]) {
$split_transfer_msg = explode(':#:', $row["transfermsg"]);
}
// Display underneath the button
$transfer_msg = '<p>' . $split_transfer_msg[1] . ' <a href="javascript:void(0)" onclick="acceptTransfer(0, ' . $row['transferid'] . ', ' . $row['id'] . ');"><span class="glyphicon glyphicon-remove"></span></a> <a href="javascript:void(0)" onclick="acceptTransfer(1, ' . $row['transferid'] . ', ' . $row['id'] . ');"><span class="glyphicon glyphicon-ok"></span></a></p>';
$transferid = $row['transferid'];
}
$newConv = 0;
// check for new conversations
if ($row['operatorid'] == 0) {
$newConv = 1;
示例14: lsWriteloginlog
public static function lsWriteloginlog($username, $url, $ip, $agent, $success)
{
global $lsdb;
if ($success == 1) {
$lsdb->query('UPDATE ' . DB_PREFIX . 'loginlog SET access = 1 WHERE ip = "' . smartsql($ip) . '" AND time = NOW()');
} else {
$lsdb->query('INSERT INTO ' . DB_PREFIX . 'loginlog SET name = "' . smartsql($username) . '", fromwhere = "' . smartsql($url) . '", ip = "' . smartsql($ip) . '", usragent = "' . smartsql($agent) . '", time = NOW(), access = 0');
}
}
示例15: smartsql
}
// add entry to sql
$result = $lsdb->query('INSERT INTO ' . DB_PREFIX . 'jrc_sessions SET
userid = "' . smartsql($userid) . '",
name = "' . smartsql($_SESSION['jrc_name']) . '",
email = "' . smartsql($_SESSION['guest_email']) . '",
initiated = "' . time() . '",
status = 1,
contact = ' . $contactme);
if ($result) {
$cid = $lsdb->ls_last_id();
$_SESSION['jrc_convid'] = $cid;
$lsdb->query('UPDATE ' . DB_PREFIX . 'jrc_sessions SET convid = "' . $cid . '" WHERE userid = "' . smartsql($_SESSION['jrc_userid']) . '"');
$lsdb->query('INSERT INTO ' . DB_PREFIX . 'jrc_transcript SET
name = "Admin",
message = "' . smartsql(LS_WELCOME_MESSAGE) . '",
convid = "' . $cid . '",
time = NOW(),
class = "admin"');
}
// Redirect page
$gochat = LS_rewrite::lsParseurl('chat', '', '', '', '');
/* Outputtng the error messages */
if ($_SERVER['HTTP_X_REQUESTED_WITH']) {
header('Cache-Control: no-cache');
echo json_encode(array('login' => 1, 'link' => $gochat));
exit;
}
ls_redirect($gochat);
}
}