• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_valid_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中is_valid_id函数的典型用法代码示例。如果您正苦于以下问题:PHP is_valid_id函数的具体用法?PHP is_valid_id怎么用?PHP is_valid_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: json_scoreboard

function json_scoreboard($user_type = null)
{
    $values = array();
    if (is_valid_id($user_type)) {
        $values['user_type'] = $user_type;
    }
    $scores = db_query_fetch_all('
        SELECT
           u.id AS user_id,
           u.team_name,
           co.country_code,
           SUM(c.points) AS score,
           MAX(s.added) AS tiebreaker
        FROM users AS u
        LEFT JOIN countries AS co ON co.id = u.country_id
        LEFT JOIN submissions AS s ON u.id = s.user_id AND s.correct = 1
        LEFT JOIN challenges AS c ON c.id = s.challenge
        WHERE
          u.competing = 1
          ' . (is_valid_id($user_type) ? 'AND u.user_type = :user_type' : '') . '
        GROUP BY u.id
        ORDER BY score DESC, tiebreaker ASC', $values);
    $scoreboard = array();
    for ($i = 0; $i < count($scores); $i++) {
        $scoreboard['standings'][$i] = array('pos' => $i + 1, 'team' => $scores[$i]['team_name'], 'score' => array_get($scores[$i], 'score', 0), 'country' => $scores[$i]['country_code']);
    }
    echo json_encode($scoreboard);
}
开发者ID:janglapuk,项目名称:mellivora,代码行数:28,代码来源:json.inc.php


示例2: update_poll

function update_poll()
{
    global $INSTALLER09, $CURUSER, $mc1, $lang;
    $total_votes = 0;
    if (!isset($_POST['pid']) or !is_valid_id($_POST['pid'])) {
        stderr($lang['poll_up_usr_err'], $lang['poll_up_no_poll']);
    }
    $pid = intval($_POST['pid']);
    if (!isset($_POST['poll_question']) or empty($_POST['poll_question'])) {
        stderr($lang['poll_up_usr_err'], $lang['poll_up_no_title']);
    }
    $poll_title = sqlesc(htmlsafechars(strip_tags($_POST['poll_question']), ENT_QUOTES));
    //get the main crux of the poll data
    $poll_data = makepoll();
    $total_votes = isset($poll_data['total_votes']) ? intval($poll_data['total_votes']) : 0;
    unset($poll_data['total_votes']);
    if (!is_array($poll_data) or !count($poll_data)) {
        stderr($lang['poll_up_sys_err'], $lang['poll_up_no_data']);
    }
    //all ok, serialize
    $poll_data = sqlesc(serialize($poll_data));
    $username = sqlesc($CURUSER['username']);
    sql_query("UPDATE polls SET choices={$poll_data}, starter_id={$CURUSER['id']}, starter_name={$username}, votes={$total_votes}, poll_question={$poll_title} WHERE pid=" . sqlesc($pid)) or sqlerr(__FILE__, __LINE__);
    $mc1->delete_value('poll_data_' . $CURUSER['id']);
    if (-1 == mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $msg = "<h2>{$lang['poll_up_error']}</h2>\n      <a href='javascript:history.back()' title='{$lang['poll_up_fix_it']}' style='color:green;font-weight:bold'><span class='btn' style='padding:3px;'><img style='vertical-align:middle;' src='{$INSTALLER09['pic_base_url']}/polls/p_delete.gif' alt='{$lang['poll_up_back']}' />{$lang['poll_up_back']}</span></a>";
    } else {
        $msg = "<h2>{$lang['poll_up_worked']}</h2>\n      <a href='staffpanel.php?tool=polls_manager&amp;action=polls_manager' title='{$lang['poll_up_return']}' style='color:green;font-weight:bold'><span class='btn' style='padding:3px;'><img style='vertical-align:middle;' src='{$INSTALLER09['pic_base_url']}/polls/p_tick.gif' alt='{$lang['poll_up_success']}' />{$lang['poll_up_success']}</span></a>";
    }
    echo stdhead($lang['poll_up_stdhead']) . $msg . stdfoot();
}
开发者ID:UniversalAdministrator,项目名称:U-232-V4,代码行数:31,代码来源:polls_manager.php


示例3: update_poll

function update_poll()
{
    global $INSTALLER09, $CURUSER, $mc1;
    $total_votes = 0;
    if (!isset($_POST['pid']) or !is_valid_id($_POST['pid'])) {
        stderr('USER ERROR', 'There is no poll with that ID!');
    }
    $pid = intval($_POST['pid']);
    if (!isset($_POST['poll_question']) or empty($_POST['poll_question'])) {
        stderr('USER ERROR', 'There is no title defined!');
    }
    $poll_title = sqlesc(htmlspecialchars(strip_tags($_POST['poll_question']), ENT_QUOTES));
    //get the main crux of the poll data
    $poll_data = makepoll();
    $total_votes = isset($poll_data['total_votes']) ? intval($poll_data['total_votes']) : 0;
    unset($poll_data['total_votes']);
    if (!is_array($poll_data) or !count($poll_data)) {
        stderr('SYSTEM ERROR', 'There was no data sent');
    }
    //all ok, serialize
    $poll_data = sqlesc(serialize($poll_data));
    $username = sqlesc($CURUSER['username']);
    @sql_query("UPDATE polls SET choices={$poll_data}, starter_id={$CURUSER['id']}, starter_name={$username}, votes={$total_votes}, poll_question={$poll_title} WHERE pid={$pid}") or sqlerr(__FILE__, __LINE__);
    $mc1->delete_value('poll_data_' . $CURUSER['id']);
    if (-1 == mysql_affected_rows()) {
        $msg = "<h2>An Error Occured!</h2>\r\n      <a href='javascript:history.back()' title='Go back and fix the error' style='color:green;font-weight:bold'><span class='btn' style='padding:3px;'><img style='vertical-align:middle;' src='{$INSTALLER09['pic_base_url']}/polls/p_delete.gif' alt='Go Back' />Go Back</span></a>";
    } else {
        $msg = "<h2>Groovy, everything went hunky dory!</h2>\r\n      <a href='staffpanel.php?tool=polls_manager&amp;action=polls_manager' title='Return to Polls Manager' style='color:green;font-weight:bold'><span class='btn' style='padding:3px;'><img style='vertical-align:middle;' src='{$INSTALLER09['pic_base_url']}/polls/p_tick.gif' alt='Success' />Success</span></a>";
    }
    echo stdhead('Poll Manager::Add New Poll') . $msg . stdfoot();
}
开发者ID:CharlieHD,项目名称:U-232-V2,代码行数:31,代码来源:polls_manager.php


示例4: check

function check($id)
{
    if (!is_valid_id($id)) {
        return stderr("Error", "Invalid ID");
    } else {
        return true;
    }
}
开发者ID:chenrizhi,项目名称:mtpt,代码行数:8,代码来源:maxlogin.php


示例5: validate

function validate($id)
{
    global $lang;
    if (!is_valid_id($id)) {
        stderr($lang['failed_sorry'], "{$lang['failed_bad_id']}");
    } else {
        return true;
    }
}
开发者ID:UniversalAdministrator,项目名称:U-232-V4,代码行数:9,代码来源:failedlogins.php


示例6: update

 public function update($data, $id)
 {
     if (empty($data['domain']) || !is_valid_id($id)) {
         return FALSE;
     } else {
         $this->db->where('id', $id);
         $this->db->update('website', $data);
         return TRUE;
     }
 }
开发者ID:nac80,项目名称:bijoux-admin,代码行数:10,代码来源:website_model.php


示例7: delete_file

function delete_file($id)
{
    if (!is_valid_id($id)) {
        message_error('Invalid ID.');
    }
    db_delete('files', array('id' => $id));
    if (file_exists(CONST_PATH_FILE_UPLOAD . $id)) {
        unlink(CONST_PATH_FILE_UPLOAD . $id);
    }
}
开发者ID:AdaFormacion,项目名称:mellivora,代码行数:10,代码来源:files.inc.php


示例8: remove

 public function remove($client_id)
 {
     is_valid_id($client_id, 'client') ? '' : show_error($this->lang->line('not_valid_id'));
     $is_remove = $this->relation->remove($client_id);
     if ($is_remove) {
         set_flash($this->lang->line('db_client_removed'));
         redirect('dashboard', 'refresh');
     } else {
         set_flash($this->lang->line('db_client_remove_error'));
         redirect('dashboard', 'refresh');
     }
 }
开发者ID:abdulmanan7,项目名称:stms,代码行数:12,代码来源:relation.php


示例9: update

 public function update()
 {
     $p = $this->input->post('p');
     if (!is_valid_id($p["id"])) {
         echo "COULD NOT UPDATE - MISSING WEBSITE ID";
     } else {
         $id = $p["id"];
     }
     if ($this->Website_model->update($p['update'], $id)) {
         echo "SUCCESS";
     } else {
         echo "UPDATE FAILED";
     }
 }
开发者ID:nac80,项目名称:bijoux-admin,代码行数:14,代码来源:websites.php


示例10: update_product_types

 public function update_product_types($data, $id)
 {
     if (!is_valid_id($id)) {
         return FALSE;
     } else {
         // Delete all the existing joined product types
         $this->db->where('collectionID', $id);
         $this->db->delete('collectionjoinproducttype');
         if (array_valid($data)) {
             // Insert the new product type associations
             foreach ($data as $ptype_id) {
                 $this->db->insert('collectionjoinproducttype', array('collectionID' => $id, 'productTypeID' => $ptype_id));
             }
         }
         return TRUE;
     }
 }
开发者ID:nac80,项目名称:bijoux-admin,代码行数:17,代码来源:collection_model.php


示例11: update

 public function update()
 {
     $p = $this->input->post('p');
     if (!is_valid_id($p["id"])) {
         echo "COULD NOT UPDATE - MISSING COLLECTION ID";
     } else {
         $id = $p["id"];
     }
     if ($this->Collection_model->update($p['update'], $id)) {
         if ($this->Collection_model->update_product_types($p['product_types'], $id)) {
             echo "SUCCESS";
         } else {
             echo "COULD NOT SETUP PRODUCT TYPE ASSOCIATIONS";
         }
     } else {
         echo "UPDATE FAILED";
     }
 }
开发者ID:nac80,项目名称:bijoux-admin,代码行数:18,代码来源:collections.php


示例12: update_password

 public function update_password($data, $id)
 {
     if (array_valid($data) && is_valid_id($id)) {
         // Ensure no bogus whitespace on any of the information
         array_trim($data);
         // Let's be sure the passwords match
         $new_password = $data['magickey'];
         $match_password = $data['matchkey'];
         if ($new_password === $match_password) {
             $update_data['magickey'] = sha1($new_password);
             $this->db->where('id', $id);
             $this->db->update('user', $update_data);
             return TRUE;
         } else {
             $errors[] = 'The passwords for both fields did not match, please try again';
         }
     } else {
         $errors[] = 'No user information was provided';
     }
     if (array_valid($errors)) {
         return $errors;
     }
 }
开发者ID:nac80,项目名称:bijoux-admin,代码行数:23,代码来源:user_model.php


示例13: dirname

 * Project Leaders: Mindless, putyn.
 *
 */
// Achievements mod by MelvinMeow
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'bittorrent.php';
require_once INCL_DIR . 'user_functions.php';
require_once INCL_DIR . 'pager_functions.php';
require_once CLASS_DIR . 'page_verify.php';
dbconn();
loggedinorreturn();
$newpage = new page_verify();
$newpage->create('takecounts');
$lang = array_merge(load_language('global'));
$HTMLOUT = "";
$id = (int) $_GET["id"];
if (!is_valid_id($id)) {
    stderr("Error", "It appears that you have entered an invalid id.");
}
$res = sql_query("SELECT users.id, users.username, usersachiev.achpoints, usersachiev.spentpoints FROM users LEFT JOIN usersachiev ON users.id = usersachiev.id WHERE users.id = " . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$arr = mysqli_fetch_assoc($res);
if (!$arr) {
    stderr("Error", "It appears that there is no user with that id.");
}
$achpoints = (int) $arr['achpoints'];
$spentpoints = (int) $arr['spentpoints'];
$res = sql_query("SELECT COUNT(*) FROM achievements WHERE userid =" . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$row = mysqli_fetch_row($res);
$count = $row[0];
$perpage = 15;
if (!$count) {
    stderr("No Achievements", "It appears that <a class='altlink' href='userdetails.php?id=" . (int) $arr['id'] . "'>" . htmlsafechars($arr['username']) . "</a> currently has no achievements.");
开发者ID:CharlieHD,项目名称:U-232-V3,代码行数:31,代码来源:achievementhistory.php


示例14: rep_output

    //print_r($input);
    //die;
}
//$input['reputation'] = 'pos';
//$input['reason'] = 'la di da di di la';
///////////////////////////////////////////////
//	Just added to Reputation?
///////////////////////////////////////////////
if (isset($input['done'])) {
    rep_output($lang["info_reputation_added"]);
}
///////////////////////////////////////////////
//	Nope, so do something different, like check stuff
///////////////////////////////////////////////
/// weeeeeeeeee =]
$check = isset($input['pid']) ? is_valid_id($input['pid']) : false;
$locales = array('posts', 'comments', 'torrents', 'users');
$rep_locale = isset($input['locale']) && in_array($input['locale'], $locales) ? $input['locale'] : 'posts';
if (!$check) {
    rep_output('Incorrect Access');
}
if ($rep_locale == 'posts') {
    ///////////////////////////////////////////////
    // check the post actually exists!
    ///////////////////////////////////////////////
    $forum = sql_query("SELECT posts.topicid AS locale, posts.userid, forums.minclassread,\r\nusers.username, users.reputation\r\nFROM posts\r\nLEFT JOIN topics ON topicid = topics.id\r\nLEFT JOIN forums ON topics.forumid = forums.id\r\nLEFT JOIN users ON posts.userid = users.id\r\nWHERE posts.id ={$input['pid']}");
} elseif ($rep_locale == 'comments') {
    ///////////////////////////////////////////////
    // check the comment actually exists!
    ///////////////////////////////////////////////
    //uncomment the following  if use comments.anonymous field
开发者ID:thefkboss,项目名称:U-232,代码行数:31,代码来源:reputation.php


示例15: extract_slug_id

<?php

require_once "../../config/init.php";
$slug = extract_slug_id($_GET["id"]);
if (!is_valid_id($slug['id'])) {
    header('location: /index.php');
    exit;
}
$productID = $slug['id'];
//Information for necklace pages are set in this file
require_once "necklace.inc";
$page->set_all($p);
$page->display();
开发者ID:nac80,项目名称:bijoux-website,代码行数:13,代码来源:necklace.php


示例16: SQL_Query_exec

         if (isset($_GET['inbox']) && $arr["unread"] == "yes") {
             SQL_Query_exec("UPDATE messages SET `unread` = 'no' WHERE `id` = {$arr['id']} AND `receiver` = {$CURUSER['id']}");
         }
     }
     if ($arr["unread"] == "yes") {
         $format = "font-weight:bold;";
         $unread = true;
     }
     $table['&nbsp;'] = th_left("<input type=\"checkbox\" name=\"msgs[{$arr['id']}]\" " . ($reading ? "checked='checked'" : "") . " onclick=\"this.form.remove.disabled=true;\" />", 1);
     $table['Sender'] = th_left("{$sender}", 1, $format);
     $table['Sent_to'] = th_left("{$sentto}", 1, $format);
     $table['Subject'] = th_left("<a href=\"javascript:read({$arr['id']});\"><img src=\"" . $site_config["SITEURL"] . "/images/plus.gif\" id=\"img_{$arr['id']}\" class=\"read\" border=\"0\" alt='' /></a>&nbsp;<a href=\"javascript:read({$arr['id']});\">{$subject}</a>", 1, $format);
     $table['Date'] = th_left(utc_to_tz($arr['added']), 1, $format);
     table($table, $tablefmt);
     $display = "<div>" . format_comment($arr['msg']) . "<br /><br />";
     if (isset($_GET['inbox']) && is_valid_id($arr["sender"])) {
         $display .= "<input type=\"submit\" name=\"compose[{$arr['id']}]\" value=\"Reply\" />&nbsp;\n";
     } elseif (isset($_GET['draft']) || isset($_GET['templates'])) {
         $display .= "<input type=\"submit\" name=\"compose[{$arr['id']}]\" value=\"Edit\" />&nbsp;";
     }
     if (isset($_GET['inbox']) && $arr['unread'] == 'yes') {
         $display .= "<input type=\"submit\" name=\"mark[{$arr['id']}]\" value=\"Mark as Read\" />&nbsp;\n";
     }
     $display .= "<input type=\"submit\" name=\"remove[{$arr['id']}]\" value=\"Delete\" />&nbsp;\n";
     $display .= "</div>";
     table(td_left($display, 1, "padding:0 6px 6px 6px"), $tablefmt, "id=\"msg_{$arr['id']}\" style=\"display:none;\"");
 }
 // if ($count)
 //{
 $buttons = "<input type=\"button\" value=\"" . T_("SELECTED_DELETE") . "\" onclick=\"this.form.remove.disabled=!this.form.remove.disabled;\" />";
 $buttons .= "<input type=\"submit\" name=\"remove\" value=\"...confirm\" disabled=\"disabled\" />";
开发者ID:l3oncoder,项目名称:TorrentTrader,代码行数:31,代码来源:mailbox.php


示例17: get_access

    $HTMLOUT = '';
    $HTMLOUT .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\t\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\t\t<html xmlns='http://www.w3.org/1999/xhtml'>\n\t\t<head>\n\t\t<title>Error!</title>\n\t\t</head>\n\t\t<body>\n\t<div style='font-size:33px;color:white;background-color:red;text-align:center;'>Incorrect access<br />You cannot access this file directly.</div>\n\t</body></html>";
    echo $HTMLOUT;
    exit;
}
require_once INCL_DIR . 'user_functions.php';
require_once INCL_DIR . 'html_functions.php';
require_once INCL_DIR . 'pager_functions.php';
require_once CLASS_DIR . 'class_check.php';
$class = get_access(basename($_SERVER['REQUEST_URI']));
class_check($class);
$lang = array_merge($lang, load_language('ad_banemail'));
/* Ban emails by x0r @tbdev.net */
$HTMLOUT = '';
$remove = isset($_GET['remove']) ? (int) $_GET['remove'] : 0;
if (is_valid_id($remove)) {
    sql_query("DELETE FROM bannedemails WHERE id = " . sqlesc($remove)) or sqlerr(__FILE__, __LINE__);
    write_log("{$lang['ad_banemail_log1']} {$remove} {$lang['ad_banemail_log2']} {$CURUSER['username']}");
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $email = htmlsafechars(trim($_POST["email"]));
    $comment = htmlsafechars(trim($_POST["comment"]));
    if (!$email || !$comment) {
        stderr("{$lang['ad_banemail_error']}", "{$lang['ad_banemail_missing']}");
    }
    sql_query("INSERT INTO bannedemails (added, addedby, comment, email) VALUES(" . TIME_NOW . ", " . sqlesc($CURUSER['id']) . ", " . sqlesc($comment) . ", " . sqlesc($email) . ")") or sqlerr(__FILE__, __LINE__);
    header("Location: staffpanel.php?tool=bannedemails");
    die;
}
$HTMLOUT .= begin_frame("{$lang['ad_banemail_add']}", true);
$HTMLOUT .= "<form method=\"post\" action=\"staffpanel.php?tool=bannedemails\">\n<table border='1' cellspacing='0' cellpadding='5'>\n<tr><td class='rowhead'>{$lang['ad_banemail_email']}</td>\n<td><input type=\"text\" name=\"email\" size=\"40\"/></td></tr>\n<tr><td class='rowhead'align='left'>{$lang['ad_banemail_comment']}</td>\n<td><input type=\"text\" name=\"comment\" size=\"40\"/></td></tr>\n<tr><td colspan='2'>{$lang['ad_banemail_info']}</td></tr>\n<tr><td colspan='2' align='center'>\n<input type=\"submit\" value=\"{$lang['ad_banemail_ok']}\" class=\"btn\"/></td></tr>\n</table></form>\n";
开发者ID:UniversalAdministrator,项目名称:U-232-V4,代码行数:31,代码来源:bannedemails.php


示例18: isset

    $HTMLOUT .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
        <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
        <title>ERROR</title>
        </head><body>
        <h1 style="text-align:center;">ERROR</h1>
        <p style="text-align:center;">How did you get here? silly rabbit Trix are for kids!.</p>
        </body></html>';
    echo $HTMLOUT;
    exit;
}
global $lang;
$topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : (isset($_POST['topic_id']) ? intval($_POST['topic_id']) : 0);
$forum_id = isset($_GET['forum_id']) ? intval($_GET['forum_id']) : (isset($_POST['forum_id']) ? intval($_POST['forum_id']) : 0);
//=== first see if they are being norty...
$norty_res = sql_query('SELECT min_class_read FROM forums WHERE id = ' . sqlesc($forum_id));
$norty_arr = mysqli_fetch_row($norty_res);
if (!is_valid_id($topic_id) || $norty_arr[0] > $CURUSER['class'] || !is_valid_id($forum_id)) {
    stderr($lang['gl_error'], $lang['gl_bad_id']);
}
//=== see if they are subscribed already
$res = sql_query('SELECT id FROM subscriptions WHERE user_id = ' . sqlesc($CURUSER['id']) . ' AND topic_id = ' . sqlesc($topic_id));
$arr = mysqli_fetch_row($res);
if ($arr[0] > 0) {
    stderr($lang['gl_error'], $lang['fe_you_already_subscib']);
}
//=== ok, that the hell, let's add it \o/
sql_query('INSERT INTO `subscriptions` (`user_id`, `topic_id`) VALUES (' . sqlesc($CURUSER['id']) . ', ' . sqlesc($topic_id) . ')');
header('Location: ' . $INSTALLER09['baseurl'] . '/forums.php?action=view_topic&topic_id=' . $topic_id . '&s=1');
die;
开发者ID:UniversalAdministrator,项目名称:U-232-V4,代码行数:31,代码来源:add_subscription.php


