poison6feet Posted May 19, 2009 Share Posted May 19, 2009 Hi There, I have written a script for a poll and I am displaying poll option based on Remote IP address. How to allow all the users connecting to one network to VOTE the poll, Ex: If one user casted VOTE then IP is recorded and my site is not displaying the POLL option other users on the network. Could some one plz help me to achieve this option??? Thanks & Regards Link to comment https://forums.phpfreaks.com/topic/158730-poll-script-to-allow-all-users/ Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 Does your server provide MySQL Database support? If so, I recommend reading up on MySQL: INSERT and SELECT queries. And, you can retrieve a user's IP address at any time using the superglobal array "$_SERVER." $ip_address = $_SERVER['REMOTE_ADDR']; Link to comment https://forums.phpfreaks.com/topic/158730-poll-script-to-allow-all-users/#findComment-837132 Share on other sites More sharing options...
poison6feet Posted May 19, 2009 Author Share Posted May 19, 2009 thanks for quick reply, I am attaching a part of script <?session_start(); $uip=$_SERVER['REMOTE_ADDR']; $query = "select pollId from pollanswers where pollId=1 and visitorIP='$uip'"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); if ($numrows == 0){?> <h2>Poll Of The Day</h2> <form action="" name="poll" > <? $result=mysql_query("select * from pollquestions"); while($row_list=mysql_fetch_assoc($result)) <display Poll Questions / Options> } For Exp: I have Casted vote and My External IP is 1.1.1.1 and to this external ip there 3 computers connected with internal ip. How to allow others to cast the vote, hopefully I am expressing my question properly, if not I appologise. Thanks Link to comment https://forums.phpfreaks.com/topic/158730-poll-script-to-allow-all-users/#findComment-837136 Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 thanks for quick reply, I am attaching a part of script <?session_start(); $uip=$_SERVER['REMOTE_ADDR']; $query = "select pollId from pollanswers where pollId=1 and visitorIP='$uip'"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); if ($numrows == 0){?> <h2>Poll Of The Day</h2> <form action="" name="poll" > <? $result=mysql_query("select * from pollquestions"); while($row_list=mysql_fetch_assoc($result)) <display Poll Questions / Options> } For Exp: I have Casted vote and My External IP is 1.1.1.1 and to this external ip there 3 computers connected with internal ip. How to allow others to cast the vote, hopefully I am expressing my question properly, if not I appologise. Thanks Well, unfortunately (as far as I know), there's no way to differentiate from devices connected locally to the same remote IP address. So, even if one IP address is consistent with ten local users (all in the same house, for argument's sake), once one of the ten voted, the other nine could not vote. Link to comment https://forums.phpfreaks.com/topic/158730-poll-script-to-allow-all-users/#findComment-837146 Share on other sites More sharing options...
poison6feet Posted May 19, 2009 Author Share Posted May 19, 2009 Just curious how does these polls works then, I am attaching this News Paper Link just as an example, its is allowing to cast vote from 2 computers from one network. http://www.deccanchronicle.com/ Thanks Link to comment https://forums.phpfreaks.com/topic/158730-poll-script-to-allow-all-users/#findComment-837159 Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 Just curious how does these polls works then, I am attaching this News Paper Link just as an example, its is allowing to cast vote from 2 computers from one network. http://www.deccanchronicle.com/ Thanks Cookies. Link to comment https://forums.phpfreaks.com/topic/158730-poll-script-to-allow-all-users/#findComment-837162 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.