本文整理汇总了PHP中dbarray函数的典型用法代码示例。如果您正苦于以下问题:PHP dbarray函数的具体用法?PHP dbarray怎么用?PHP dbarray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbarray函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: LoadNote
function LoadNote($player_id, $note_id)
{
global $db_prefix;
$query = "SELECT * FROM " . $db_prefix . "notes WHERE owner_id = {$player_id} AND note_id = {$note_id} LIMIT 1";
$result = dbquery($query);
return dbarray($result);
}
示例3: LoadUniverse
function LoadUniverse()
{
global $db_prefix;
$query = "SELECT * FROM " . $db_prefix . "uni;";
$result = dbquery($query);
return dbarray($result);
}
示例4: 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;
}
示例5: 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;
}
}
}
示例6: get_blogCatData
/**
* Get Single Blog Category Data
* @param $id
* @return array|bool
*/
public static function get_blogCatData($id)
{
if (self::validate_blogCat($id)) {
return dbarray(dbquery("SELECT * FROM " . DB_BLOG_CATS . " WHERE blog_cat_id='" . intval($id) . "'"));
}
return FALSE;
}
示例7: 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;
}
}
示例8: showratings
function showratings($rating_type, $rating_item_id, $rating_link)
{
global $locale, $userdata;
$settings = \fusion_get_settings();
if ($settings['ratings_enabled'] == "1") {
if (iMEMBER) {
$d_rating = dbarray(dbquery("SELECT rating_vote,rating_datestamp FROM " . DB_RATINGS . " WHERE rating_item_id='" . $rating_item_id . "' AND rating_type='" . $rating_type . "' AND rating_user='" . $userdata['user_id'] . "'"));
if (isset($_POST['post_rating'])) {
// Rate
if (isnum($_POST['rating']) && $_POST['rating'] > 0 && $_POST['rating'] < 6 && !isset($d_rating['rating_vote'])) {
$result = dbquery("INSERT INTO " . DB_RATINGS . " (rating_item_id, rating_type, rating_user, rating_vote, rating_datestamp, rating_ip, rating_ip_type) VALUES ('{$rating_item_id}', '{$rating_type}', '" . $userdata['user_id'] . "', '" . $_POST['rating'] . "', '" . time() . "', '" . USER_IP . "', '" . USER_IP_TYPE . "')");
if ($result) {
defender::unset_field_session();
}
}
redirect($rating_link);
} elseif (isset($_POST['remove_rating'])) {
// Unrate
$result = dbquery("DELETE FROM " . DB_RATINGS . " WHERE rating_item_id='{$rating_item_id}' AND rating_type='{$rating_type}' AND rating_user='" . $userdata['user_id'] . "'");
if ($result) {
defender::unset_field_session();
}
redirect($rating_link);
}
}
$ratings = array(5 => $locale['r120'], 4 => $locale['r121'], 3 => $locale['r122'], 2 => $locale['r123'], 1 => $locale['r124']);
if (!iMEMBER) {
$message = str_replace("[RATING_ACTION]", "<a href='" . BASEDIR . "login.php'>" . $locale['login'] . "</a>", $locale['r104']);
if (fusion_get_settings("enable_registration") == TRUE) {
$message = str_replace("[RATING_ACTION]", "<a href='" . BASEDIR . "login.php'>" . $locale['login'] . "</a> " . $locale['or'] . " <a href='" . BASEDIR . "register.php'>" . $locale['register'] . "</a>", $locale['r104']);
}
echo "<div class='text-center'>" . $message . "</div>\n";
} elseif (isset($d_rating['rating_vote'])) {
echo "<div class='display-block'>\n";
echo openform('removerating', 'post', $rating_link, array('class' => 'display-block text-center'));
echo sprintf($locale['r105'], $ratings[$d_rating['rating_vote']], showdate("longdate", $d_rating['rating_datestamp'])) . "<br /><br />\n";
echo form_button('remove_rating', $locale['r102'], $locale['r102'], array('class' => 'btn-default', 'icon' => 'fa fa-times m-r-10'));
echo closeform();
echo "</div>\n";
} else {
echo "<div class='display-block'>\n";
echo openform('postrating', 'post', $rating_link, array('max_tokens' => 1, 'notice' => 0, 'class' => 'm-b-20 text-center'));
echo form_select('rating', $locale['r106'], '', array('options' => $ratings, 'class' => 'display-block text-center'));
echo form_button('post_rating', $locale['r103'], $locale['r103'], array('class' => 'btn-primary btn-sm', 'icon' => 'fa fa-thumbs-up m-r-10'));
echo closeform();
echo "</div>\n";
}
$rating_votes = dbarray(dbquery("\n\t\tSELECT\n\t\tSUM(IF(rating_vote='5', 1, 0)) as r120,\n\t\tSUM(IF(rating_vote='4', 1, 0)) as r121,\n\t\tSUM(IF(rating_vote='3', 1, 0)) as r122,\n\t\tSUM(IF(rating_vote='2', 1, 0)) as r123,\n\t\tSUM(IF(rating_vote='1', 1, 0)) as r124\n\t\tFROM " . DB_RATINGS . " WHERE rating_type='" . $rating_type . "' and rating_item_id='" . intval($rating_item_id) . "'\n\t\t"));
if (!empty($rating_votes)) {
echo "<div id='ratings' class='rating_container'>\n";
foreach ($rating_votes as $key => $num) {
echo progress_bar($num, $locale[$key], FALSE, '10px', TRUE, FALSE);
}
echo "</div>\n";
} else {
echo "<div class='text-center'>" . $locale['r101'] . "</div>\n";
}
}
}
示例9: EmailExist
function EmailExist($email)
{
global $db_prefix;
$email = mb_strtolower($email, 'UTF-8');
$query = "SELECT * FROM " . $db_prefix . "users WHERE (email = '" . $email . "' OR pemail = '" . $email . "')";
$result = dbquery($query);
return dbarray($result);
}
示例10: Admin_Debug
function Admin_Debug()
{
global $session;
global $db_prefix;
global $GlobalUser;
if (method() === "POST") {
$query = "SELECT * FROM " . $db_prefix . "debug ORDER BY date DESC, error_id DESC LIMIT 50";
$result = dbquery($query);
$rows = dbrows($result);
while ($rows--) {
$msg = dbarray($result);
if ($_POST["delmes" . $msg['error_id']] === "on" || $_POST['deletemessages'] === "deleteall") {
$query = "DELETE FROM " . $db_prefix . "debug WHERE error_id = " . $msg['error_id'];
dbquery($query);
}
}
}
$query = "SELECT * FROM " . $db_prefix . "debug ORDER BY date DESC, error_id DESC LIMIT 50";
$result = dbquery($query);
?>
<?php
echo AdminPanel();
?>
<table class='header'><tr class='header'><td><table width="519">
<form action="index.php?page=admin&session=<?php
echo $session;
?>
&mode=Debug" method="POST">
<tr><td colspan="4" class="c">Сообщения</td></tr>
<tr><th>Действие</th><th>Дата</th><th>От</th><th>Браузер</th></tr>
<?php
$rows = dbrows($result);
while ($rows--) {
$msg = dbarray($result);
$user = LoadUser($msg['owner_id']);
$from = "<a href=\"index.php?page=admin&session={$session}&mode=Users&player_id=" . $msg['owner_id'] . "\">" . $user['oname'] . "</a> [" . $msg['ip'] . "]";
$msg['text'] = str_replace("{PUBLIC_SESSION}", $session, $msg['text']);
echo "<tr><th><input type=\"checkbox\" name=\"delmes" . $msg['error_id'] . "\"/></th><th>" . date("m-d H:i:s", $msg['date']) . "</th><th>{$from} </th><th>" . $msg['agent'] . " </th></tr>\n";
echo "<tr><td class=\"b\"> </td><td class=\"b\" colspan=\"3\">" . $msg['text'] . "</td></tr>\n";
}
?>
<tr><td class="b"> </td><td class="b" colspan="3"></td></tr>
<tr><th colspan="4" style='padding:0px 105px;'></th></tr>
<tr><th colspan="4">
<select name="deletemessages">
<option value="deletemarked">Удалить выделенные сообщения</option>
<option value="deleteall">Удалить все сообщения</option>
</select><input type="submit" value="ok" /></th></tr>
<tr><td colspan="4"><center> </center></td></tr>
</form>
</table>
<?php
}
示例11: fieldgenerator
function fieldgenerator($db)
{
$cresult = dbquery("SHOW COLUMNS FROM {$db}");
$col_names = array();
while ($cdata = dbarray($cresult)) {
$col_names[] = $cdata['Field'];
}
return (array) $col_names;
}
示例12: _force_auth
private function _force_auth($user_id)
{
global $locale, $settings;
$result = dbquery("\tSELECT * FROM " . DB_USERS . " WHERE user_id='" . $user_id . "' LIMIT 1");
if (dbrows($result) == 1) {
$user = dbarray($result);
ForceAuth::setUserCookie($user['user_id'], $user['user_salt'], $user['user_algo'], true, true);
}
}
示例13: check_inf
function check_inf($infusion)
{
$title = dbarray(dbquery("SELECT inf_folder FROM " . DB_PREFIX . "infusions WHERE inf_folder='" . $infusion . "'"));
if ($title) {
return TRUE;
} else {
return FALSE;
}
}
示例14: UpdateChartVorwoche
public function UpdateChartVorwoche()
{
$this->platz();
while ($temp = dbarray($this->platz)) {
//echo "Platz : " .$temp['chart_platz'] . " ID: " . $temp['chart_id'] . "<br>";
//echo "Sql : " . "UPDATE " . DB_CHARTS . " SET chart_vorwoche = ".$temp['chart_platz']. " WHERE chart_id = " . $temp['chart_id'] . "<br>";
$resvorw = dbquery("UPDATE " . DB_CHARTS . " SET chart_vorwoche = " . $temp['chart_platz'] . " WHERE chart_id = " . $temp['chart_id']);
}
return $resvorw;
}
示例15: read_session
function read_session($session_id)
{
global $sess_read;
$result = dbquery("SELECT session_data FROM " . DB_SESSIONS . " WHERE session_id='" . valid_session($session_id) . "'");
if (dbrows($result)) {
$sess_read = dbarray($result);
return $sess_read['session_data'];
} else {
return $sess_read = "";
}
}