<?php

include 'core/init.php';
$question_id = $_SESSION['id'];
$user_id = $session_user_id;
$query = "SELECT * FROM `answer_votes` WHERE `question_id`='{$question_id}' && `user_id`='{$session_user_id}'";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
if ($row != 0) {
    increment_vote($question_id);
    delete_user_id($question_id, $user_id);
} else {
    decrement_vote($question_id);
    add_user_id($question_id, $user_id);
}
示例#2
0
     $id1 = $argv[++$i];
     $id2 = $argv[++$i];
     if (!is_numeric($id1) || !is_numeric($id2)) {
         die("bad args\n");
     }
     if ($id2 < $id1) {
         die("bad args\n");
     }
     delete_user_id_range($id1, $id2);
 } else {
     if ($argv[$i] == "--id") {
         $id = $argv[++$i];
         if (!is_numeric($id)) {
             die("bad arg\n");
         }
         delete_user_id($id);
     } else {
         if ($argv[$i] == "--team_id_range") {
             $id1 = $argv[++$i];
             $id2 = $argv[++$i];
             if (!is_numeric($id1) || !is_numeric($id2)) {
                 die("bad args\n");
             }
             if ($id2 < $id1) {
                 die("bad args\n");
             }
             delete_team_id_range($id1, $id2);
         } else {
             if ($argv[$i] == "--banished") {
                 delete_banished();
             } else {