#1 2014-05-14 16:12:06

ruberninja1
Endora uživatel
Registrován: 2012-12-01
Příspěvky: 416

Problém s anketou - PHP fusion

Dobrý den, chtěl bych se zeptat
Vždy když jsem vytvořil anketu (veřejnou anketu) na webu tak šlo hlasovat z každé IP adresy jen jednou
A od minulého týdne to začalo nějak blbnout že se dá hlasovat s jedné IP adresy třeba asi jednou za 6 hodin
Nevíte v čem by mohla být chyba ?
Používám infusion IP_poll_panel

Offline

#2 2014-05-14 17:23:57

kksmirice
Endora rádce
Místo: Vrchovnice
Registrován: 2011-11-20
Příspěvky: 6,023
Web

Re: Problém s anketou - PHP fusion

To je věcí CMS nikoliv hostingu.
Podívejte se na nastavení session atd.


1. Murphyho zákon:
Na počátku nebylo nic. I to se pokazilo!

stránky: CMS test
kontakt - instalace systémů, MySQL, FTP přístup, ...
Instalační balíky vybraných CSM

Problémy spojené s provozem služeb Endora, řešte na tomto fóru.

Offline

#3 2014-05-14 19:03:59

ruberninja1
Endora uživatel
Registrován: 2012-12-01
Příspěvky: 416

Re: Problém s anketou - PHP fusion

Session jsem tam nenašel..
Hledal jsem v těchto souborech..
infusion.php

<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: infusion.php
| Author: Jeepers1993
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

if (!defined("DB_IP_POLL")) {
	define("DB_IP_POLL", DB_PREFIX."ip_polls");
}
// Infusion Information
$inf_title = "IP Polls";
$inf_description = "An IP based poll system.";
$inf_version = "2.0";
$inf_developer = "Jeepers1993";
$inf_email = "stef_webmaster@hotmail.com";
$inf_weburl = "http://swfgames.nl.am/";

// Infusion Paths
$inf_folder = "ip_poll_panel";


// Database Table information : Create database tables.
 $inf_newtable[1] = DB_IP_POLL." (
  `poll_id` smallint(5) unsigned NOT NULL auto_increment,
  `poll_title` varchar(200) NOT NULL,
  `poll_opt_0` varchar(200) NOT NULL,
  `poll_opt_1` varchar(200) NOT NULL,
  `poll_opt_2` varchar(200) NOT NULL,
  `poll_opt_3` varchar(200) NOT NULL,
  `poll_opt_4` varchar(200) NOT NULL,
  `poll_opt_5` varchar(200) NOT NULL,
  `poll_opt_6` varchar(200) NOT NULL,
  `poll_opt_7` varchar(200) NOT NULL,
  `poll_opt_8` varchar(200) NOT NULL,
  `poll_opt_9` varchar(200) NOT NULL,
  `poll_votes_0` smallint(5) unsigned NOT NULL default '0',
  `poll_votes_1` smallint(5) unsigned NOT NULL default '0',
  `poll_votes_2` smallint(5) unsigned NOT NULL default '0',
  `poll_votes_3` smallint(5) unsigned NOT NULL default '0',
  `poll_votes_4` smallint(5) unsigned NOT NULL default '0',
  `poll_votes_5` smallint(5) unsigned NOT NULL default '0',
  `poll_votes_6` smallint(5) unsigned NOT NULL default '0',
  `poll_votes_7` smallint(5) unsigned NOT NULL default '0',
  `poll_votes_8` smallint(5) unsigned NOT NULL default '0',
  `poll_votes_9` smallint(5) unsigned NOT NULL default '0',
  `poll_ips` text NOT NULL,
  `poll_started` int(10) unsigned NOT NULL,
  `poll_ended` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY (`poll_id`)
) ENGINE=MyISAM;";

// Database Table Drop Command : Drop tables if infusion is uninstalled.
$inf_droptable[1] = DB_IP_POLL;

$inf_adminpanel[1] = array(
	"title" => "IP Polls",
	"image" => "polls.gif",
	"panel" => "ip_poll_admin.php",
	"rights" => "IPP"
);

?>

IP_poll_admin.php

