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!
Did you know?Explore Trending and Topic pages for more stories like this.

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

Something Non-Traditional. Can we solve?
I have an idea for an application here. It's mostly flash, but it couldn't work without a somewhat n

Transport data between itab and textfield on ALV event
Hallo,

I have a ALV Grid ( cl_gui_alv_grid ) and I also have hotspot click event with a h

Sequre login with cookies.
I want to build secure login with cookies. I just want your ideas about this, your suggestions. What

how to get different value in second view of webdynpro?
hello guys,

In ABAP webdynpro I am trying to create one application having two views.

Anti Spam Code
Ok where do i start? Probably by telling you I have very little working knowledge of PHP and that I

array_combine() trouble w/csv file
I have a problem with a piece of code I wrote to import some records from a csv file into mysql. I h

column name cancatenation within PL/SQL
I have a PLSQL store procedure, and the following statement is part of a subquery
fname||lnam

ImageCreate()
When I create an image and add text to it I want my text to be replaced with a PNG image, because th

couldn't connect to your database
Hello I am new to php mysql

Actually i have read A tutorial on nettuts
"http://net.tu

trouble printing an array....
I'm having some trouble printing out an array forwards. I'm figuring out the high and low of an arra

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