SimpleSi Posted March 4, 2009 Posted March 4, 2009 I'd like my schools to be able to track where I am (as I quite often deviate from the weekly plan!) and I'm looking for a script/prog to do this I've a laptop that I normally switch on in each school and login. Each school has a different IP range (10.xxx.yyy.) so my laptop knows which school I'm in. Looking for the best/most elegant/cleverest way of getting this info onto a website. I have a simple php/mysql help desk prog on one of my schools webservers that I'll use to show my location. Ideas? regards Simon PS I was going to use my Omnia with GPS to do this but can't find a free prog for WinMob to do the job (that actually works )
sparkeh Posted March 4, 2009 Posted March 4, 2009 I have the same problem. My solution is to simply have a google calendar that is published on one of the school websites, this has my timetable on it, if it changes I alter the calendar. Anyone who needs to know where I am has it in their browser favourites so can easily check where I am.
SimpleSi Posted March 4, 2009 Author Posted March 4, 2009 Yep - that's why I'd like a dynamic one They all know where I'm supposed to be - but where am I actually ? If they knew I was at the school next door, they might contact me straight away to tell me the main server has failed instead of muddling through till tommorrow pm when they think I'll be in Its part of my attempt to lead the horses to the water AND make them drink it regards Simon
SteveBentley Posted March 4, 2009 Posted March 4, 2009 How about a web page that contains a PHP script which grabs $_SERVER(REMOTE_ADDR) - this is the client IP address - and writes it to a file on the server. This script needs to have a really random name so that nobody else will find it. There may be better ways to do the security on this if you feel it's necessary. Put a shortcut to it in your startup folder, and maybe have the script redirect to your normal homepage. Then have a public page that will read the file, work out where you are based on the IP address - the explode() function is good for this, using . as the delimiter - and display something appropriate. You could also have a version of the first script which you manually run when you are leaving site which clears the file, so that the second script can show that you're off-site/travelling/at home with your feet up. 1
SimpleSi Posted March 4, 2009 Author Posted March 4, 2009 Would that $_SERVER(REMOTE_ADDR) call pick up my actual LAN ip address (10.xx.yyy.zz) or an LEA real ip? regars Smion
powdarrmonkey Posted March 4, 2009 Posted March 4, 2009 Would that $_SERVER(REMOTE_ADDR) call pick up my actual LAN ip address (10.xx.yyy.zz) or an LEA real ip? regars Smion It will be your NATted or proxied IP, whichever applies (so no, it won't be your private 10... address). I'm having a think about this, if I come up with something I'll let you know.
matt40k Posted March 4, 2009 Posted March 4, 2009 You want something like DynDNS... only... different. Would you want it to automatically update? Or when you click a button? What device is this going to be run on?
SteveBentley Posted March 4, 2009 Posted March 4, 2009 Would that $_SERVER(REMOTE_ADDR) call pick up my actual LAN ip address (10.xx.yyy.zz) or an LEA real ip? Depends where the server is - if it's within the LEA it should pick up the 10. address, if you go via a proxy to get to it then it'll show you as having the proxy's IP which will screw things up. 1
SteveBentley Posted March 4, 2009 Posted March 4, 2009 How about this: Batch file which pipes ipconfig to a file and then uses command line FTP to upload that to the web server, and then the public page parses the file to get at the IP address.
sparkeh Posted March 4, 2009 Posted March 4, 2009 They all know where I'm supposed to be - but where am I actually ? If they knew I was at the school next door, they might contact me straight away to tell me the main server has failed instead of muddling through till tommorrow pm when they think I'll be in Perhaps I am not understanding, but I can't see why a complicated scripted solution is better than the way I do it? Using your scenario above, If I go into a different school than my calendar says, I simply alter my google calendar from 'school A' to 'school B' which is automatically reflected on the school website.If the server goes down, the school checks the calendar on the website, if I am at the school next door then they call. Again perhaps I don't understand the problem.
powdarrmonkey Posted March 4, 2009 Posted March 4, 2009 Of course, your choice of OS is probably going to be a big factor in how elegant this is.. any preference?
dhicks Posted March 4, 2009 Posted March 4, 2009 Batch file which pipes ipconfig to a file and then uses command line FTP to upload that to the web server That's what I was thinking, but instead of FTP just have a script on the web server. Then you just need a startup script of some sort on the laptop that gets the ip address of the machine (probably via ipconfig) and does a "wget addressOfWebServer/updateLocation.py?ipAddress=10.0.yyy.xxx". -- David Hicks
jamesb Posted March 4, 2009 Posted March 4, 2009 PS I was going to use my Omnia with GPS to do this but can't find a free prog for WinMob to do the job (that actually works ) Google Latitude? 1
tech_guy Posted March 4, 2009 Posted March 4, 2009 Yeah I use Google Latitude on my G1 and have a dedicated page on my website. My wife uses it to check where I am!
mac_shinobi Posted March 4, 2009 Posted March 4, 2009 strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") For Each objItem in colItems Wscript.Echo objItem.MACAddress For Each strAddress in objItem.IPAddress Wscript.Echo strAddress Next Next You can easily use the FSO in the above example to write it to the text file and underneath the above code use whichever FTP method to upload it to the server then it would just be a case of getting one webpage to read the uploaded text file and also making the script a startup / login script on the laptop you use 1
budgester Posted March 4, 2009 Posted March 4, 2009 How about a gps dongle for you laptop. Bluetooth® GPS Receiver > Maplin Then you could use google maps as well, and plot your location on a map. Then they would even know if your down the pub or still at home. Or send it to your twitter account, the opportunities for invasion of your privacy are endless. Buddy Beacon
Sirbendy Posted March 4, 2009 Posted March 4, 2009 hmm. No idea on the actual code side, but... If each site has a different IP setup, a script that conditionally checks the IP and then uploads different files to a webserver using FTP, depending on the condition?
TechSupp Posted March 4, 2009 Posted March 4, 2009 Whats up with a mobile phone? I have the same situation and that just about covers all eventualities for contact.
budgester Posted March 4, 2009 Posted March 4, 2009 hmm. No idea on the actual code side, but... If each site has a different IP setup, a script that conditionally checks the IP and then uploads different files to a webserver using FTP, depending on the condition? Nooooooo.... You'd be wanting to scp, if you've got a publically available ftp server on the internet you are asking to be abused.
mac_shinobi Posted March 4, 2009 Posted March 4, 2009 Nooooooo.... You'd be wanting to scp, if you've got a publically available ftp server on the internet you are asking to be abused. you mean sftp or whats scp ?
powdarrmonkey Posted March 4, 2009 Posted March 4, 2009 you mean sftp or whats scp ? Same difference to all intents and purposes (sftp leverages scp which leverages ssh). 1
matt40k Posted March 4, 2009 Posted March 4, 2009 WTf?!? Why would you want "Ftp" it? You can setup an ASP\PHP webpage to accept the input from the client then update the database (mysql) which the end user would see the result of. All the client would need to do it scrap the IP address from his machine, then use HTTP service to POST it to the ASP\PHP webpage. I think I'm sing out of the same book as David Hicks. Using SFTP would mean you need 3rd party files etc. "My" way is a "simple" VBS script and a PHP\ASP webpage.
SimpleSi Posted March 4, 2009 Author Posted March 4, 2009 Many ideas - ta I updated google maps on my Omnia and set up Latitude - but I think people will have to logon to a google account to see it so maybe not what I'm after (but handy to track daughters ) My thoughts were to go down the FTP route to start with but I like the idea of picking up IP direct using the $SERVER['REMOTE_ADDR'] - so I added it to my help desk front page just to test it out tmrrw when at school to see what IP it returns (it gives my home ip now but need to see if it gives out LEA 10.xxx.yyy.zzz when at a school) If that doesn't work, then I'll try out the parsing locally and then uploading using $POST/$GET (but how do I script an http request - didn't quite understand the wget code ) For those wondering why I want this and why not change a calendar manually 1. I'll forget 2. The challenge 3. Its all part of my attempts to help teachers help themselves - the number of times somethings gone wrong and I asked why they didn't call me as I was just 1 mile away and they say - we didn't know So if it helps me to help them - then its worth it regards Simon
SimpleSi Posted March 5, 2009 Author Posted March 5, 2009 Web server doesn't pick up 10.xxx.yyy.zzz address using $REMOTE so using this modified VBS code strComputer = "." Dim result Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") For Each objItem in colItems ' Wscript.Echo objItem.MACAddress For Each strAddress in objItem.IPAddress if left(strAddress,3) = "10." then ' Wscript.Echo strAddress result=WriteFileText("c:\ipaddress.txt",strAddress) end if Next Next Function WriteFileText(sFilePath, sText) Dim objFSO 'As FileSystemObject Dim objTextFile 'As Object Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objTextFile = objFSO.CreateTextFile(sFilePath, True) ' Write a line. objTextFile.Write (sText) objTextFile.Close 'objTextFile.Close End Function which gives me my school LAN address - now how to get c:\ipaddress.txt onto the webserver via a script? regards Simon
mac_shinobi Posted March 5, 2009 Posted March 5, 2009 (edited) VBScript Scripting Techniques: FTP from activ experts : http://www.activexperts.com/activsocket/howto/ftp/vbscript/ ftp://ftp.activexperts-labs.com/samples/asocket/VBScript/Ftp/ Edited March 5, 2009 by mac_shinobi
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now