本文整理汇总了PHP中dbquery函数的典型用法代码示例。如果您正苦于以下问题:PHP dbquery函数的具体用法?PHP dbquery怎么用?PHP dbquery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbquery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFontFamily
function getFontFamily($font)
{
$query = "SELECT * FROM fonts WHERE name='{$font}' LIMIT 1";
$result = dbquery($query);
$assoc = mysql_fetch_assoc($result);
return $assoc["family"];
}
示例2: panels_list
function panels_list($panel_id = NULL)
{
$panel_list = "";
$result = dbquery("SELECT panel_id, panel_filename FROM " . DB_PANELS . " ORDER BY panel_id");
while ($data = dbarray($result)) {
$panels[] = $data['panel_filename'];
}
$temp = opendir(INFUSIONS);
while ($folder = readdir($temp)) {
if (!in_array($folder, array(".", "..")) && strstr($folder, "_panel")) {
if (is_dir(INFUSIONS . $folder)) {
if (!in_array($folder, $panels)) {
$panel_list[] = ucwords(str_replace('_', ' ', $folder));
}
}
}
}
closedir($temp);
if ($panel_list > 0) {
if (count($panel_list)) {
sort($panel_list);
}
if ($panel_id != NULL) {
$panel_name = $panel_list[$panel_id];
return $panel_name;
} else {
return $panel_list;
}
}
}
示例3: DoTask
function DoTask()
{
global $GAME;
if ($GAME['MyColour'] == 50) {
$mypage = page::standard();
$mypage->title_body('Not playing in this game');
$mypage->leaf('p', 'You are not currently playing in this game, so unfortunately you cannot save notes on it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
$mypage->finish();
}
$EscapedNotes = sanitise_str_fancy(@$_POST['GameNotes'], 1, 25000, STR_GPC | STR_ESCAPE_HTML);
if ($EscapedNotes[1] == 1) {
$mypage = page::standard();
$mypage->title_body('Notes too long');
$mypage->leaf('p', 'The notes you entered are too long. The limit is around 25, 000 characters (proviso: depending on the content you enter, the number of characters after the content is processed may vary slightly from that before). Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page. Here are the notes you entered:');
$mypage->leaf('textarea', $EscapedNotes[0], 'cols=80 rows=20');
$mypage->finish();
}
if ($EscapedNotes[1] == -1) {
dbquery(DBQUERY_WRITE, 'DELETE FROM "PlayerGameNotes" WHERE "Game" = :game: AND "User" = :user:', 'game', $GAME['GameID'], 'user', $GAME['PlayerUserID'][$GAME['MyColour']]);
} else {
dbquery(DBQUERY_WRITE, 'REPLACE INTO "PlayerGameNotes" ("Game", "User", "Notes") VALUES (:game:, :user:, :notes:)', 'game', $GAME['GameID'], 'user', $GAME['PlayerUserID'][$GAME['MyColour']], 'notes', $EscapedNotes[0]);
}
dbquery(DBQUERY_COMMIT);
page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully saved notes.');
}
示例4: links
function links($cat = 0, $direction = "asc")
{
global $linksmessage, $prefix;
if ($direction != "asc" && $direction != "desc") {
$direction = "asc";
}
$out = "";
if ($cat) {
$query = "SELECT * FROM " . $prefix . "linkscat WHERE id=" . $cat . " ORDER BY nome";
} else {
$query = "SELECT * FROM " . $prefix . "linkscat ORDER BY nome";
}
if (!($cresult = dbquery($query))) {
die($linksmessage[4]);
}
$out .= "\n<div id=\"LNE_show\">\n";
while ($crow = fetch_array($cresult)) {
$out .= "<h3>" . decode($crow['descr']) . "</h3>\n";
$query = "SELECT * FROM " . $prefix . "links where hits=" . $crow[0] . " ORDER BY name " . $direction;
if (!($result = dbquery($query))) {
die($linksmessage[5]);
}
if (num_rows($result)) {
$out .= "<ul>\n";
while ($row = fetch_array($result)) {
$out .= "<li><a href=\"" . $row['link'] . "\" onclick=\"window.open(this.href,'_blank');return false;\">" . decode($row['name']) . "</a><div>" . decode($row['descr']) . "</div></li>\n";
}
$out .= "</ul>\n";
}
}
$out .= "</div>\n";
return $out;
}
示例5: sendemail_template
function sendemail_template($template_key, $subject, $message, $user, $receiver, $thread_url = "", $toemail, $sender = "", $fromemail = "")
{
global $settings;
$data = dbarray(dbquery("SELECT * FROM " . DB_EMAIL_TEMPLATES . " WHERE template_key='" . $template_key . "' LIMIT 1"));
$message_subject = $data['template_subject'];
$message_content = $data['template_content'];
$template_format = $data['template_format'];
$sender_name = $sender != "" ? $sender : $data['template_sender_name'];
$sender_email = $fromemail != "" ? $fromemail : $data['template_sender_email'];
$subject_search_replace = array("[SUBJECT]" => $subject, "[SITENAME]" => $settings['sitename'], "[SITEURL]" => $settings['siteurl'], "[USER]" => $user, "[SENDER]" => $sender_name, "[RECEIVER]" => $receiver);
$message_search_replace = array("[SUBJECT]" => $subject, "[SITENAME]" => $settings['sitename'], "[SITEURL]" => $settings['siteurl'], "[MESSAGE]" => $message, "[USER]" => $user, "[SENDER]" => $sender_name, "[RECEIVER]" => $receiver, "[THREAD_URL]" => $thread_url);
foreach ($subject_search_replace as $search => $replace) {
$message_subject = str_replace($search, $replace, $message_subject);
}
foreach ($message_search_replace as $search => $replace) {
$message_content = str_replace($search, $replace, $message_content);
}
if ($template_format == "html") {
$message_content = nl2br($message_content);
}
if (sendemail($receiver, $toemail, $sender_name, $sender_email, $message_subject, $message_content, $template_format)) {
return TRUE;
} else {
return FALSE;
}
}
示例6: report
/**
* Report a comment as a spam.
* @param string $comid Comment ID
* @param string $revid Revision ID of the comment
* @param integer $uid User ID of person who reported spam.
* @return integer Spam return ID
*/
public static function report($comid, $revid, $uid)
{
$sql = "Insert into comment_spam(sp_comid,sp_revid,sp_uid) values('$comid','$revid','$uid') returning sp_id";
$row=pg_fetch_row(dbquery($sql));
return $row[0];
}
示例7: breadcrumbs
function breadcrumbs($fid, $tid = null)
{
$title = getForumTitle($fid);
$temp_fid = $fid;
$breadcrumbs = [];
while (true) {
$res = dbquery("SELECT parent_id, main FROM forums\n WHERE fid=:fid", array("fid" => $temp_fid));
$pid = $res->fetch(PDO::FETCH_ASSOC);
if ($pid['main'] == 1) {
/*$cid = $pid['parent_id'];
$res = dbquery("SELECT title FROM categories
WHERE cid=:cid", array("cid"=>$cid));
$title = $res->fetch(PDO::FETCH_ASSOC);
$breadcrumbs[$cid] = $title;*/
break;
} else {
$temp_fid = $pid['parent_id'];
$breadcrumbs[$temp_fid] = getForumTitle($temp_fid);
}
}
echo "<div id='breadcrumbs'><a href='/'>Board index </a>";
foreach (array_reverse($breadcrumbs, true) as $temp_fid => $temp_title) {
echo ">> <a href='/?page=forum&fid={$temp_fid}'>{$temp_title} </a>";
}
echo ">> <a href='/?page=forum&fid={$fid}'>{$title} </a>";
if ($tid != null) {
$title = getTopicTitle($tid);
echo ">> <a href='/?page=thread&tid={$tid}'>{$title}</a></div>";
} else {
echo "</div>";
}
}
示例8: DoTask
function DoTask()
{
global $GAME;
if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement' or !$GAME['PlayersMissingThatMatter']) {
$mypage = page::standard();
$mypage->title_body('No replacements needed');
$mypage->leaf('p', 'No replacement players are needed for this game at the moment. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
$mypage->finish();
}
$mycol = dbquery(DBQUERY_READ_SINGLEROW, 'SELECT "Colour" FROM "ReplacementOffer" WHERE "Game" = :game: AND "User" = :user:', 'game', $GAME['GameID'], 'user', $_SESSION['MyUserID']);
if ($mycol === 'NONE') {
$mypage = page::standard();
$mypage->title_body('Not currently a candidate replacement');
$mypage->leaf('p', 'You are not currently a candidate replacement. You might be seeing this message because you clicked the button twice. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
$mypage->finish();
}
dbquery(DBQUERY_WRITE, 'DELETE FROM "ReplacementOffer" WHERE "Game" = :game: AND "User" = :user:', 'game', $GAME['GameID'], 'user', $_SESSION['MyUserID']);
if ($mycol['Colour'] == $GAME['PlayerToMove']) {
$GAME['AltGameTicker'] .= '8F' . callmovetimediff() . letter_end_number($_SESSION['MyUserID']) . letter_end_number($_SESSION['MyGenderCode']);
$GAME['GameTickerNames'] .= '|' . $_SESSION['MyUserName'];
dbformatgamedata();
} else {
dbquery(DBQUERY_COMMIT);
}
page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully withdrew request.');
}
示例9: showsublinks
function showsublinks($sep = "·", $class = "")
{
$sres = dbquery("SELECT link_window, link_visibility, link_url, link_name FROM " . DB_SITE_LINKS . "\n\t\tWHERE " . groupaccess('link_visibility') . " AND link_position>='2' AND link_url!='---' ORDER BY link_order ASC");
if (dbrows($sres)) {
$i = 0;
$res = "<ul>\n";
while ($sdata = dbarray($sres)) {
$link_target = $sdata['link_window'] == "1" ? " target='_blank'" : "";
$li_class = $i == 0 ? " class='first-link" . ($class ? " {$class}" : "") . "'" : ($class ? " class='{$class}'" : "");
if (strstr($sdata['link_url'], "http://") || strstr($sdata['link_url'], "https://")) {
$res .= "<li" . $li_class . ">" . $sep . "<a href='" . $sdata['link_url'] . "'{$link_target}><span>" . $sdata['link_name'] . "</span></a></li>\n";
} else {
$res .= "<li" . $li_class . ">" . $sep . "<a href='" . BASEDIR . $sdata['link_url'] . "'{$link_target}><span>" . $sdata['link_name'] . "</span></a></li>\n";
}
$i++;
}
if (iMEMBER) {
$res .= "<li" . $li_class . ">" . $sep . "<a href='" . BASEDIR . "setuser.php?logout=yes'><span>Logout</span></a> </li>\n";
} else {
$res .= "<li" . $li_class . ">" . $sep . "<a href='" . BASEDIR . "register.php'><span>Register</span></a> </li>\n";
}
$res .= "</ul>\n";
return $res;
}
}
示例10: set_start
function set_start($idx)
{
global $URL, $pn;
$dbh = dbconnect();
$query = "select poll_idx,status from poll_data where poll_idx={$idx}";
$sth = dbquery($dbh, $query);
list($poll_idx, $edate) = dbselect($sth);
if (!$poll_idx) {
print_alert("존재하지 않는 데이터입니다. ", 'back');
exit;
} elseif ($status == 1) {
print_alert("현재 설문중입니다. ", 'back');
exit;
}
/* 설문 재개 */
$query = "update poll_data set status='1' where poll_idx={$idx}";
$sth = dbquery($dbh, $query);
if (!$sth) {
$msg = "에러가 발생하였습니다.<br><br>\n" . mysql_error();
print_message($msg);
} else {
header("Location: {$URL['list']}?pn={$pn}");
exit;
}
dbclose($dbh);
exit;
}
示例11: quarantine_clean
function quarantine_clean()
{
$oldest = date('U', strtotime('-' . QUARANTINE_DAYS_TO_KEEP . " days"));
$quarantine = get_conf_var('QuarantineDir');
$d = dir($quarantine) or die($php_errormsg);
while (false !== ($f = $d->read())) {
// Only interested in quarantine directories (yyyymmdd)
if (preg_match('/^\\d{8}$/', $f)) {
$unixtime = quarantine_date_to_unixtime($f);
if ($unixtime < $oldest) {
// Needs to be deleted
$array = quarantine_list_dir($f);
dbg("Processing directory {$f}: found " . count($array) . " records to delete");
foreach ($array as $id) {
// Update the quarantine flag
$sql = "UPDATE maillog SET timestamp=timestamp, quarantined = NULL WHERE id='{$id}'";
dbquery($sql);
}
dbg("Deleting: " . escapeshellarg($quarantine . '/' . $f));
exec('rm -rf ' . escapeshellarg($quarantine . '/' . $f), $output, $return);
if ($return > 0) {
echo "Error: {$output}\n";
}
}
}
}
$d->close();
}
示例12: version_check_ucc
function version_check_ucc()
{
global $ucc_config;
// IF time() - 60*3 > $DB-ZEIT
$a = time() - 60 * 5;
if ($a > $ucc_config['ucc_version_time']) {
$url = "http://basti2web.de/version/phpfusion_ucc.txt";
$url_p = @parse_url($url);
$host = $url_p['host'];
$port = isset($url_p['port']) ? $url_p['port'] : 80;
$fp = @fsockopen($url_p['host'], $port, $errno, $errstr, 5);
if (!$fp) {
return false;
}
@fputs($fp, 'GET ' . $url_p['path'] . ' HTTP/1.1' . chr(10));
@fputs($fp, 'HOST: ' . $url_p['host'] . chr(10));
@fputs($fp, 'Connection: close' . chr(10) . chr(10));
$response = @fgets($fp, 1024);
$content = @fread($fp, 1024);
$content = preg_replace("#(.*?)text/plain(.*?)\$#is", "\$2", $content);
@fclose($fp);
if (preg_match("#404#", $response)) {
$result = dbquery("UPDATE " . DB_PREFIX . "ucc_settings SET ucc_version_time='" . time() . "', ucc_version_temp=''");
return false;
} else {
$content = trim($content);
$result = dbquery("UPDATE " . DB_PREFIX . "ucc_settings SET ucc_version_time='" . time() . "', ucc_version_temp='" . $content . "'");
return $content;
}
} else {
return $ucc_config['ucc_version_temp'];
}
}
示例13: DoTask
function DoTask()
{
global $Administrator, $GAME;
if (!$Administrator) {
$mypage = page::standard();
$mypage->title_body('Not authorised');
$mypage->leaf('p', 'You are not authorised to make use of this page. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
$mypage->finish();
}
$thenumber = sanitise_int(@$_POST['thenumber']);
if ($thenumber < -9 or $thenumber > 99 or $thenumber == 0) {
$mypage = page::standard();
$mypage->title_body('Invalid input');
$mypage->leaf('p', 'Expected a nonzero integer between -9 and 99 inclusive, but received ' . $thenumber . '. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
$mypage->finish();
}
$interval = sanitise_enum(@$_POST['theinterval'], array('MINUTE', 'HOUR', 'DAY'));
if (@$_POST['whattime'] == 'now') {
$whattime = 'UTC_TIMESTAMP()';
} else {
$whattime = '"LastMove"';
}
$time_expr = 'TIMESTAMPADD(' . $interval . ', :thenumber:, ' . $whattime . ')';
dbquery(DBQUERY_WRITE, 'UPDATE "Game" JOIN "GameInProgress" ON "Game"."GameID" = "GameInProgress"."Game" SET "Game"."LastMove" = ' . $time_expr . ', "GameInProgress"."GIPLastMove" = ' . $time_expr . ' "Game"."GameTicker" = CONCAT("Game"."GameTicker", :tickerconcat:), "Game"."GameTickerNames" = CONCAT("Game"."GameTickerNames", :namesconcat:) WHERE "GameID" = :game:', 'thenumber', $thenumber, 'tickerconcat', '3A' . callmovetimediff() . letter_end_number($_SESSION['MyUserID']) . letter_end_number($_SESSION['MyGenderCode']), 'namesconcat', '|' . $_SESSION['MyUserName'], 'game', $GAME['GameID']);
dbquery(DBQUERY_COMMIT);
page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully altered clock.');
}
示例14: make_rss
function make_rss($feed_name, $feed_updfrq, $language = "all", $exists = false)
{
global $settings, $locale;
if (IF_MULTI_LANGUAGE && $language) {
$language = $language;
} else {
$language = false;
}
$feed_language = $language ? "_" . strtolower($language) : "";
if ($exists) {
$rows = true;
} else {
$result = dbquery("SELECT feed_name FROM " . DB_SS_FEEDS . " WHERE feed_name='" . $feed_name . "'");
$rows = dbrows($result);
}
if ($rows != 0) {
if (file_exists(INFUSIONS . "ss_feeds_panel/feeds/" . $feed_name . ".php")) {
include INFUSIONS . "ss_feeds_panel/feeds/" . $feed_name . ".php";
}
$rssfile = INFUSIONS . "ss_feeds_panel/rss/" . $feed_name . "" . $feed_language . ".rss";
if (file_exists($rssfile)) {
chmod($rssfile, 0777);
}
$write = false;
$file = fopen($rssfile, "w");
if (fwrite($file, $rss)) {
$write = true;
}
fclose($file);
chmod($rssfile, 0644);
return $write;
}
}
示例15: flood_control
function flood_control($field, $table, $where)
{
global $userdata, $settings, $locale;
$flood = false;
if (!iSUPERADMIN && !iADMIN && (!defined("iMOD") || !iMOD)) {
$result = dbquery("SELECT MAX(" . $field . ") AS last_post FROM " . $table . " WHERE " . $where);
if (dbrows($result)) {
$data = dbarray($result);
if (time() - $data['last_post'] < $settings['flood_interval']) {
$flood = true;
$result = dbquery("INSERT INTO " . DB_FLOOD_CONTROL . " (flood_ip, flood_timestamp) VALUES ('" . USER_IP . "', '" . time() . "')");
if (dbcount("(flood_ip)", DB_FLOOD_CONTROL, "flood_ip='" . USER_IP . "'") > 4) {
if (iMEMBER && $settings['flood_autoban'] == "1") {
require_once INCLUDES . "sendmail_include.php";
require_once INCLUDES . "suspend_include.php";
$result = dbquery("UPDATE " . DB_USERS . " SET user_status='4', user_actiontime='0' WHERE user_id='" . $userdata['user_id'] . "'");
suspend_log($userdata['user_id'], 4, $locale['global_440'], true);
$message = str_replace("[USER_NAME]", $userdata['user_name'], $locale['global_442']);
sendemail($userdata['user_name'], $userdata['user_email'], $settings['siteusername'], $settings['siteemail'], $locale['global_441'], $message);
} elseif (!iMEMBER) {
$result = dbquery("INSERT INTO " . DB_BLACKLIST . " (blacklist_ip, blacklist_email, blacklist_reason) VALUES ('" . USER_IP . "', '', '" . $locale['global_440'] . "')");
}
}
}
}
}
return $flood;
}