<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: ip_poll_admin.php
| Author: Jeepers1993
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES."templates/admin_header.php";
include LOCALE.LOCALESET."admin/polls.php";
if (!defined("DB_IP_POLL")) {
	define("DB_IP_POLL", DB_PREFIX."ip_polls");
}
if (!checkrights("IPP") || !defined("iAUTH") || $_GET['aid'] != iAUTH) { redirect("../index.php"); }
if (isset($_GET['poll_id']) && !isnum($_GET['poll_id'])) { redirect(FUSION_SELF); }

if (isset($_GET['status']) && !isset($message)) {
	if ($_GET['status'] == "sn") {
		$message = $locale['410'];
	} elseif ($_GET['status'] == "su") {
		$message = $locale['411'];
	} elseif ($_GET['status'] == "del") {
		$message = $locale['412'];
	}
	if ($message) {	echo "<div class='admin-message'>".$message."</div>\n"; }
}

if (isset($_POST['save'])) {
	$poll_title = trim(stripinput($_POST['poll_title']));
	$poll_option = array();
	foreach($_POST['poll_option'] as $key => $value) {
		$poll_option[$key] = trim(stripinput($_POST['poll_option'][$key]));
	}
	if (isset($_GET['poll_id']) && isnum($_GET['poll_id'])) {
		if ($poll_title && count($poll_option)) {
			$ended = (isset($_POST['close']) ? time() : 0);
			$result = dbquery("UPDATE ".DB_IP_POLL." SET poll_title='$poll_title', poll_opt_0='$poll_option[0]', poll_opt_1='$poll_option[1]', poll_opt_2='$poll_option[2]', poll_opt_3='$poll_option[3]', poll_opt_4='$poll_option[4]', poll_opt_5='$poll_option[5]', poll_opt_6='$poll_option[6]', poll_opt_7='$poll_option[7]', poll_opt_8='$poll_option[8]', poll_opt_9='$poll_option[9]', poll_ended='$ended' WHERE poll_id='".$_GET['poll_id']."'");
			redirect(FUSION_SELF.$aidlink."&amp;status=su");
		} else {
			redirect(FUSION_SELF.$aidlink);
		}
	} else {
		if ($poll_title && count($poll_option)) {
			$result = dbquery("UPDATE ".DB_IP_POLL." SET poll_ended='".time()."' WHERE poll_ended='0'");
			$result = dbquery("INSERT INTO ".DB_IP_POLL." (poll_title, poll_opt_0, poll_opt_1, poll_opt_2, poll_opt_3, poll_opt_4, poll_opt_5, poll_opt_6, poll_opt_7, poll_opt_8, poll_opt_9, poll_started, poll_ended) VALUES ('$poll_title', '$poll_option[0]', '$poll_option[1]', '$poll_option[2]', '$poll_option[3]', '$poll_option[4]', '$poll_option[5]', '$poll_option[6]', '$poll_option[7]', '$poll_option[8]', '$poll_option[9]', '".time()."', '0')");
			redirect(FUSION_SELF.$aidlink."&amp;status=sn");
		} else {
			redirect(FUSION_SELF.$aidlink);
		}
	}
} else if (isset($_POST['delete']) && (isset($_POST['poll_id']) && isnum($_POST['poll_id']))) {
	$result = dbquery("SELECT * FROM ".DB_IP_POLL." WHERE poll_id='".$_POST['poll_id']."'");
	if (dbrows($result) != 0) $result = dbquery("DELETE FROM ".DB_IP_POLL." WHERE poll_id='".$_POST['poll_id']."'");
	redirect(FUSION_SELF.$aidlink."&amp;status=del");
} else {
	if (isset($_POST['preview'])) {
		$poll = ""; $i = 0;
		$poll_title = stripinput($_POST['poll_title']);
		while ($i < count($_POST['poll_option'])) {
			$poll_option[$i] = trim(stripinput($_POST['poll_option'][$i]));
			if (!$poll_option[$i]) { $poll_option[$i] = $locale['439']; }
			$poll .= "<label><input type='radio' name='option[]' /> ".$poll_option[$i]."</label><br /><br />\n";
			$i++;
		}
		$opt_count = (isset($_POST['opt_count']) && $_POST['opt_count'] != 10 ? count($poll_option) : $_POST['opt_count']);
		if ($poll_title) {
			opentable($locale['403']);
			echo "<table cellpadding='0' cellspacing='0' width='280' class='center'>\n<tr>\n";
			echo "<td class='tbl'><strong>".$poll_title."</strong><br /><br />\n".$poll."</td>\n";
			echo "</tr>\n<tr>\n";
			echo "<td align='center' class='tbl'><input type='button' name='blank' value='".$locale['430']."' class='button' style='width:70px' /></td>\n";
			echo "</tr>\n</table>\n";
			closetable();
		}
	}
	$editlist = "";
	$result = dbquery("SELECT * FROM ".DB_IP_POLL." ORDER BY poll_id DESC");
	if (dbrows($result)) {
		while ($data = dbarray($result)) {
			$editlist .= "<option value='".$data['poll_id']."'>".$data['poll_title']."</option>\n";
		}
		opentable($locale['402']);
		echo "<div style='text-align:center'>\n<form name='editform' method='post' action='".FUSION_SELF.$aidlink."'>\n";
		echo "<select name='poll_id' class='textbox' style='width:200px;'>\n".$editlist."</select>\n";
		echo "<input type='submit' name='edit' value='".$locale['421']."' class='button' />\n";
		echo "<input type='submit' name='delete' value='".$locale['422']."' class='button' />\n";
		echo "</form>\n</div>\n";
		closetable();
	}
	if (isset($_POST['edit']) && (isset($_POST['poll_id']) && isnum($_POST['poll_id']))) {
		$_GET['poll_id'] = $_POST['poll_id'];
		$data = dbarray(dbquery("SELECT * FROM ".DB_IP_POLL." WHERE poll_id='".$_POST['poll_id']."'"));
		$poll_title = $data['poll_title'];
		$poll_option = array();
		for ($i = 0; $i <= 9; $i++) {
			if ($data["poll_opt_".$i]) { $poll_option[$i] = $data["poll_opt_".$i]; }
		}
		$opt_count = count($poll_option);
		$poll_started = $data['poll_started'];
		$_GET['poll_ended'] = $data['poll_ended'];
	}
	if (isset($_POST['addoption'])) {
		$poll_title = stripinput($_POST['poll_title']);
		if (isset($_POST['poll_option']) && is_array($_POST['poll_option'])) {
			foreach($_POST['poll_option'] as $key => $value) {
				$poll_option[$key] = stripinput($_POST['poll_option'][$key]);
			}
			$opt_count = ($_POST['opt_count'] != 10 ? count($poll_option) + 1 : $_POST['opt_count']);
		} else {
			$poll_option[0] = "";
			$opt_count = 1;
		}
	}
	$i = 0; $opt = 1;
	$poll_title = isset($poll_title) ? $poll_title : "";
	$opt_count = isset($opt_count) ? $opt_count : 2;
	if (isset($poll_id)) $poll_ended = isset($poll_ended) ? $poll_ended : 0;
	opentable((isset($_GET['poll_id']) ? $locale['401'] : $locale['400']));
	echo "<form name='pollform' method='post' action='".FUSION_SELF.$aidlink.(isset($_GET['poll_id']) ? "&amp;poll_id=".$_GET['poll_id']."&amp;poll_ended=".$_GET['poll_ended'] : "")."'>\n";
	echo "<table cellpadding='0' cellspacing='0' width='280' class='center'>\n<tr>\n";
	echo "<td width='80' class='tbl'>".$locale['431']."</td>\n";
	echo "<td class='tbl'><input type='text' name='poll_title' value='".$poll_title."' class='textbox' style='width:200px' /></td>\n";
	echo "</tr>\n";
	while ($i != $opt_count) {
		$poll_opt = isset($poll_option[$i]) ? $poll_option[$i] : "";
		echo "<tr>\n<td width='80' class='tbl'>".$locale['432']."$opt</td>\n";
		echo "<td class='tbl'><input type='text' name='poll_option[".$i."]' value='".$poll_opt."' class='textbox' style='width:200px' /></td>\n</tr>\n";
		$i++; $opt++;
	}
	echo "</table>\n";
	echo "<table cellpadding='0' cellspacing='0' width='280' class='center'>\n<tr>\n";
	echo "<td align='center' class='tbl'><br />\n";
	if (isset($_GET['poll_id']) && !$_GET['poll_ended']) {
		echo "<input type='checkbox' name='close' value='yes' />".$locale['433']."<br /><br />\n";
	}
	if (!isset($_GET['poll_id']) || (isset($_GET['poll_id']) && !$_GET['poll_ended'])) {
		echo "<input type='hidden' name='opt_count' value='".$opt_count."' />\n";
		echo "<input type='submit' name='addoption' value='".$locale['436']."' class='button' />\n";
		echo "<input type='submit' name='preview' value='".$locale['437']."' class='button' />\n";
		echo "<input type='submit' name='save' value='".$locale['438']."' class='button' />\n";
	} else {
		echo $locale['434'].showdate("shortdate", $poll_started)."<br />\n";
		echo $locale['435'].showdate("shortdate", $_GET['poll_ended'])."<br />\n";
	}
	echo "</td>\n</tr>\n</table>\n</form>\n";
	closetable();
}
	echo "<br \><br \>";
	echo "<div width='100%' align='center'><strong>IP Polls Modified by <a target='_BLANK' href='http://swfgames.nl.am/'>Jeepers1993</a><br />Based on <a target='_BLANK' href='http://www.php-fusion.co.uk/'>Digitanium's</a> V5 IP Polls</strong></div>";
