I am just looking for direction or a script (login) that will read the ip address / subnet from a browser-request, then match it against a list of previously entered addresses (of servers) to determine which server for the user to log into.
The login script already exisits and works. It uses a config.xml file with a list of servers with ip addresses. The user sees a drop down list of servers to choose from. I want to make their server (based off of the ip subnet---from their browser) show first in the list.
Oh geezz, I'm sorry. I am needing this for PHP. The login file is in PHP and the server list is in a config.xml file. I just need to know the code for reading the browser ip and for entering in ip subnets with the server list so that I can control the server first in the list.
Thank you for the reply. Here is some more detail:
The login.php is a simple login interface with user / pass and a drop-down list of servers (to login to). The server list is in a config.xml file that has a "friendly" server name matched to the actual server ip address.
What I want to do is put partial ip addresses or subnets to match certain servers. The partial address / subnet would be something like 10.12.64. Then, take the login.php and read the users browser / client ip address. If the users browser / client had the address of 10.12.64.125 (that would match the partial address/ subnet tied to a specific server). So, the net result would be the user would see the appropriate server first in the server drop-down list.
I have a snippet of code that does this in .NET / .ASP: I just need the same thing or basics for the same thing in PHP
if selectedsiteid="" or isNull(selectedsiteid) then
set rs_gets=widform.execute("select validate_woco,siteid,parentsiteid,subnet from site where subnet=substr('" & remote_addr & "',0,length(subnet))")
do while not rs_gets.eof
selectedsiteid=rs_gets.fields("siteid").value
parentsiteid=rs_gets.fields("parentsiteid").value
subnet=rs_gets.fields("subnet").value
validate_woco=rs_gets.fields("validate_woco").valu e
rs_gets.movenext
loop
'if Left(remote_addr,5)="10.12" then ' HO
' selectedsiteid="4"
' parentsiteid="4"
' end if
' if Left(remote_addr,5)="10.8." or Left(remote_addr,5)="10.9." then ' GR
' selectedsiteid="9"
' parentsiteid="9"
' end if
' if Left(remote_addr,5)="10.4." then ' AV
' selectedsiteid="0"
' parentsiteid="0"
//Getting the IP's from a file, un-comment the next line and delete the above array; //$IParray = file('yourFile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
function getIPselected() { $user = $_SERVER['REMOTE_ADDR'];