Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-14-2012, 09:25 PM   PM User | #1
chrisjarson
New to the CF scene

 
Join Date: Sep 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
chrisjarson is an unknown quantity at this point
Thumbs up Possible to detect default gateway IP of visitors?

Hi,

I own a garage door company in Montreal and recently have a new line of garage doors where users can type the default gateway of the SSID broadcasted from my new garage doors( basically my garages doors have a built-in router) and login from their computer or phones by typing in the default gateway or DNS, this way they can control their garage doors from the internet if they are in range of the signal broadcasted from my doors.

The following would help me A LOT!:

1.Is it possible to have a php script on my website that automatically detects the default gateway IP of the visitor's?

2. Anybody willing to offer me a price to make this script?

Thanks
Chris
chrisjarson is offline   Reply With Quote
Old 09-14-2012, 10:03 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,383
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
Here is the code to display your ip address it's php.
PHP Code:
$ip $_SERVER['REMOTE_ADDR'];
echo 
"<b>IP Address= $ip</b>"

Last edited by Inigoesdr; 09-15-2012 at 02:48 PM..
sunfighter is offline   Reply With Quote
Old 09-14-2012, 10:09 PM   PM User | #3
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,505
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by chrisjarson View Post
detects the default gateway IP of the visitor's?
Quote:
Originally Posted by sunfighter View Post
Here is the code to display your ip address it's php.
$ip=@$REMOTE_ADDR;
echo "<b>IP Address= $ip</b>";
sunfighter that is the remote ip not the default gateway ip as chris has requested.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 09-14-2012, 10:35 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,650
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
That also won't work. Register globals are required to create $REMOTE_ADDR, and register_globals are gone as of 5.4 (happy happy).

For the OP, no I don't believe there is a method of retrieving the gateway in PHP. However, if you trace it, then the second last hop should be the last device before the machine which *may* be the gateway. That assumes it replies of course. This is also an unreliable way of retrieving this information. A better solution would be to have the software installed by the user themselves, or for a web control implement the software into the opener itself. This can then be attached to via http directly to control it from any location. I wouldn't have a clue the amount of work that would require at that end.
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:58 AM.


Advertisement
Log in to turn off these ads.