Jump to content

Getting IP from form


john510

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?
Link to comment
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.
Link to comment
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? 
Link to comment
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.
Link to comment
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?
Link to comment
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.
Link to comment
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.
Link to comment
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 ?
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.