You are here: Re: How to I prevent a user from running a module twice (i.e. online voting) ? « PHP Programming Language « IT news, forums, messages
Re: How to I prevent a user from running a module twice (i.e. online voting) ?

Posted by xclarky on 02/06/06 21:04

You could store it in a file yes, a MySQL backend would be better
though.

I assume you know how to append data to files, with this you can add IP
addresses with a divider (new line, tab, any character you like). You
can read that file during the processing of the poll and create an
array of IP's:

[PHP]
$voted = explode('MYDIVIDER', $contents_of_file);
[/PHP]

You can then check the current visitors IP against this array:

[PHP]
if(in_array($_SERVER['REMOTE_ADDR'], $voted)) {
die('You have already voted!');
{
[/PHP]

I hope that helps.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация