<?php require_once "../includes/session.php"; require_once "../includes/db_connection.php"; require_once "../includes/functions.php"; if (isset($_POST["submit"])) { $user_id = mysqli_real_escape_string($connection, $_POST["user_id"]); $comment_id = mysqli_real_escape_string($connection, $_POST["comment_id"]); if ($_POST["user_id"] == "-1" || !user_logged_in()) { die("<scirpt>window.location.replace(\"log_in.php\");"); } if (already_downvoted($user_id, $comment_id)) { update_vote($user_id, $comment_id, "0"); } else { if (already_upvoted($user_id, $comment_id) || exists_but_neutral($user_id, $comment_id)) { update_vote($user_id, $comment_id, "-1"); } else { add_vote($user_id, $comment_id, "-1"); } } }
function post_new() { global $db, $pre, $Fid_db, $postdb, $fid, $fidDB, $mid, $lfjuid, $lfjdb, $webdb, $timestamp, $FROMURL, $aid, $votesdb, $vote_db, $groupdb, $web_admin, $fu_fiddb, $onlineip; $postdb['list'] = $postdb[top] ? $timestamp * 1.3 : $timestamp; if (!$postdb[posttime]) { $postdb[posttime] = $timestamp; } $erp = $Fid_db[iftable][$fid]; $db->query("\n\tINSERT INTO `{$pre}article{$erp}` \n\t( `title`, `smalltitle`, `fid`,`fname`, `hits`, `pages`, `posttime`, `list`, `uid`, `username`, `author`, `copyfrom`, `copyfromurl`, `titlecolor`, `fonttype`, `picurl`, `ispic`, `yz`, `yzer`, `yztime`, `keywords`, `jumpurl`, `iframeurl`, `style`, `template`, `target`,`ip`, `lastfid`, `money`, `passwd`, `editer`, `edittime`, `begintime`, `endtime`, `description`, `levels`,allowdown,allowview,mid,htmlname,forbidcomment,goods_sn)\n\tVALUES\n\t('{$postdb['title']}','{$postdb['smalltitle']}','{$fid}','{$fidDB['name']}','{$postdb['hits']}','1','{$postdb['posttime']}','{$postdb['list']}','{$lfjdb['uid']}','{$lfjdb['username']}','{$postdb['author']}','{$postdb['copyfrom']}','{$postdb['copyfromurl']}','{$postdb['titlecolor']}','{$postdb['fonttype']}','{$postdb['picurl']}','{$postdb['ispic']}','{$postdb['yz']}','{$postdb['yzer']}','{$postdb['yztime']}','{$postdb['keywords']}','{$postdb['jumpurl']}','{$postdb['iframeurl']}','{$postdb['style']}','{$postdb['template']}','{$postdb['target']}','{$onlineip}','0','{$postdb['money']}','{$postdb['passwd']}','{$postdb['editer']}','{$postdb['edittime']}','{$postdb['begintime']}','{$postdb['endtime']}','{$postdb['description']}','{$postdb['levels']}','{$postdb['allowdown']}','{$postdb['allowview']}','{$mid}','{$postdb['htmlname']}','{$postdb['forbidcomment']}','{$postdb['goods_sn']}')\n\t"); if ($postdb[htmlname]) { //自定义内容页文件名 get_showhtmltype(); } $II = 1; $aid = $db->insert_id(); $db->query("INSERT INTO `{$pre}article_db` (`aid`) VALUES ('{$aid}')"); //辅栏目处理 query_fu_sort($fu_fiddb, $aid); //添加内容 query_reply($aid, '', 'postnew'); //财富处理 $array = array('title' => $postdb[title], 'fid' => $fid, 'aid' => $aid); if ($postdb[yz]) { Give_article_money($lfjuid, 'yz', $array); } if ($postdb[com]) { Give_article_money($lfjuid, 'com', $array); } //添加关键字 keyword_add($aid, $postdb[keywords], $lfjdb[uid]); //投票 if ($votesdb[1][title] || $votesdb[2][title] || $votesdb[3][title]) { if (!$vote_db[name]) { $vote_db[name] = $postdb[title]; } if (!$vote_db[about]) { $vote_db[about] = $postdb[title]; } //有些用户组是无权限的 if ($groupdb[SetVote] || $web_admin) { add_vote($aid); } } //删除缓存文件 delete_cache_file($fid, $aid); //定时发布 corntab_post('DE'); corntab_post('EN', $aid); }
if ($account === false && (isset($_POST["name"]) && $_POST["name"] == "")) { echo "Please enter your name"; } else { $intervals = array(); $ids = get_schedules_for_event($event["id"]); foreach ($ids as $id) { array_push($intervals, array($id["id"], $_POST[$id["id"] . ""])); } $userid = 0; if ($account !== false) { $userid = add_vote("", $intervals, $event["id"], $account); } else { if ($event["public"] == 0) { $userid = add_vote(isset($_POST["name"]) ? $_POST["name"] : "", $intervals, $event["id"], 0, $_GET["key"]); } else { $userid = add_vote(isset($_POST["name"]) ? $_POST["name"] : "", $intervals, $event["id"]); } } if ($event["public"] == 0) { if ($account !== false) { update_invite_account($event["id"], $account, $userid); } else { update_invite($event["id"], $_GET["key"], $userid); } } } } if ($event["public"] == 0 && isset($_GET["key"])) { header("Location: view?event=" . $_GET["event"] . "&key=" . $_GET["key"] . "#results"); } else { header("Location: view?event=" . $_GET["event"] . "#results");
$sum = $rating['0']['SUM(valeur)']; $count = $rating['0']['COUNT(valeur)']; function show_adr($adr, $dep, $ville) { $mon_adresse = $adr . ", " . $dep . ", " . $ville; return $mon_adresse; } $resultat_adr = recuperer_adr(); foreach ($resultat_adr as $n) { $tab_adr[] = show_adr($n[12], $n[11], $n[10]); } print_r($tab_adr); //show_adr($mon_event[12], $mon_event[11], $mon_event[10]); $verif_user_vote = verif_user($_SESSION['prenom'], $_GET['id']); //print_r($verif_user_vote[0]); /* calcul de la moyenne du rating*/ if ($count == 0) { $rating_star = 0; } else { $arrondi = round($sum / $count); $rating_star = intval($arrondi); } /*verification + ajout d'un vote */ if (isset($_POST['id']) && isset($_POST['prenom']) && isset($_POST['valeur'])) { if ($verif_user_vote > 0) { echo 'vous avez déja voté !!'; } echo 'Merci d\'avoir voté :)'; add_vote($_POST['id'], $_POST['prenom'], $_POST['valeur']); } include dirname(__FILE__) . '/../vues/evenement2.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(); ?>
function add_votes_options() { if (isset($_POST['action']) && $_POST['action'] == 'vote_comm') { $comm_id = (int) $_POST['commid']; if (!$comm_id) { echo 'e'; die(0); } if (isset($_COOKIE["bymt_voted_" . $comm_id])) { echo 'h'; die(0); } $c_rating = $_POST['rating']; if ($c_rating != 'up') { $c_rating == 'down'; } if (is_user_logged_in()) { global $current_user; get_currentuserinfo(); $cc_user = $current_user->user_login; $c_user = $cc_user . "[注册用户]"; $c_email = $current_user->user_email; $cc_url = $current_user->user_url; $c_url = empty($cc_url) ? "#注册用户" : $cc_url; } else { $COOKIEHASH = md5("http://" . $_SERVER['HTTP_HOST']); if (isset($_COOKIE['comment_author_' . $COOKIEHASH]) && isset($_COOKIE['comment_author_email_' . $COOKIEHASH])) { $c_user = $_COOKIE['comment_author_' . $COOKIEHASH]; $c_email = $_COOKIE['comment_author_email_' . $COOKIEHASH]; if (isset($_COOKIE['comment_author_url_' . $COOKIEHASH])) { $c_url = $_COOKIE['comment_author_url_' . $COOKIEHASH]; } else { $c_url = "nourl"; } } else { $c_user = "******"; $c_email = "noemail"; $c_url = "#nourl"; } } $c_ip = bymt_getIP('Ip'); date_default_timezone_set('PRC'); $c_time = date("Y-m-d H:i:s ", time()); $add_vote = add_vote($comm_id, $c_user, $c_email, $c_url, $c_rating, $c_ip, $c_time); if ($add_vote == 'y') { setcookie("bymt_voted_" . $comm_id, $c_rating, time() + 86400, '/'); echo 'y'; die(0); } if ($add_vote == 'h') { setcookie("bymt_voted_" . $comm_id, $c_rating, time() + 86400, '/'); echo 'h'; die(0); } if ($add_vote == 'e') { echo 'n'; die(0); } } else { echo 'e'; } die(0); }