本文整理汇总了PHP中vote函数的典型用法代码示例。如果您正苦于以下问题:PHP vote函数的具体用法?PHP vote怎么用?PHP vote使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vote函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mysql_fetch_assoc
");
</SCRIPT>
<?php
}
if (mysql_num_rows($check) > 0) {
$last_vote = mysql_fetch_assoc($check);
$whenIcanvote = strtotime($last_vote['date']) + 12 * 60 * 60;
// + 12 Hours
if (time() >= $whenIcanvote) {
vote();
$voted = 1;
} else {
$voted = 0;
}
} else {
vote();
$voted = 1;
}
echo '
<div class="subsection">
<div class="middle">';
if ($voted == 1) {
echo '!!!';
} else {
echo '??!';
}
echo '
</div>
<div class="right">
<h2 class="caption">' . $Vote['Vote21'] . '</h2>';
if ($voted == 1) {
示例2: define
<?php
define('PUN_ROOT', './');
require PUN_ROOT . 'include/common.php';
if (!$pun_user['g_read_board']) {
message($lang_common['No view']);
}
$to = isset($_GET['to']) ? intval($_GET['to']) : 0;
if ($to > 0) {
echo vote($to, intval($_GET['vote']));
exit;
}
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if ($id < 1) {
message($lang_common['Bad request']);
}
$q = $db->fetch_row($db->query('
SELECT COUNT(1), (SELECT COUNT(1) FROM `' . $db->prefix . 'karma` WHERE `vote` = "-1" AND `to` = ' . $id . ') FROM `' . $db->prefix . 'karma` WHERE `vote` = "1" AND `to` = ' . $id));
$karma['plus'] = intval($q[0]);
$karma['minus'] = intval($q[1]);
$karma['karma'] = $karma['plus'] - $karma['minus'];
unset($q);
$num_hits = $karma['plus'] + $karma['minus'];
$num_pages = ceil($num_hits / $pun_user['disp_posts']);
$p = !isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages ? 1 : $_GET['p'];
$start = ($p - 1) * $pun_user['disp_posts'];
if (isset($_GET['action']) && $_GET['action'] == 'all') {
$p = $num_pages + 1;
$pun_user['disp_posts'] = $num_hits;
$start = 0;
}
示例3: eval
} else {
$isintern = '';
}
$title = $ds['titel'];
eval("\$poll_head = \"" . gettemplate("poll_head") . "\";");
echo $poll_head;
for ($n = 1; $n <= 10; $n++) {
if ($ds['o' . $n]) {
$options[] = $ds['o' . $n];
}
}
$n = 1;
foreach ($options as $option) {
$option = $option;
eval("\$poll_content = \"" . gettemplate("poll_content") . "\";");
echo $poll_content;
$n++;
}
$pollID = $ds['pollID'];
eval("\$poll_foot = \"" . gettemplate("poll_foot") . "\";");
echo $poll_foot;
}
} else {
echo $_language->module['no_active_poll'] . '<br /><br />• <a href="index.php?site=polls">' . $_language->module['show_polls'] . '</a>';
}
}
if (!isset($pollID)) {
$pollID = '';
}
vote($pollID);
示例4: array
$rounds = array();
for ($i = 1; $i <= 6; $i++) {
array_push($rounds, $i);
}
foreach ($rounds as $roundvalue) {
if ($roundvalue == $round) {
echo '<option value="' . $roundvalue . '" selected="' . $roundvalue . '"> Round ' . $roundvalue . '</option>' . "\n";
} else {
echo '<option value="' . $roundvalue . '"> Round ' . $roundvalue . '</option>' . "\n";
}
}
?>
</select>
</center>
<br>
</form>
<?php
echo "<div class=\"center\"><strong>Round " . $round . "</strong></div>";
if ($action == "view") {
view_matches($round);
} elseif ($action == "write") {
vote($match, $band, true, $round);
} elseif ($action == "close") {
close_match($match, $round);
}
?>
</div>
</div> <!-- end of row div -->
<?php
}
require "partials/_footer.php";
示例5: define
<?php
define('DarkCoreCMS', TRUE);
include 'config.php';
include 'functions/vote_functions.php';
include 'functions/global_functions.php';
if (isset($_GET['user']) && isset($_GET['siteid'])) {
$user = $_GET['user'];
$siteid = $_GET['siteid'];
$site_data = getSite_data_byID($siteid);
if (isset($site_data['postback']) && $site_data['postback'] != NULL) {
header('Location: ' . $site_data['link'] . $site_data['postback'] . $user);
} else {
$do_vote = vote($user, $siteid);
if ($do_vote != 0) {
$date = new DateTime();
$cur_time = $date->getTimestamp();
$day_number = idate('w', $cur_time);
if ($day_number == 6 || $day_number == 0) {
add_points($user, $site_data['end_week_points']);
} else {
add_points($user, $site_data['points']);
}
header('Location: ../user?done=1');
}
header('Location: ' . $site_data['link']);
}
} else {
header('Location: ../');
}
示例6: pwEscape
$expression = $winduid ? 'v.uid=' . pwEscape($winduid) : 'v.username=' . pwEscape($onlineip);
$readvote = $db->get_one("SELECT p.*,v.tid AS havevote FROM pw_polls p LEFT JOIN pw_voter v ON p.tid=v.tid AND {$expression} WHERE p.tid=" . pwEscape($tid) . " GROUP BY p.tid");
if ($action == 'modify' && !$readvote['modifiable']) {
Showmsg('vote_not_modify');
}
$voters = $readvote['voters'];
$special = 'read_vote';
$vote_close = $read['state'] || $readvote['timelimit'] && $timestamp - $read['postdate'] > $readvote['timelimit'] * 86400 ? 1 : 0;
$tpc_date = get_date($read['postdate']);
$tpc_endtime = $readvote['timelimit'] ? get_date($read['postdate'] + $readvote['timelimit'] * 86400) : 0;
$regdatelimit = $readvote['regdatelimit'] ? get_date($readvote['regdatelimit'], 'Y-m-d') : '';
$creditlimit = !empty($readvote['creditlimit']) ? unserialize($readvote['creditlimit']) : '';
if ($creditlimit) {
require_once R_P . 'require/credit.php';
}
vote($readvote);
function vote($readvote)
{
global $db, $votetype, $ifview, $votedb, $votesum, $action, $viewvoter, $tid, $admincheck, $vote_close;
$votearray = unserialize($readvote['voteopts']);
$votetype = $readvote['multiple'] ? 'checkbox' : 'radio';
$votesum = 0;
$votedb = $voter = array();
$ifview = $viewvoter == 'yes' ? 'no' : 'yes';
foreach ($votearray as $key => $option) {
$votesum += $option[1];
}
if ($viewvoter == 'yes') {
$query = $db->query("SELECT username,vote FROM pw_voter WHERE tid=" . pwEscape($tid) . " LIMIT 500");
while ($rt = $db->fetch_array($query)) {
$voter[$rt['vote']] .= "<span class=bold>{$rt['username']}</span>" . ' ';
示例7: edit_quote
case 'editqueue':
if (isset($_SESSION['logged_in']) && $_SESSION['level'] <= USER_ADMIN) {
edit_quote($page[0], $page[1], $page[2]);
}
break;
case 'users':
if (isset($_SESSION['logged_in']) && $_SESSION['level'] <= USER_SUPERUSER) {
edit_users($page[1], $page[2]);
}
break;
case 'ajaxvote':
case 'vote':
if (isset($CONFIG['login_required']) && $CONFIG['login_required'] == 1 && !isset($_SESSION['logged_in'])) {
break;
}
vote($page[1], $page[2], $page[0] === 'ajaxvote');
break;
case 'voters':
if (isset($_SESSION['logged_in']) && $_SESSION['level'] <= USER_ADMIN) {
show_quote_voters($page[1]);
}
break;
case 'reorder':
if (isset($_SESSION['logged_in']) && $_SESSION['level'] <= USER_SUPERUSER) {
reorder_quotes();
}
break;
case 'spam':
if (isset($_SESSION['logged_in']) && $_SESSION['level'] <= USER_ADMIN) {
show_spam();
}
示例8: menue
}
// menue
// set hide menue
if (isset($_GET["h"])) {
$_SESSION['h'] = $_GET["h"];
}
$menue = menue();
$log = menue2();
// user and programm
$user = $db->real_escape_string($_SESSION['us']);
$programm = "";
if (isset($_GET["p"])) {
$programm = $_GET["p"];
}
// save vote
vote($db);
// which fotos & display
$uploader = next_foto($db, $programm);
// menue with settings
$settings = menue3();
}
// end logged in
$db->close();
}
?>
</head>
<body>
<center>
<?php
// if menue
示例9: sprintf
$fromUsername = $postObj->FromUserName;
$toUsername = $postObj->ToUserName;
$form_MsgType = $postObj->MsgType;
$msgid = $postObj->MsgId;
if ($form_MsgType == "event") {
$form_Event = $postObj->Event;
if ($form_Event == "subscribe") {
$contentStr = "感谢您关注抵抗组织助手!\n游戏介绍请点击http://45.118.133.173/resistance.jpg\n输入“帮助”获取游戏指南。";
$resultStr = sprintf($textTpl, $fromUsername, $toUsername, time(), $contentStr);
echo $resultStr;
exit;
}
} elseif ($form_MsgType == "text") {
$form_content = trim($postObj->Content);
if (preg_match($pattern_vote, $form_content)) {
$feedback = vote($form_content, $fromUsername, $msgid);
} elseif (preg_match($pattern_create, $form_content)) {
$feedback = create($form_content, $fromUsername);
} elseif (preg_match($pattern_room, $form_content)) {
$feedback = room($form_content, $fromUsername);
} else {
$feedback = command($form_content, $fromUsername);
}
$resultStr = sprintf($textTpl, $fromUsername, $toUsername, time(), $feedback);
echo $resultStr;
exit;
}
} else {
echo "";
exit;
}
示例10: header
}
return $result;
}
if (isset($_GET["suggestion"])) {
$suggestion = $_GET["suggestion"];
$motivation = "";
$verification = "";
if (isset($_GET["motivation"])) {
$motivation = $_GET["motivation"];
}
if (isset($verification)) {
$verification = $_GET["verification"];
} else {
header("Content-Type: application/json;charset=utf-8");
die(json_encode(array("error" => "Missing validation")));
}
header("Content-Type: application/json;charset=utf-8");
echo json_encode(array("result" => addSuggestion($suggestion, $verification, $motivation)));
}
if (isset($_GET["list"])) {
header("Content-Type: application/json;charset=utf-8");
echo json_encode(getSuggestions());
}
if (isset($_GET["vote"])) {
header("Content-Type: application/json;charset=utf-8");
echo json_encode(vote(filter_var($_GET["id"], FILTER_SANITIZE_NUMBER_INT)));
}
if (isset($_GET["votes"])) {
header("Content-Type: application/json;charset=utf-8");
echo json_encode(getVotes());
}
示例11: info
$index = info(_vote_successful, "?action=show&id=" . $_GET['id'] . "");
}
}
if (isset($userid)) {
$cookie = $userid;
} else {
$cookie = "voted";
}
}
set_cookie($prev . "vid_" . $_GET['id'], $cookie);
}
}
if ($_GET['ajax'] == 1) {
header("Content-type: text/html; charset=utf-8");
include basePath . '/inc/menu-functions/vote.php';
echo '<table class="navContent" cellspacing="0">' . vote(1) . '</table>';
exit;
}
if ($_GET['what'] == "fvote") {
if (empty($_POST['vote'])) {
$index = error(_vote_no_answer);
} else {
$qry = db("SELECT * FROM " . $db['votes'] . "\n WHERE id = '" . intval($_GET['id']) . "'");
$get = _fetch($qry);
if (ipcheck("vid_" . $_GET['id'])) {
$index = error(_error_voted_again, 1);
} elseif ($get['closed'] == 1) {
$index = error(_error_vote_closed, 1);
} else {
if (isset($userid)) {
$time = $userid;
示例12: session_start
<?php
session_start();
require_once 'fns.php';
//投票业务逻辑处理
//从投票页面得到的变量
$username = $_SESSION['username'];
$user_id = get_user_id($username);
$opt = $_POST;
foreach ($opt as $key => $value) {
// echo $key." and ".$value."<br>";
$topic_id = $key;
$ABC = $value;
if (!is_user_voted($user_id, $topic_id)) {
vote($user_id, $topic_id);
//实现在user_topic表中添加项目,记录选票信息
add_vote($topic_id, $ABC);
//在opt表中实现选票数的增加
} else {
// do_html_header('投票失败');
echo $topic_id . "号问题你已经投过票了,不能再投了" . "<br>";
// do_html_URL('user_main.php','返回主界面');
// do_html_footer();
// exit;
}
}
do_html_header('投票完成');
echo "投票完成!" . "<br>";
do_html_URL('user_main.php', '返回主界面');
do_html_footer();
?>
示例13: define
<?php
define('DarkCoreCMS', TRUE);
include 'config.php';
include 'functions/vote_functions.php';
include 'functions/global_functions.php';
if (isset($_POST['pbid'])) {
$site_data = getSite_data_byID(4);
$do_vote = vote($_POST['pbid'], $_GET['siteid']);
if ($day_number == 6 || $day_number == 0) {
add_points($_POST['pbid'], $site_data['end_week_points']);
} else {
add_points($_POST['pbid'], $site_data['points']);
}
} else {
header('Location: ../');
}
示例14: vote
echo "checked";
}
?>
> 활성화
<input type="radio" name="chk_info" value="off" <?php
if ($activation[0][0] == 2) {
echo "checked";
}
?>
> 비활성화
<input type="submit" value="Save" /><br /><br />
</form>
<?php
$radio = $_POST['chk_info'];
if ($radio == 'off') {
vote('admin', 1000);
} else {
if ($radio == 'on') {
voteRESET();
}
}
$activation = dietwar_status();
?>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<?php
for ($i = 1; $i < $file_count; $i++) {
?>
<li data-target="#myCarousel" data-slide-to="<?php
示例15: filter_input
<?php
include "inc/config.php";
$id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_HIGH | FILTER_FLAG_ENCODE_LOW);
if (is_null($id)) {
die("The id is required");
} else {
echo "Id:{$id}";
}
vote($id);