Collecting IP info (Please Read)

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Feb 06, 2004 1:42 am    Post subject: Collecting IP info (Please Read) Reply with quote

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 View user's profile Send private message Visit poster's website
Anonymoose
-


Joined: 09 Sep 2003
Posts: 2192

PostPosted: Fri Feb 06, 2004 10:47 am    Post subject: Reply with quote

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 View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Feb 06, 2004 12:17 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Feb 06, 2004 4:28 pm    Post subject: Reply with quote

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 View user's profile Send private message Send e-mail
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Feb 06, 2004 4:50 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group