本文整理汇总了PHP中mq函数的典型用法代码示例。如果您正苦于以下问题:PHP mq函数的具体用法?PHP mq怎么用?PHP mq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mq函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: booklog
function booklog($book, $type, $message)
{
global $abltype;
if (!isset($abltype[$type])) {
echo "ERROR: booklog called with bad type:{$type} ({$message})\n";
} else {
mq("INSERT INTO booklog SET book='" . intval($book) . "', type='" . intval($type) . "', message='" . addslashes($message) . "';");
}
}
示例2: chdir
<?php
chdir('../../../../');
require 'db.php';
$user_id = mysql_real_escape_string($_POST['user_id']);
$points = floatval(mysql_result(mq(totalMarks("WHERE user_id = {$user_id}")), 0));
//echo $points; exit;
$sql = "select user_code from users where user_id = " . $user_id;
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$points += @reset(header_store_points(array("user_code" => $row['user_code'])));
echo $points;
示例3: addslashes
<?php
require "../system/incl.php";
if (isset($_GET['del'])) {
$del = addslashes($_GET['del']);
$q = "SELECT * FROM `group2category` WHERE `id_category`='{$del}'";
$res = mq($q);
if (mysql_num_rows($res) > 0) {
$error = array("Невозможно удалить выбранную категорию, так как существуют группы, связанные с ней.");
$smarty->assign("errors", $error);
} else {
$q = "DELETE FROM `category` WHERE `id`='{$del}'";
mq($q);
$smarty->assign("message", "Удалено!");
}
}
$q = "SELECT * FROM `category` ORDER BY `weight`, `name_ru`";
$res = mq($q);
$data = array();
if (mysql_num_rows($res) > 0) {
while ($info = mysql_fetch_array($res)) {
$data[] = $info;
}
}
if (count($data) > 0) {
$smarty->assign("data", $data);
} else {
$smarty->assign("nodata", true);
}
$smarty->display("adm_category_list.tpl");
示例4: array
}
}
// Now we store the attributes :
$attr["fnac"] = array("url" => $book[0]);
if ($isbn) {
$attr["isbn"] = $isbn;
}
if ($image) {
$attr["fnac"]["image"] = $image;
$store = md5($image) . ".jpg";
curl_simple_get($image, IMAGE_ROOT . "/" . $store);
if (@filesize(IMAGE_ROOT . "/" . $store)) {
$attr["fnac"]["imageurl"] = $store;
}
}
if ($isbn) {
$attr["isbn"] = $isbn;
}
if ($already) {
$sql = "";
if (!$already["authors"]) {
$sql .= " , authors='" . addslashes($author) . "' ";
}
mq("UPDATE books SET collection=6, title='" . addslashes($book[1]) . "', isbn='{$isbn}', attribs='" . addslashes(json_encode($attr)) . "' {$sql} WHERE id=" . $already["id"] . ";");
echo "Update book " . $already["id"] . "\n";
} else {
mq("INSERT INTO books SET datecreated=NOW(), collection=6, title='" . addslashes($book[1]) . "', authors='" . addslashes($author) . "', isbn='{$isbn}', attribs='" . addslashes(json_encode($attr)) . "';");
echo "Created book " . mysql_insert_id() . "\n";
}
}
// for each book
示例5: array
$attr["formats"][$aformat[$action]] = array("name" => $id, "size" => filesize(UPLOAD_ROOT . "/" . $id), "othercollection" => $oc);
mq("UPDATE books SET dateuploaded=NOW(), downloadable=1, attribs='" . addslashes(json_encode($attr)) . "' WHERE id=" . $book["id"] . ";");
$_REQUEST["msg"] = _("The upload has been validated");
break;
case 99:
mq("UPDATE uploads SET datemoderated=NOW(), status=" . $action . " WHERE id=" . $id . ";");
$_REQUEST["msg"] = _("The upload has been trashed");
break;
}
}
require_once "head.php";
require_once "menu.php";
require "messagebox.php";
$offset = 0;
$count = 100;
$r = mq("SELECT uploads.*, books.title, books.authors FROM uploads, books WHERE uploads.status=0 AND books.id=uploads.book_id ORDER BY uploads.id LIMIT {$offset},{$count};");
echo mysql_error();
?>
<div class="container-fluid main">
<div class="row">
<div class="span12">
<div style="float: right; padding: 10px;">
<a href="https://fr.wikipedia.org/wiki/Domaine_public_%28propri%C3%A9t%C3%A9_intellectuelle%29"><img src="/assets/img/pd.png"/></a>
</div>
<h1><?php
__("Uploaded files moderation");
?>
</h1>
示例6: mq
<?php
require_once "lib/ssl.php";
function mq($x)
{
if (get_magic_quotes_gpc()) {
return stripslashes($x);
} else {
return $x;
}
}
$keysize = mq($_REQUEST['keysize']);
$passphrase = mq($_REQUEST['passphrase']);
?>
<html>
<head>
<title>Public Key Forge</title>
</head>
<body>
<?php
if ($keysize && is_numeric($keysize)) {
$ssl = new ssl();
$privkey = $ssl->make_privkey($keysize, $passphrase);
$pubkey = $ssl->privkey_to_pubkey($privkey, $passphrase);
$id = $ssl->pubkey_id($pubkey);
echo "ID: {$id}<br>\n";
echo "<pre>\n{$pubkey}</pre>\n";
echo "<pre>\n{$privkey}</pre>\n";
}
if (!$keysize || !is_numeric($keysize)) {
$keysize = 512;
示例7: ChangeDisplayName
function ChangeDisplayName($uid = 0, $dname = '')
{
global $handler;
$dname = mq($dname);
count_mysql_query("UPDATE uo_chat_database SET displayname={$dname} WHERE uid={$uid}", $handler, "helpers.php: ChangeDisplayName() 1/1");
}
示例8: rand
$cat2 = rand(0, count($c) - 1);
} while (in_array($cat2, $cat));
$cat[] = $cat2;
}
if (count($c) > 2) {
do {
$cat2 = rand(0, count($c) - 1);
} while (in_array($cat2, $cat));
$cat[] = $cat2;
}
foreach ($cat as $cc) {
$catalog[] = $c[$cc];
}
}
}
$r = mq("SELECT books.*, uploads.id AS uid FROM books LEFT JOIN uploads ON uploads.book_id=books.id AND uploads.status=0 WHERE 1 {$sql} ORDER BY downloadable DESC, title ASC LIMIT {$offset},{$count};");
echo mysql_error();
// TODO : start by a list of (bigger cover) "latest uploaded books" (+ their upload date)
?>
<div class="container-fluid main">
<div class="row">
<div class="span12">
<?php
if (count($catalog)) {
?>
<p><?php
__("Among the latest books we received, we recommend:");
?>
示例9: __
<input type="button" name="cancel" value="<?php
__("Cancel");
?>
" onclick="document.location='/accounts.php'" />
</div>
</form>
<?php
break;
// ACTION EDIT / CREATE
// ACTION EDIT / CREATE
case "delete":
break;
// ACTION DELETE
// ACTION DELETE
default:
$r = mq("SELECT * FROM users ORDER BY login;");
?>
<p>
<a class="btn" href="/accounts.php?action=create"><?php
__("Create new account");
?>
</a>
</p>
<table class="matable">
<tr>
<th><?php
__("Edit");
?>
</th>
示例10: feedback2Action
function feedback2Action()
{
global $view, $params;
// Check the campaign
if (!isset($params[0])) {
not_found();
}
$slug = addslashes(trim($params[0]));
$view["campaign"] = $this->_getCampaign($slug);
// Exit in case of error
// Check the call :
if (!isset($params[1])) {
not_found();
}
$view["callid"] = $cid = intval($params[1]);
$call = mqone("SELECT * FROM calls WHERE id='" . $view["callid"] . "';");
$callee = mqone("SELECT * FROM lists WHERE phone='(" . $call["callee"] . ")';");
if ($call["feedback"]) {
$view["error"] = _("A feedback has already been given for that call, sorry");
$this->call2Action();
exit;
}
mq("UPDATE calls SET feedback='" . addslashes($_REQUEST["feedback"]) . "' WHERE id='" . $view["callid"] . "';");
mq("UPDATE lists SET callcount=callcount+1 WHERE id='" . $callee["id"] . "');");
$view["message"] = _("Your feedback has been sent to us, thanks for your participation! CALLID:");
render("campaigncall2");
}
示例11: __
<input type="button" name="cancel" value="<?php
__("Cancel");
?>
" onclick="document.location='/collections.php'" />
</div>
</form>
<?php
break;
// ACTION EDIT / CREATE
// ACTION EDIT / CREATE
case "delete":
break;
// ACTION DELETE
// ACTION DELETE
default:
$r = mq("SELECT c.id,c.name,count(b.id) AS books FROM collections c LEFT JOIN books b ON b.collection=c.id GROUP BY c.id ORDER BY c.name;");
?>
<p>
<a class="btn" href="/collections.php?action=create"><?php
__("Create new collection");
?>
</a>
</p>
<table class="matable">
<tr>
<th><?php
__("Edit");
?>
</th>
<th><?php
示例12: getCategoryInfoById
function getCategoryInfoById($id)
{
$q = "SELECT * FROM `category` WHERE id={$id}";
$info = mysql_fetch_array(mq($q));
return localizeObject($info);
}
示例13: addslashes
}
if (isset($_GET['id'])) {
$id = addslashes($_GET['id']);
$q = "SELECT * FROM `{$table}` WHERE id={$id}";
$res = mq($q);
$data = mysql_fetch_array($res);
$data['filesize'] = (int) (filesize("../" . $data['file']) / 1024 + 0.5);
if (isset($_GET['delfile'])) {
$q = "UPDATE `{$table}` SET `file`='', `filename`='' WHERE `id`='{$id}'";
mq($q);
if (is_file("../" . $data['file'])) {
unlink("../" . $data['file']);
}
unset($data['file']);
$smarty->assign("message", "Файловое вложение удалено!");
}
$smarty->assign("data", $data);
$edit = true;
}
$res = mq("SELECT * FROM `page_type` ORDER BY `name_ru`");
$page_type = array();
while ($info = mysql_fetch_array($res)) {
$page_type[] = $info;
}
$smarty->assign("page_type", $page_type);
if ($edit) {
$smarty->assign("page_title", "Редактировать материал");
} else {
$smarty->assign("page_title", "Новый материал");
}
$smarty->display("adm_page_edit.tpl");
示例14: chdir
<?php
chdir('../../../');
require 'db.php';
$file = $_FILES['image'];
if (is_uploaded_file($file['tmp_name'])) {
$count = 0;
do {
if ($count++ > 100000) {
echo 'Could not get ID.';
exit;
}
$id = mysql_result(mysql_query('SELECT FLOOR(RAND() * 4294967295)'), 0);
} while (mysql_result(mysql_query("SELECT COUNT(*) FROM files WHERE file_id = {$id}"), 0) != 0);
mq("INSERT INTO files (file_id, file_name, file_content_type, file_data) VALUES ({$id}, " . ms($file['name']) . ', ' . ms(mime_content_type($file['tmp_name'])) . ', ' . ms(file_get_contents($file['tmp_name'])) . ')');
echo $id;
} else {
echo 0;
}
示例15: ChangePrefs
function ChangePrefs($username, $password, $newpref, $nmail, $chatpath, $icq, $aim, $ym, $msn, $site, $skype = '', $lastfm = '', $flickr = '', $dname = '', $facebook = '', $gplus = '', $steam = '')
{
global $handler;
if (VerifyLogin($username, $password, $chatpath)) {
$newpref = mq($newpref);
$nmail = mq($nmail);
$icq = intval($icq);
$aim = mq($aim);
$ym = mq($ym);
$msn = mq($msn);
$site = mq($site);
$skype = mq($skype);
$lastfm = mq($lastfm);
$flickr = mq($flickr);
$dname = mq($dname);
$facebook = mq($facebook);
$gplus = mq($gplus);
$steam = mq($steam);
@count_mysql_query("UPDATE uo_chat_database SET prefs={$newpref}, email={$nmail}, icq={$icq}, aim={$aim},\n\t\t\tym={$ym}, msn={$msn}, site={$site}, skype={$skype}, lastfm={$lastfm}, flickr={$flickr}, displayname={$dname},\n\t\t\tfacebook={$facebook}, gplus={$gplus}, steam={$steam}\n\t\t\tWHERE chat='{$chatpath}' AND username='{$username}' AND dtime IS NULL", $handler);
echo "<p>Preferences for '{$username}' set to {$newpref}, {$nmail}, {$icq}, {$aim}, {$ym}, {$msn}, {$skype}, {$lastfm}, {$flickr}, {$facebook}, {$gplus}, {$steam}, {$dname}.<br>";
return 1;
}
return 0;
}