Jump to content

Recommended Posts

Posted

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 :) )

Posted

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.

Posted

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

Posted

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.

  • Thanks 1
Posted
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.

Posted

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?

Posted
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.

  • Thanks 1
Posted

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.

Posted

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.

Posted
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

Posted
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?

  • Thanks 1
Posted

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

  • Thanks 1
Posted

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?

Posted
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.

Posted

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.

Posted

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 :confused:)

 

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

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...