require_once THEMES."templates/footer.php";
?>

IP_poll_archive.php

<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: ip_poll_archive.php
| Author: Jeepers1993
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES."templates/header.php";

if (file_exists(INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."ip_poll_panel/locale/English.php";
}

$result = dbquery("SELECT * FROM ".$db_prefix."ip_polls WHERE poll_ended!='0' ORDER BY poll_id DESC");
if (dbrows($result) != 0) {
	$view_list = "";
	while ($data = dbarray($result)) {
		$view_list .= "<option value='".$data['poll_id']."'>".$data['poll_title']."</option>\n";
	}
	opentable($locale['PLAN_107']);
	echo "<form name='pollsform' method='post' action='".FUSION_SELF."'>
<center>
".$locale['PLAN_108']."<br>
<select name='oldpoll_id' class='textbox'>
$view_list</select>
<input type='submit' name='view' value='".$locale['PLAN_109']."' class='button'>
</center>
</form>\n";
	closetable();
}
if (isset($_POST['oldpoll_id'])) {
	$oldpoll_id = $_POST['oldpoll_id'];
	if (!isNum($oldpoll_id)) { header("Location: ".FUSION_SELF); exit; }
	$data = dbarray(dbquery("SELECT * FROM ".$db_prefix."ip_polls WHERE poll_id='$oldpoll_id' AND poll_ended!='0'"));
	$oldpoll_votes = 0;
	for ($i=0; $i<=9; $i++) {
		if ($data["poll_opt_".$i]) $oldpoll_option[$i] = $data["poll_opt_".$i];
		$oldpoll_votes = $oldpoll_votes + $data["poll_votes_".$i];
	}
	$poll_archive = ""; $i = 0;
	while ($i < count($oldpoll_option)) {
		$oldnum_votes = $data["poll_votes_".$i];
		$oldopt_votes = ($oldpoll_votes ? number_format(100 / $oldpoll_votes * $oldnum_votes) : 0);
		$poll_archive .= $oldpoll_option[$i]."<br>
<img src='".THEME."images/pollbar.gif' alt='".$oldpoll_option[$i]."' height='12' width='$oldopt_votes%' class='poll'><br>
".$oldopt_votes."% [".$oldnum_votes." ".($oldnum_votes == 1 ? $locale['PLAN_102'] : $locale['PLAN_103'])."]<br>\n";
		$i++;
	}
	tablebreak();
	opentable($locale['PLAN_110']);
	echo "<table align='center' width='200' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td>".$data['poll_title']."
<hr>
$poll_archive
<center><br>
".$locale['PLAN_104'].$oldpoll_votes."<br>
".$locale['PLAN_105'].showdate("shortdate", $data['poll_started'])."<br>
".$locale['PLAN_106'].showdate("shortdate", $data['poll_ended'])."
</center>
</td>
</td>
</table>\n";
	closetable();
}

require_once THEMES."templates/footer.php";
?>

IP_poll_panel.php

<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: ip_poll_panel.php
| Author: Jeepers1993
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (file_exists(INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."ip_poll_panel/locale/English.php";
}

openside($locale['PLAN_100']);
if (isset($_POST['cast_vote'])) {
	$voteoption = $_POST['voteoption'];
	$poll_id = $_POST['poll_id'];
	$sql = dbquery("SELECT * FROM ".$db_prefix."ip_polls WHERE poll_id='$poll_id'");
	$data = dbarray($sql);
	$poll_ips = explode("|", $data['poll_ips']);
	if (!in_array(USER_IP, $poll_ips)) {
		array_push($poll_ips, USER_IP);
		$poll_ips = implode("|", $poll_ips);
		$result = dbquery("UPDATE ".$db_prefix."ip_polls SET poll_votes_$voteoption=poll_votes_$voteoption+1, poll_ips='$poll_ips' WHERE poll_id=$poll_id");
		header("Location: ".FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : ""));
	}
}
$result = dbquery("SELECT * FROM ".$db_prefix."ip_polls ORDER BY poll_started DESC LIMIT 1");
if (dbrows($result) != 0) {
	$data = dbarray($result);
	$poll_title = $data['poll_title'];
	$poll_ips = explode("|", $data['poll_ips']);
	$poll_votes = 0;
	for ($i=0; $i<=9; $i++) {
		if ($data["poll_opt_".$i]) $poll_option[$i] = $data["poll_opt_".$i];
		$poll_votes = $poll_votes + $data["poll_votes_".$i];
	}
	if (!in_array(USER_IP, $poll_ips) && $data['poll_ended'] == 0) {
		$poll = ""; $i = 0; $num_opts = count($poll_option);
		while ($i < $num_opts) {
			$poll .= "<input type='radio' name='voteoption' value='$i'> $poll_option[$i]<br><br>\n";
			$i++;
		}
		echo "<form name='voteform' method='post' action='".FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "")."'>
<b>$poll_title</b><br><br>
$poll<center><input type='hidden' name='poll_id' value='".$data['poll_id']."'>
<input type='submit' name='cast_vote' value='".$locale['PLAN_101']."' class='button'></center>
</form>\n";
	} else {
		$poll =  ""; $i = 0; $num_opts = count($poll_option);
		while ($i < $num_opts) {
			$num_votes = $data["poll_votes_".$i];
			$opt_votes = ($poll_votes ? number_format(100 / $poll_votes * $num_votes) : 0);
			$poll .= "<div>".$poll_option[$i]."</div>
<div><img src='".THEME."images/pollbar.gif' alt='".$poll_option[$i]."' height='12' width='$opt_votes%' class='poll'></div>
<div>".$opt_votes."% [".$num_votes." ".($num_votes == 1 ? $locale['PLAN_102'] : $locale['PLAN_103'])."]</div><br>\n";
			$i++;
		}
		echo "<b>".$poll_title."</b><br><br>
$poll
<center>".$locale['PLAN_104'].$poll_votes."<br>
".$locale['PLAN_105'].showdate("shortdate", $data['poll_started']);
		if ($data['poll_ended'] > 0) {
			echo "<br>\n".$locale['PLAN_106'].showdate("shortdate", $data['poll_ended'])."\n";
		}
		$result = dbquery("SELECT * FROM ".$db_prefix."ip_polls");
		if (dbrows($result) > 1) {
			echo "<br><br><img src='".THEME."images/bullet.gif'>
<a href='".INFUSIONS."ip_poll_panel/ip_poll_archive.php' class='side'>".$locale['PLAN_107']."</a> <img src='".THEME."images/bulletb.gif'>\n";
		}
		echo "</center>\n";
	}
} else {
	echo "<center>".$locale['PLAN_004']."</center>\n";
}
closeside();
?>

