}
if ($v_pid != '') {
    if ($v_uid != '') {
        if ($v_uid == 0) {
            //Guest voting
            if ($_GET['type'] != 'sink') {
                GuestVote($v_pid, 'vote');
            } else {
                GuestVote($v_pid, 'sink');
            }
        } else {
            //Add vote
            if ($_GET['type'] != 'sink') {
                Vote($v_pid, $v_uid, 'vote');
            } else {
                Vote($v_pid, $v_uid, 'sink');
            }
        }
    }
    if ($v_tid == 'total') {
        echo GetVotes($v_pid, false);
    } else {
        if ($v_tid == 'percent') {
            //run the math as a percentage not total
            echo GetVotes($v_pid, true);
        } else {
            $barvotes = GetBarVotes($v_pid);
            echo $barvotes[0];
        }
    }
} else {
Beispiel #2
0
//                                                                           //
//  This program is free software. You may use, modify, and/or redistribute  //
//  it under the terms of the MIT License.                                   //
//                                                                           //
//***************************************************************************//
// Initialize OvBB.
require './includes/init.inc.php';
// What are they wanting to do?
switch ($_REQUEST['action']) {
    // Show voting results.
    case 'showresults':
        ShowResults();
        // Cast vote.
    // Cast vote.
    case 'vote':
        Vote();
        // Create new poll.
    // Create new poll.
    case 'newpoll':
        NewPoll();
}
// *************************************************************************** \\
// Displays results of a specified poll.
function ShowResults()
{
    global $CFG, $dbConn;
    // What poll do they want?
    $iPollID = (int) $_REQUEST['pollid'];
    // Get the poll information.
    $dbConn->query("SELECT question, answers, timeout, datetime FROM poll WHERE id={$iPollID}");
    if (!(list($strPollQuestion, $strPollAnswers, $iTimeout, $tPosted) = $dbConn->getresult())) {
<?php

/**
 * Created by PhpStorm.
 * User: 201087112
 * Date: 2015-10-30
 * Time: 11:45
 */
if (isset($_POST["Animaux"])) {
    Vote($_POST["Animaux"]);
}
function Vote($Vote)
{
    $chien = 0;
    $chat = 0;
    $oiseau = 0;
    $serpent = 0;
    $singe = 0;
    //premiere approche
    //Create File Name
    $myfile = fopen("FichierText.txt", "w");
    //Enter values from website to variables
    $radioButtonSelected = $_POST['Animaux'];
    //Write values in file
    fwrite($myfile, $radioButtonSelected . "\n");
    /*//Deuxieme approche
      switch($_POST['Animaux']) {
          case "Chien":
              $chien++;
              echo $chien;
              break;