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 Quote Link to comment 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']; Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.