Děkuji za pomoc

Upravil ruberninja1 (2014-05-14 19:06:50)

Offline

#4 2014-05-14 19:11:47

kksmirice
Endora rádce
Místo: Vrchovnice
Registrován: 2011-11-20
Příspěvky: 6,023
Web

Re: Problém s anketou - PHP fusion

Pokud se nepletu, tak z uvedeného vyplývá, že hlasování je závislé na IP adrese uživatele. Pokud se tedy přihlásí z jiné IP adresy, pak hlasovat může znovu.


1. Murphyho zákon:
Na počátku nebylo nic. I to se pokazilo!

stránky: CMS test
kontakt - instalace systémů, MySQL, FTP přístup, ...
Instalační balíky vybraných CSM

Problémy spojené s provozem služeb Endora, řešte na tomto fóru.

Offline

#5 2014-05-14 19:38:30

ruberninja1
Endora uživatel
Registrován: 2012-12-01
Příspěvky: 416

Re: Problém s anketou - PHP fusion

To ano, ale já mám stále stejnou IP adresu a hlasovat mohu každý den jednou a takto každý

Upravil ruberninja1 (2014-05-14 19:39:29)

Offline

#6 2014-05-14 20:36:53

kksmirice
Endora rádce
Místo: Vrchovnice
Registrován: 2011-11-20
Příspěvky: 6,023
Web

