![]() |
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) |
Quote:
|
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..
|
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
|
Quote:
the advice that was given will sort you out. something like Code:
<input name="remoteip" type="hidden" value="<?php print $REMOTE_ADDR; ?>"> |
Quote:
|
Quote:
and why are you using code that depends on register globals being on? |
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.. |
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 |
ok i tried <input name="remoteip" type="hidden" value="<?php print $REMOTE_ADDR; ?>"> and when i view source i still see server ip?
|
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. |
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?
|
i looked but it shows remote_addr as server ip still.. come on guys what can i do
|
bumppppppppp
|
bump again
|
Ask your host...
|
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. |
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