Jump to content

Poll Script to Allow All Users


poison6feet

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.