示例19: insert_compose_frame

function insert_compose_frame($id, $newtopic = true, $quote = false, $attachment = false)
{
    global $CURUSER, $INSTALLER09, $Multi_forum;
    $htmlout = '';
    if ($newtopic) {
        $res = sql_query("SELECT name FROM forums WHERE id=" . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
        $arr = mysqli_fetch_assoc($res) or die("Bad forum ID!");
        // $htmlout .="<h3>New topic in <a href='{$INSTALLER09['baseurl']}/forums.php?action=viewforum&amp;forumid=".$id."'>".htmlsafechars($arr["name"])."</a> forum</h3>";
        $htmlout .= "<!--<div class='navigation'>\n\t\t\t\t<a href='index.php'>" . $INSTALLER09["site_name"] . "</a> \n\t\t\t\t&gt;\n\t\t\t\t<a href='forums.php'>Forums</a>\n\t\t\t\t&gt;\n\t\t\t\t<a href='{$INSTALLER09['baseurl']}/forums.php?action=viewforum&amp;forumid=" . $id . "'>" . htmlsafechars($arr["name"]) . "</a>\n\t\t\t\t<br><img src='templates/1/pic/carbon/nav_bit.png' alt=''>\n\t\t\t\t<span class='active'>New Topic</span>\n\t\t\t\t</div><br />-->";
    } else {
        $res = sql_query("SELECT t.forum_id, t.topic_name, t.locked, f.min_class_read, f.name AS forum_name FROM topics AS t LEFT JOIN forums AS f ON f.id = t.forum_id WHERE t.id=" . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
        $arr = mysqli_fetch_assoc($res) or die("Forum error, Topic not found.");
        $forum = htmlsafechars($arr["forum_name"]);
        $forumid = (int) $arr['forum_id'];
        if ($arr['locked'] == 'yes') {
            stderr("Sorry", "The topic is locked.");
            $htmlout .= end_table();
            $htmlout .= end_main_frame();
            echo stdhead("Compose", true, $stdhead) . $htmlout . stdfoot($stdfoot);
            exit;
        }
        if ($CURUSER["class"] < $arr["min_class_read"]) {
            $htmlout .= stdmsg("Sorry", "You are not allowed in here.");
            $htmlout .= end_table();
            $htmlout .= end_main_frame();
            echo stdhead("Compose") . $htmlout . stdfoot();
            exit;
        }
        $htmlout .= "<!--<div class='navigation'>\n\t\t\t\t<a href='index.php'>" . $INSTALLER09["site_name"] . "</a> \n\t\t\t\t&gt;\n\t\t\t\t<a href='forums.php'>Forums</a>\n\t\t\t\t&gt;\n\t\t\t\t<a href='{$INSTALLER09['baseurl']}/forums.php?action=viewforum&amp;forumid=" . $forumid . "'>{$forum}</a>\n\t\t\t\t&gt;\n\t\t\t\t<a href='{$INSTALLER09['baseurl']}/forums.php?action=viewtopic&amp;topicid=" . $id . "'>" . htmlsafechars($arr["topic_name"]) . "</a>\n\t\t\t\t<br><img src='templates/1/pic/carbon/nav_bit.png' alt=''>\n\t\t\t\t<span class='active'>Post Reply</span>\n\t\t\t\t</div><br />-->";
        // $htmlout .="<h3 align='center'>Reply to topic:<a href='{$INSTALLER09['baseurl']}/forums.php?action=viewtopic&amp;topicid=".$id."'>".htmlsafechars($arr["topic_name"])."</a></h3>";
    }
    $htmlout .= "\n    <script type='text/javascript'>\n    /*<![CDATA[*/\n    function Preview()\n    {\n    document.compose.action = './forums/preview.php'\n    document.compose.target = '_blank';\n    document.compose.submit();\n    return true;\n    }\n    /*]]>*/\n    </script>";
    //$htmlout .= begin_frame("Compose", true);
    $htmlout .= "<form method='post' name='compose' action='{$INSTALLER09['baseurl']}/forums.php' enctype='multipart/form-data'>\n\t  <input type='hidden' name='action' value='post' />\n\t  <input type='hidden' name='" . ($newtopic ? 'forumid' : 'topicid') . "' value='" . $id . "' />";
    //$htmlout .= begin_table(true);
    $htmlout .= "<table border='0' cellspacing='0' cellpadding='5' class='tborder'>\n\t<tr>\n<td class='thead' colspan='2'><strong>Compose</strong></td>\n</tr>\n\t";
    if ($newtopic) {
        $htmlout .= "<tr>\n\t\t\t<td class=row width='10%'>Subject</td>\n\t\t\t<td class=row align='left'>\n\t\t\t\t<input type='text' class='form-control col-md-12' size='100' maxlength='{$Multi_forum['configs']['maxsubjectlength']}' name='topic_name'  />\n\t\t\t</td>\n\t\t</tr>";
    }
    if ($quote) {
        $postid = (int) $_GET["postid"];
        if (!is_valid_id($postid)) {
            stderr("Error", "Invalid ID!");
            $htmlout .= end_table();
            $htmlout .= end_main_frame();
            echo stdhead("Compose", true, $stdhead) . $htmlout . stdfoot($stdfoot);
            exit;
        }
        $res = sql_query("SELECT posts.*, users.username FROM posts JOIN users ON posts.user_id = users.id WHERE posts.id =" . sqlesc($postid)) or sqlerr(__FILE__, __LINE__);
        if (mysqli_num_rows($res) == 0) {
            stderr("Error", "No post with this ID");
            $htmlout .= end_table();
            $htmlout .= end_main_frame();
            echo stdhead("Error - No post with this ID", true, $stdhead) . $htmlout . stdfoot($stdfoot);
            exit;
        }
        $arr = mysqli_fetch_assoc($res);
    }
    $htmlout .= "<tr>\n\t\t<td class=row valign='top'>Body</td>\n\t\t<td class=row>";
    $qbody = $quote ? "[quote=" . htmlsafechars($arr["username"]) . "]" . htmlsafechars($arr["body"]) . "[/quote]" : "";
    //if (function_exists('BBcode'))
    //$htmlout .= BBcode($qbody, true);
    if (function_exists('textbbcode')) {
        $htmlout .= ' 
		' . textbbcode('compose', 'body', isset($qbody) ? htmlsafechars($qbody) : '') . ' 
		';
    } else {
        $htmlout .= "<textarea name='body' style='width:99%' rows='7'>{$qbody}</textarea>";
    }
    $htmlout .= "</td></tr>";
    if ($Multi_forum['configs']['use_attachment_mod'] && $attachment) {
        $htmlout .= "<tr>\n\t\t\t\t<td colspan='2'><fieldset class='fieldset'><legend>Add Attachment</legend>\n\t\t\t\t<input type='checkbox' name='uploadattachment' value='yes' />\n\t\t\t\t<input type='file' name='file' size='60' />\n        <div class='error'>Allowed Files: rar, zip<br />Size Limit " . mksize($Multi_forum['configs']['maxfilesize']) . "</div></fieldset>\n\t\t\t\t</td>\n\t\t\t</tr>";
    }
    $htmlout .= "<tr>\n   \t  <td class=row align='center' colspan='2'>" . post_icons() . "</td>\n \t     </tr><tr class=row>\n \t\t  <td colspan='2' align='center'>\n \t     <input class='btn btn-primary dropdown-toggle' type='submit' value='Submit' /><input class='btn btn-primary dropdown-toggle' type='button' value='Preview' name='button2' onclick='return Preview();' />\n";
    if ($newtopic) {
        $htmlout .= "Anonymous Topic<input type='checkbox' name='anonymous' value='yes'/>\n";
    } else {
        $htmlout .= "Anonymous Post<input type='checkbox' name='anonymous' value='yes'/>\n";
    }
    $htmlout .= "</td></tr></form>\n";
    $htmlout .= "<tr>\n\t\t\t\t<td colspan='2' align='right' class='tfoot'>\n\t\t\t\t" . insert_quick_jump_menu() . "\n\t\t\t\t</td>\n\t\t\t</tr>";
    $htmlout .= end_table();
    $htmlout .= "<br />";
    // $htmlout .= end_frame();
    // ------ Get 10 last posts if this is a reply
    if (!$newtopic && $INSTALLER09['show_last_10']) {
        $postres = sql_query("SELECT p.id, p.added, p.body, p.anonymous, u.id AS uid, u.enabled, u.class, u.donor, u.warned, u.chatpost, u.leechwarn, u.pirate, u.king, u.username, u.avatar, u.offensive_avatar " . "FROM posts AS p " . "LEFT JOIN users AS u ON u.id = p.user_id " . "WHERE p.topic_id=" . sqlesc($id) . " " . "ORDER BY p.id DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
        if (mysqli_num_rows($postres) > 0) {
            $htmlout .= "<br />";
            $htmlout .= begin_frame("10 last posts, in reverse order");
            while ($post = mysqli_fetch_assoc($postres)) {
                //$avatar = ($CURUSER["avatars"] == "all" ? htmlsafechars($post["avatar"]) : ($CURUSER["avatars"] == "some" && $post["offavatar"] == "no" ? htmlsafechars($post["avatar"]) : ""));
                $avatar = $CURUSER["avatars"] == "yes" ? avatar_stuff($post) : "";
                if ($post['anonymous'] == 'yes') {
                    $avatar = $INSTALLER09['pic_base_url'] . $Multi_forum['configs']['forum_pics']['default_avatar'];
                } else {
                    $avatar = $CURUSER["avatars"] == "yes" ? avatar_stuff($post) : '';
                }
                if (empty($avatar)) {
                    $avatar = $INSTALLER09['pic_base_url'] . $Multi_forum['configs']['forum_pics']['default_avatar'];
//.........这里部分代码省略.........
开发者ID:Bigjoos,项目名称:U-232-V5,代码行数:101,代码来源:post_functions.php


示例20: array

        $mc1->begin_transaction('userstats_' . $CURUSER["id"]);
        $mc1->update_row(false, array('seedbonus' => $update['seedbonus']));
        $mc1->commit_transaction($INSTALLER09['expires']['u_stats']);
        $mc1->begin_transaction('user_stats_' . $CURUSER["id"]);
        $mc1->update_row(false, array('seedbonus' => $update['seedbonus']));
        $mc1->commit_transaction($INSTALLER09['expires']['user_stats']);
        //===end
    }
    header("Refresh: 0; url={$locale_link}.php?id={$tid}{$extra_link}");
    die;
} elseif ($action == "vieworiginal") {
    if ($CURUSER['class'] < UC_STAFF) {
        stderr("{$lang['comment_error']}", "{$lang['comment_denied']}");
    }
    $commentid = isset($_GET['cid']) ? (int) $_GET['cid'] : 0;
    if (!is_valid_id($commentid)) {
        stderr("{$lang['comment_error']}", "{$lang['comment_invalid_id']}");
    }
    $res = sql_query("SELECT c.*, t.{$name} FROM comments AS c LEFT JOIN {$table_type} AS t ON c.{$locale} = t.id WHERE c.id=" . sqlesc($commentid)) or sqlerr(__FILE__, __LINE__);
    $arr = mysqli_fetch_assoc($res);
    if (!$arr) {
        stderr("{$lang['comment_error']}", "{$lang['comment_invalid_id']} {$commentid}.");
    }
    $HTMLOUT = '';
    $HTMLOUT .= "<h1>{$lang['comment_original_content']}#{$commentid}</h1>\n      <table width='500' border='1' cellspacing='0' cellpadding='5'>\n      <tr><td class='comment'>\n      " . htmlsafechars($arr["ori_text"]) . "\n      </td></tr></table>";
    $returnto = isset($_SERVER['HTTP_REFERER']) ? htmlsafechars($_SERVER['HTTP_REFERER']) : 0;
    if ($returnto) {
        $HTMLOUT .= "<p>(<a href='{$returnto}'>back</a>)</p>\n";
    }
    echo stdhead("{$lang['comment_original']}", true, $stdhead) . $HTMLOUT . stdfoot($stdfoot);
    die;
开发者ID:Bigjoos,项目名称:U-232-V5,代码行数:31,代码来源:comment.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_valid_plugin_name函数代码示例发布时间:2022-05-15
下一篇:
PHP is_valid_hostname函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap