pemdas21 Posted January 14, 2007 Share Posted January 14, 2007 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_mailbodyIf isset(gv__POST("email")) then email = $_POST["email"]If $Person == "Joe Shmoe" then gv_mailto = "joeshmoe@whatever.net" 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] Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/ Share on other sites More sharing options...
Orio Posted January 14, 2007 Share Posted January 14, 2007 That's not php as far as I can tell...Orio. Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/#findComment-160689 Share on other sites More sharing options...
.josh Posted January 14, 2007 Share Posted January 14, 2007 that looks like vbscript. Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/#findComment-160692 Share on other sites More sharing options...
Benaravo Posted January 14, 2007 Share Posted January 14, 2007 Either VB or ASP... I take it you didn't write this your self?There are hundereds of PHP scripts for mailing; it's all fairly simple too! Google it :) Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/#findComment-160694 Share on other sites More sharing options...
pemdas21 Posted January 14, 2007 Author Share Posted January 14, 2007 well, yes, it is vbscript... what do I do to get a users ip address? Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/#findComment-160698 Share on other sites More sharing options...
trq Posted January 14, 2007 Share Posted January 14, 2007 In vbscript? This is a PHP forum. I'll tell you now, that is neither vbscript or PHP but a hybrid of both.A users ip is optained in PHP via $_SERVER['REMOTE_ADDR'], in vbscript I believe it is request.server("REMOTE_ADDR"). Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/#findComment-160708 Share on other sites More sharing options...
pemdas21 Posted January 14, 2007 Author Share Posted January 14, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/#findComment-160714 Share on other sites More sharing options...
corillo181 Posted January 14, 2007 Share Posted January 14, 2007 this forum is about php not asp try google for the type of programming that you are using. Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/#findComment-160716 Share on other sites More sharing options...
.josh Posted January 14, 2007 Share Posted January 14, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/#findComment-160719 Share on other sites More sharing options...
pemdas21 Posted January 14, 2007 Author Share Posted January 14, 2007 I understand completely. Thank you for your time. Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/#findComment-160787 Share on other sites More sharing options...
pemdas21 Posted January 14, 2007 Author Share Posted January 14, 2007 just tell me this, do I need to add anything to my form? or just change my .php script? That is all that I am asking. Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/#findComment-160796 Share on other sites More sharing options...
trq Posted January 14, 2007 Share Posted January 14, 2007 The script you posted is NOT php. Can you read? Quote Link to comment https://forums.phpfreaks.com/topic/34162-how-to-get-a-users-ip-adress/#findComment-160803 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.