Re: Problém s anketou - PHP fusion

Citace popisu ip_poll:

Zvláštností této ankety je, že ten kdo hlasuje nemusí být přihlášen jako uživatel.. výhody jsou zřejmé, hlasovat může každý,kdo navštíví tvůj web a to hlavně bez přihlášení !! Anketa je samozřejmě chráněna proti "klikání" na jedinečnou Ip adresu uživatele,který je na tvém webu,tozn. hlasovat může pouze jednou za určitý čas. Nemůže se ti tedy stát, že by ti uživatel naklikal hlasování jak se mu zlíbí.

Tedy zejména zdůrazňuji pouze jednou za určitý čas. Musí tedy někde být nastaven. Hledal bych v administračním rozhraní.


1. Murphyho zákon:
Na počátku nebylo nic. I to se pokazilo!

stránky: CMS test
kontakt - instalace systémů, MySQL, FTP přístup, ...
Instalační balíky vybraných CSM

Problémy spojené s provozem služeb Endora, řešte na tomto fóru.

Offline

#7 2014-05-14 21:05:01

ruberninja1
Endora uživatel
Registrován: 2012-12-01
Příspěvky: 416

Re: Problém s anketou - PHP fusion

V administračním rozhrání je jen vytvoření ankety nic víc...
To je divné hmm

