Jump to content

Recommended Posts

I have no Idea on this one, I would like to at times be able to feed a ip address

into the following code, via a link, instead of using a manual form

 

$location = GeoIP_record_by_addr($gi, $_POST["ipp"]);

 

any idea how I can do this?

 

Something like this below is what I need to be able to do

http://domain/display.php?action=check&ip=58.61.164.141

 

Thanks

Sonny

If you wish to retrieve a value from a url you should use $_GET instead of $_POST. Be sure to always validate user input.

 

Hi I am on this now

 

I just posted the code line as I have it from a form that's on another page

 

I would like to feed the IP address and display results directly in the display page instead

 

here is what I am trying to do, create a geoip lookup page that works from a manual form

and also can display results via a url link, as the example I posted above

 

will that be really hard to do?

 

Thanks

Sonny

 

 

so basically what you have is this:

 

Page1:

form where user enters an IP

 

Page1 will then send the IP as part of the URL to Page2 ...

 

Page2:

grab the IP from the URL, do the geo-location thingy and display the results

 

 

Is that correct?  If that is so, then vineld is correct.  You should use the $_GET method for your form, then just grab the IP address on page2 using something like $_GET['ip']

That will work fine.

 

Just a few things that don't have to do with this particular "problem". Have you purchased an IP database or do you pay for queries? In that case you may wish to validate the IP first and also restrict the number of searches. Otherwise people will eat you up alive with automatic requests  :P

That will work fine.

 

Just a few things that don't have to do with this particular "problem". Have you purchased an IP database or do you pay for queries? In that case you may wish to validate the IP first and also restrict the number of searches. Otherwise people will eat you up alive with automatic requests  :P

 

Thanks for caring enough to bring that point up, Its could be really Important your right on!

 

This not public available, I just want to be able to click a IP address which I will make a link from my hit log and display results

 

I don't understand what you guys are saying, right now I have a very simple form page and another page that displays results, how exactly do I call a IP address result directly via a URL on the display page, thats what I need to do, maybe I am not explaining properly, can you guys show me?

Thanks

Sonny

 

Use the get method instead of post for the form and then simply retrieve the values from both form and url as $_GET["ip"]. Of course the ip field should then have the same name as is in the query string of the url.

 

Works

 

Thank you this is really good to know,

now I can focus on making my code safe

 

Sonny

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.