Jump to content

Archived

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

john510

Getting IP from form

Recommended Posts

Im using the form at http://www.eformmailer.com/ to create a from just an simple form with a name, but all so what to know the IP number of the person sending the form.

Is there a way to add to this form the IP number of the person sending the form in the email sent?

Share this post


Link to post
Share on other sites
There is a predefined variable which stores the users IP address. $_SERVER['REMOTE_ADDR'] is the variable you want to use in order to retrieve the users IP Address.

Note dont rely on this as users IP addresses can change frequently and can be easily changed.

Share this post


Link to post
Share on other sites
I dont know! Kind of hard when theres no code to see. Post the code you current have here and I'll have look. Also where do you want the IP address to show up to?

Share this post


Link to post
Share on other sites
Here are the forms , dont know where to put the IP and no I dont want the ip to show to the user just it sent to the person gettingthe mail. There are several forms..





[attachment deleted by admin]

Share this post


Link to post
Share on other sites
a) post some actual code, not some file to download. 
b) you don't really need to pass the ip address [i]through[/i] your form, since it is a variable automatically created whenever a script is called. [b]wildteen88[/b] already told you that variable's name: $_SERVER['REMOTE_ADDR']

but if you insist on passing it through your form, you would pass it with a hidden field, something like this:

<input type='hidden' name='ipaddress' value='<?php echo $_SERVER['REMOTE_ADDR']; ?>'>

and then you could access it with $_POST just like any of your other variables (assuming you used the POST method).... or you could you know, just use $_SERVER['REMOTE_ADDR'] in the called script, as i just mentioned.

c) I slightly disagree with [b]wildteen88[/b] on IP reliability.  I will agree that in theory it is not advisable to rely soley on someone's ip/tcp level info because one's ip address could potentially change every http request, but in reality,  it does not.  And I will agree that someone could easily access your page via a different ip address intentionally.  why do you want to track the user's ip? is it for security reasons? to verify they are who they are?  as measures to prevent cracking attempt? 

Share this post


Link to post
Share on other sites
what part of "post some code, not some file to download" do you not understand? Neither I nor anybody else is here to download and sort through whatever amount of files you happen to have.

the example I gave you is more than ample information for you to sort through your own code.

Share this post


Link to post
Share on other sites
[quote author=Crayon Violent link=topic=99550.msg392497#msg392497 date=1152192719]
what part of "post some code, not some file to download" do you not understand? Neither I nor anybody else is here to download and sort through whatever amount of files you happen to have.

the example I gave you is more than ample information for you to sort through your own code.
[/quote]

Crayon Violent is right. You have already been told how to add it to the form. Now you need to post the mail script so that we may help you in adding it to the mail sent.

Also, if it is a simple form to mail then you should realy have no need for the users ip. It is not being posted to a database. So what other possible uses could there be?

Share this post


Link to post
Share on other sites
I cannot post the code cause the forum says the following when i try:

[b] The following error or errors occurred while posting this message:
The message exceeds the maximum allowed length (40000 characters). [/b]

Thats why I did it in a file.

Share this post


Link to post
Share on other sites
okay do you really think you need to post your entire code or just the relavent part. that's my point. nobody wants to read 40,000 lines of code for one simple thing. you already know what your code is supposed to do and where things already are, right? for example, you already know where in your code your form is, right? you already know where in your code the other variables are checked/inserted into your email right? adding the ip address to that list is as simple as adding that server variable to the list.  nobody should have to go through 40k lines of code for that.

Share this post


Link to post
Share on other sites
Ok which part is the "relevent part that is needed and I will post that.

I have:
class.phpmailer
config1152128398.php
form1152128398.php
inc_mail.php
process1152128398.php

All these performt he mail action..Which one can I post for you ?

Share this post


Link to post
Share on other sites
okay this obviously isn't your script that you made, seeing as how you don't seem to know anything about it.  this forum is not for altering 3rd party scripts to fit your needs.  i suggest you go ask whoever made your script. surely they must have their own forum.

Share this post


Link to post
Share on other sites
No as I said I went to the above site where you enter the data in but there was no option for the IP.

I never said it was my script and you seem to come up with a idea i said it was.

Share this post


Link to post
Share on other sites
And one other thing if you cant help dont bother replying cause your just sitting here bashing me cause you dont know

Share this post


Link to post
Share on other sites
i already did help you. i told you what variable to use that holds the user's ip address, and how to use it.  and now, instead of bothering to try doing it yourself, you are wanting me (or someone else) to sort through fourty thousand lines of code to do it for you. that's not how it works around here. If you take my explaining all this to you as "bashing" then so be it.

Share this post


Link to post
Share on other sites
Thanks for the help.. I just found another forum thats helping me.. Thanks again.. Goodbye..

Share this post


Link to post
Share on other sites

×

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.