Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 07-16-2007, 12:34 PM   #1
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
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)
__________________
_________________
I am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 12:37 PM   #2
ScriptWorkz
Confirmed User
 
Industry Role:
Join Date: Jul 2007
Location: Intraweb
Posts: 274
Quote:
Originally Posted by xxweekxx View Post
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.
ScriptWorkz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 12:44 PM   #3
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
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..
__________________
_________________
I am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 12:50 PM   #4
Masterchief
Confirmed User
 
Join Date: Jun 2006
Posts: 530
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
Masterchief is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 12:50 PM   #5
bDok
Confirmed User
 
bDok's Avatar
 
Join Date: Feb 2005
Location: SD/OC/LA
Posts: 1,917
:2cents

Quote:
Originally Posted by xxweekxx View Post
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.
__________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Warriors come out to plaAAaayyy!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
bDok is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 12:52 PM   #6
ScriptWorkz
Confirmed User
 
Industry Role:
Join Date: Jul 2007
Location: Intraweb
Posts: 274
Quote:
Originally Posted by Masterchief View Post
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.
ScriptWorkz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 12:52 PM   #7
Masterchief
Confirmed User
 
Join Date: Jun 2006
Posts: 530
Quote:
Originally Posted by bDok View Post
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?
Masterchief is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 12:54 PM   #8
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
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..
__________________
_________________
I am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 12:58 PM   #9
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
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
__________________
_________________
I am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 01:09 PM   #10
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
ok i tried <input name="remoteip" type="hidden" value="<?php print $REMOTE_ADDR; ?>"> and when i view source i still see server ip?
__________________
_________________
I am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 01:14 PM   #11
footmonkey
Confirmed User
 
Industry Role:
Join Date: Nov 2005
Posts: 639
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.
footmonkey is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 01:16 PM   #12
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
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 am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 01:20 PM   #13
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
i looked but it shows remote_addr as server ip still.. come on guys what can i do
__________________
_________________
I am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 01:37 PM   #14
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
bumppppppppp
__________________
_________________
I am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 03:52 PM   #15
xxweekxx
Confirmed User
 
Join Date: Oct 2002
Posts: 6,780
bump again
__________________
_________________
I am the best
xxweekxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 04:12 PM   #16
BigBen
Confirmed User
 
Join Date: Nov 2004
Location: scv
Posts: 2,299
Ask your host...
BigBen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 04:17 PM   #17
jimbona
Confirmed User
 
Join Date: Jan 2007
Posts: 190
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.
jimbona is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2007, 04:29 PM   #18
lb_vee
Confirmed User
 
Join Date: May 2004
Posts: 886
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.
lb_vee is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.