Hi,

I want to give a voting option in my website. For eg. Rate "this movie " and options are good, bad....

I want to block multiple submission and my site doesn't having any login system.
I am planning to store the ip address of voting computer in a mysql column. Is this a correct way ?
I m asking this coz my movie database contain more than 5000 movies. Is this a practical method ?

Please help friends
Thanks in advance
Rajeesh

No tested, but something like this.

<?php

    $now = NOW();
    
    // fetch the date from the database
    
    $yourTimeVariable =  date("Y-M-D-H:m",strtotime("+1 day"));    
    
    if (($_SERVER['REMOTE_ADDR'] == $yourDatabaseIP) && ($now == $yourTimeVariable)) {
        echo 'You have already voted, please come back in 24h.';
    } 
    else {
        // voting script
    }
    
?>

I presume that you want to allow them to vote once for each movie. If you store the IP for each vote for each movie, you could be carrying a lot of these voting records in your database. You might want to consider creating a cookie for each vote instead. It isn't foolproof but it may still be the best solution for this particular need. It is also better than storing the IP because it really does identify a particular user. Large internet access companies normally assign IP addresses when you connect to them so the same user doesn't always get the same IP address. It would thus be hit and miss as to who gets blocked from entering a vote (if you store the IP in the database).

Thanks for your reply and,
This is still confusing me how to do this. Since this is an open movie forum we can't create any login system . Can you suggest a good tutorial or web link for how to make cookies for this ?

Thanks in advance
Rajeesh


I presume that you want to allow them to vote once for each movie. If you store the IP for each vote for each movie, you could be carrying a lot of these voting records in your database. You might want to consider creating a cookie for each vote instead. It isn't foolproof but it may still be the best solution for this particular need. It is also better than storing the IP because it really does identify a particular user. Large internet access companies normally assign IP addresses when you connect to them so the same user doesn't always get the same IP address. It would thus be hit and miss as to who gets blocked from entering a vote (if you store the IP in the database).

Hey Rajesh..

Same type of concept i am also trying in my project.

For your case, solution is of 2 way

1. Get the IP address stored along with the Date Time Stamp. Check if the person trying to vote again on same day. If yes don't allow. If not accept the rating.
- Here you can't avoid multiple votes, but it is less by the restriction of the vote for that IP (IP is not their systems IP, It is ISP routers IP) cannot be performed more than once. If he want to vote he need to come again on another day. (There is also a loopholes for users to Change IP address like switching off the modems and re switch on. This cannot be avoided)

2. Get user's email address, while they voting. Store that email addresses & IP & Date in table and send a mail to verify that Email ID by asking them to "Click for verification"
- Here, loophole is very less. you can modify or place rules inbuilt as you wish. You can restrict that id to vote once per day for per movie. If they come another day allow to vote or restrict them not to vote at all.

Customization is yours.

Hey can i know your video website?. So i can also vote my best movie.

Thanks for your kind reply and I m gonna customizing your first option.

Well this is not a video website it is a movie discussion/database site in India. Describing all the movies in India
It is still under construction and I will give the working link

Thanks .. Thank you very much
Rajeesh


Hey Rajesh..

Same type of concept i am also trying in my project.

For your case, solution is of 2 way

1. Get the IP address stored along with the Date Time Stamp. Check if the person trying to vote again on same day. If yes don't allow. If not accept the rating.
- Here you can't avoid multiple votes, but it is less by the restriction of the vote for that IP (IP is not their systems IP, It is ISP routers IP) cannot be performed more than once. If he want to vote he need to come again on another day. (There is also a loopholes for users to Change IP address like switching off the modems and re switch on. This cannot be avoided)

2. Get user's email address, while they voting. Store that email addresses & IP & Date in table and send a mail to verify that Email ID by asking them to "Click for verification"
- Here, loophole is very less. you can modify or place rules inbuilt as you wish. You can restrict that id to vote once per day for per movie. If they come another day allow to vote or restrict them not to vote at all.

Customization is yours.

Hey can i know your video website?. So i can also vote my best movie.

welcome buddy.

You got the answer.

Sure send me the link. I ll also take a look.

I am also in india only.

Regards
______________________________________________
Krish - The power of complex & the way of complications

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.