View previous topic :: View next topic |
Author |
Message |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Feb 06, 2004 1:42 am Post subject: Collecting IP info (Please Read) |
|
|
I have tried over and over to log a person's IP secretly when they submit
my form data , how do I make the IP show up in my output file without
having any trouble , here's what I need done , I want a <input type="hidden" name="ip">
to go to the following file and displayed in the output html
file that is listed in the php code which is data.html
PHP Code:
Code: | <title>::ULTIMATE OFFSPRING:: Done</title>
<body bgcolor="000000">
<?php
$filename="data.html";
$handle=fopen($filename,'a');
$string="<hr>
<font color=\"blue\" font size=\"4\">
Name: <font color=\"red\" font size=\"3\">
$_POST[name] <br><br> <font color=\"blue\" font size=\"4\">
E-mail: <a href=\"mailto:$_POST[email]?subject=::ULTIMATE OFFSPRING:: &body=To: $_POST[name]\"><font color=\"yellow\" font size=\"3\">$_POST[email]</a>
<br><br> <font color=\"blue\" font size=\"4\">
Comments: <font color=\"white\" font size=\"3\">
$_POST[comments] <br> <br>
<font color=\"blue\" font size=\"4\">Website:
<a href=\"$_POST[file]\" target=\"_blank\"><font color=\"orange\" font size=\"3\">$_POST[file]</a><br><br>
<font color=\"blue\" font size=\"4\">IP Address: (what do I put)
<hr>\n <br><br><br>";
fputs($handle, $string);
fclose($handle);
echo "<font color=\"white\" font size=\"4\">Hey <font color=\"blue\">$_POST[name] <font color=\"white\" font size=\"4\">, thank you for supporting OffspringVideos.com , we will
take a look at the info that you have provided and post the new servers on OffspringVideos.com";
?>
|
HTML Form:
Code: | <form action="post.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
Website: <input type="text" name="file" value="http://"><br>
<textarea maxlength=3 name="comments" maxlength="10" rows="5" cols="25">Enter any comments you have in this box!</textarea>
<input type="hidden" name="ip"><br><input type="submit" value="Submit">
<input type="reset" value="Reset">
</form> |
-------------------------------------------------------------------------------------
Please help me figure this out , I need to report abuse to ISP's from
bad people that submit illegal or inapropriate stuff. Later! |
|
Back to top |
|
 |
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Fri Feb 06, 2004 10:47 am Post subject: |
|
|
Any reason why you can't just use the PHP variables instead ?
HTTP_X_FORWARDED_FOR if they're using a non anonymous proxy
REMOTE_ADDR if not. |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Feb 06, 2004 12:17 pm Post subject: |
|
|
I tried that stupid REMOTE_ADDR , It just doesn't work , every time I tried to add such a thing to the PHP code it shows up with Error 200 , how do
I fix this , I really do need this. :(
Last edited by TRUSTAbyss on Fri Feb 06, 2004 5:15 pm; edited 1 time in total |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Fri Feb 06, 2004 4:28 pm Post subject: |
|
|
TRUSTpunk,
The following function should give your the visitor IP (and it cares about proxies also):
Code: | function remote_addr()
{
$ra=$_SERVER["HTTP_X_FORWARDED_FOR"];
if ($ra=="")
$ra=$_SERVER["REMOTE_ADDR"];
return $ra;
} |
_________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Feb 06, 2004 4:50 pm Post subject: |
|
|
I will try that code snippet , thanks Aprelium :D
Edit: I got the IP Address to finally display using
SSI and JavaScript , Thanks for the help Aprelium |
|
Back to top |
|
 |
|