Upravil ruberninja1 (2014-05-14 21:16:17)

Offline

#8 2014-05-14 21:40:44

kksmirice
Endora rádce
Místo: Vrchovnice
Registrován: 2011-11-20
Příspěvky: 6,023
Web

Re: Problém s anketou - PHP fusion

Bohužel jediným kriteriem je IP adresa hlasujícího uživatele. Žádné jiné omezení jsem v kódu nenašel.

if (isset($_POST['cast_vote'])) {
	$voteoption = $_POST['voteoption'];
	$poll_id = $_POST['poll_id'];
	$sql = dbquery("SELECT * FROM ".$db_prefix."ip_polls WHERE poll_id='$poll_id'");
	$data = dbarray($sql);
	$poll_ips = explode("|", $data['poll_ips']);
	if (!in_array(USER_IP, $poll_ips)) {
		array_push($poll_ips, USER_IP);
		$poll_ips = implode("|", $poll_ips);
		$result = dbquery("UPDATE ".$db_prefix."ip_polls SET poll_votes_$voteoption=poll_votes_$voteoption+1, poll_ips='$poll_ips' WHERE poll_id=$poll_id");
		header("Location: ".FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : ""));
	}
}

1. Murphyho zákon:
Na počátku nebylo nic. I to se pokazilo!

stránky: CMS test
kontakt - instalace systémů, MySQL, FTP přístup, ...
Instalační balíky vybraných CSM

Problémy spojené s provozem služeb Endora, řešte na tomto fóru.

Offline

#9 2014-05-14 22:24:59

ruberninja1
Endora uživatel
Registrován: 2012-12-01
Příspěvky: 416

Re: Problém s anketou - PHP fusion

Takže co s tím tedy ?

Offline

Zápatí

Založeno na FluxBB | CZ a SK