Jump to content

how to get a users ip adress...


pemdas21

Recommended Posts

I have an email form setup and I want to have the person's ip address that sends an email through it attached to the message. What hidden element do I add to the page itself, and what do I add to the php script?

Form script=
[code]<FORM name="Mailto" method="POST" action="emails.php" enctype="application/x-www-form-urlencoded">
<INPUT type="hidden" name="redirect" value="http://www.orrita.com/">
<select name="Person" size="1" style="position:absolute;left:168px;top:72px;width:384px;font-family:MS Shell Dlg;z-index:7">
<option selected>Choose a Recipient</option>

<option value="Joe Shmoe">Joe Shmoe</option>
</select>
<INPUT type="text" style="position:absolute;left:192px;top:120px;width:336px;z-index:8" size="42" name="Email" value="Your E-Mail Address">
<INPUT type="text" style="position:absolute;left:168px;top:192px;width:384px;z-index:9" size="48" name="Subject" value="Subject">
<TEXTAREA name="Message" style="position:absolute;left:168px;top:216px;width:384px;height:144px;z-index:10" rows=9 cols=45>Message</TEXTAREA>
<INPUT type="submit" name="" value="Submit" style="position:absolute;left:216px;top:384px;width:75px;height:24px;z-index:11">
<INPUT type="reset" name="" value="Reset" style="position:absolute;left:432px;top:384px;width:75px;height:24px;z-index:12">

</FORM>
[/code]

And the code for the php script:
[code]<%
Dim gv__POST(), gv_mailto, gv_mailbody


If isset(gv__POST("email")) then
email    = $_POST["email"]

If $Person == "Joe Shmoe" then
gv_mailto  = "[email protected]"
End If




' repeat the above If statement as many times as the persons
$mailsubj  = $HTTP_POST_VARS["Subject"]
$Message  = $HTTP_POST_VARS["Message"]
$mailhead  = "From: " & email & "\n"
gv_mailbody  = "" & Message & "\n"
&  "\n"
&  "Email sent through our Web Mail form\n"
mail(
%>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/
Share on other sites

sorry... I am new to this type of scripting... Bear with me... I have no idea how to do this. I am sorry that I put this in the wrong section as well. If someone could modify my script to do send the ip address of the person after their email, and then tell me how it works, that would be absolutely awesome! Thanks for the quick response.
more importantly this forum is not about writing script for you, but nudging you in the right direction.  Thorpe has provided you the variables that hold the user's ip address, for both php and vbscript.  If you cannot figure out how to encorporate a variable into your script, even by looking at the variables already in your script...do I really need to say what comes next in this statement?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.