IP Logger for Voting Script


Posted on 16th Feb 2014 07:03 pm by admin

Can anybody help me place an IP logger into my voting script?
I know that maybe it is not as secure, but I would prefer them to be logged into a text file for simplicity's sake.

THANKS!

The php script is this at the moment:

<?php
$vote = $_REQUEST['vote'];

//get content of textfile
$filename = "poll_result.txt";
$content = file($filename);

//put content in array
$array = explode("||", $content[0]);
$a = $array[0];
$b = $array[1];
$c = $array[2];
$d = $array[3];

if ($vote == 1)
{
$a = $a + 1;
}
if ($vote == 2)
{
$b = $b + 1;
}
if ($vote == 3)
{
$c = $c + 1;
}
if ($vote == 4)
{
$d = $d + 1;
}

//insert votes to txt file
$insertvote = $a."||".$b."||".$c."||".$d;
$fp = fopen($filename, "w");
fputs($fp,$insertvote);
fclose($fp);
?>

<font face="helvetica" color="gray"><i>
<?php echo($a); ?><br /><br />
<?php echo($b); ?><br /><br />
<?php echo($c); ?><br /><br />
<?php echo($d); ?></i></font>

No comments posted yet

Your Answer:

Login to answer
346 Like 22 Dislike
Previous forums Next forums
Other forums

Need PHP help... have all the elements... just need help putting them together :
Hey Guys,

I was wondering if someone could help me. I am doing a website for a client which

Undefined offset when using a flat file with pipe symbols
Hi, I've got a flat file/text file which I'm currently using as a member database for my site (not a

Internal Server Error issues
This has been bothering me for weeks and I've been trying to solve it without asking for help, but e

RadioButtonList data selection
view plaincopy to clipboardprint?

ALV List Display to point to another report on Double Click
Hi,

I want my ALV List Display to point to another report on Double Click on its line ite

cURL proxy
Okay here is the thing... i know how to add proxys

Code: curl_setopt($ch, CURLOPT_PROXYTYPE,

Greek characters in php
Hi,

I'm making a script and I m using for first time greek characters.
I started to write

recrawling
Can anyone suggest me how may i know a page is updated before it is being downloaded, so that i can

RSS feed - FeedList for WordPress
Hi,

I'm trying to alter the FeedList plugin for WordPress so that I can click on the title of

Edit MySQL Row Using PHP and HTML Form
Hello,

Here's what I'm trying to do. Build a page where a user enters a MySQL row number in.

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash