GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   simple php help.. (https://gfy.com/showthread.php?t=751942)

xxweekxx 07-16-2007 12:34 PM

simple php help..
 
i have a mortgage form that posts submitted data to mysql.. however, somehow when users post in my mysql dbase it shows their ip as my server ip..

im using $_SERVER['REMOTE_ADDR'] but it still shows my server ip for every submission..

What do you suggest (btw this is shared hosting)

ScriptWorkz 07-16-2007 12:37 PM

Quote:

Originally Posted by xxweekxx (Post 12769812)
i have a mortgage form that posts submitted data to mysql.. however, somehow when users post in my mysql dbase it shows their ip as my server ip..

im using $_SERVER['REMOTE_ADDR'] but it still shows my server ip for every submission..

What do you suggest (btw this is shared hosting)

it sounds like maybe your doing the post from your server instead of the actual client, if so, and your using a server side script to actually post the form then the solution is to pass $_SERVER["REMOTE_ADDR"] as a variable in the form (so it gets set as a hidden input in the form), and then use that variable instead of $_SERVER["REMOTE_ADDR"] in your post processing code.

xxweekxx 07-16-2007 12:44 PM

what do u mean im doing post from my server? when i upload any simple php script and do server[remote_addr] , and echo it, it gives me server ip..

Masterchief 07-16-2007 12:50 PM

your host is probably using some sort of caching/proxy server in front of the main web server. run get_defined_vars to see if the real IP is set elsewhere

bDok 07-16-2007 12:50 PM

Quote:

Originally Posted by xxweekxx (Post 12769858)
what do u mean im doing post from my server? when i upload any simple php script and do server[remote_addr] , and echo it, it gives me server ip..

exactly it's echoing the remote_addr at that point. When you post to a form you probs are grabbing the remote_addr at that point from the .php that's responsible for handling the user input.

the advice that was given will sort you out. something like

Code:

<input name="remoteip" type="hidden" value="<?php print $REMOTE_ADDR; ?>">
then in the part that handles the post pull the remoteip by parsing it from the name remoteip.

ScriptWorkz 07-16-2007 12:52 PM

Quote:

Originally Posted by Masterchief (Post 12769883)
your host is probably using some sort of caching/proxy server in front of the main web server. run get_defined_vars to see if the real IP is set elsewhere

Yeah, my advise was just my first take on the matter, i thought maybe you had a php script doing the actual posting to your processing code, if not i'd check out this solution.

Masterchief 07-16-2007 12:52 PM

Quote:

Originally Posted by bDok (Post 12769886)
exactly it's echoing the remote_addr at that point. When you post to a form you probs are grabbing the remote_addr at that point from the .php that's responsible for handling the user input.

the advice that was given will sort you out. something like

Code:

<input name="remoteip" type="hidden" value="<?php print $REMOTE_ADDR; ?>">
then in the part that handles the post pull the remoteip by parsing it from the name remoteip.

That's incredibly stupid, why would you give the ability for clients to manipulate their ip addresses?

and why are you using code that depends on register globals being on?

xxweekxx 07-16-2007 12:54 PM

i tried to call it by adding this to my main php index page that has the form..

<input type="hidden" name="ip" value="$_SERVER[REMOTE_ADDR]">

and it doesnt work. Just shows the same stuff when i view source. i wanna get that variable and pass it on.. but it just shows me $SERVER[REMOTE_ADDR]"> and not actual ip..

xxweekxx 07-16-2007 12:58 PM

added <input name="remoteip" type="hidden" value="<?php print $REMOTE_ADDR; ?>"> to my code..

when i open page and view source, comes up blank.. nothing there

xxweekxx 07-16-2007 01:09 PM

ok i tried <input name="remoteip" type="hidden" value="<?php print $REMOTE_ADDR; ?>"> and when i view source i still see server ip?

footmonkey 07-16-2007 01:14 PM

Check out your phpinfo()

That's going to show you all the variables. If you're getting the wrong value you can see what you want from the phpinfo and change your script.

xxweekxx 07-16-2007 01:16 PM

maybe ill host a lil svcript to grab ip on a diff server and then include it on this one.. will this work? if so how?

xxweekxx 07-16-2007 01:20 PM

i looked but it shows remote_addr as server ip still.. come on guys what can i do

xxweekxx 07-16-2007 01:37 PM

bumppppppppp

xxweekxx 07-16-2007 03:52 PM

bump again

BigBen 07-16-2007 04:12 PM

Ask your host...

jimbona 07-16-2007 04:17 PM

if a proxy is a problem use dmxzone.com/ShowDetail.asp?NewsId=8100

or use $_ENV["REMOTE_ADDR"] (environment IP)
if none of these show the user IP, try on another PC, your ISP might be reporting back incorrect IP's.

lb_vee 07-16-2007 04:29 PM

If you can test from a known IP, what I would do is generate a dump of the environment variables and see where your IP shows up. Then use that instead of the remote host (which isnt recommended but might works).

The best solution (like others have said) would be to contact the ISP to see why your IP is coming back. Probably some routing issue on the box itself.


All times are GMT -7. The time now is 10:24 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123