10/01/2009, 11:49 PM
|
#21 (permalink) |
|
Member
![]() Join Date: May 2009
Posts: 353
Likes Received: 0
Thanks: 7
Thanked 57 Times in 41 Posts
|
Code:
<?php
//Define username and password
$username = "ENTER_USERNAME_HERE";
$password = "ENTER_PASSWORD_HERE";
if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {
?>
<h1>Login</h1>
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p><label for="txtUsername">Username:</label>
<br /><input type="text" title="Enter your Username" name="txtUsername" /></p>
<p><label for="txtpassword">Password:</label>
<br /><input type="password" title="Enter your password" name="txtPassword" /></p>
<p><input type="submit" name="Submit" value="Login" /></p>
</form>
<?php
}
else {
?>
<html>
<?php
$gps = `luna-send -n 1 palm://com.palm.location/getCurrentPosition {} 2>&1 | cut -d, -f4,5,6,7,8,9,10 | sed -r 's/[^-\.0-9,]//g'`;
list($lat, $lon, $hacc, $head, $vel, $alt, $vacc) = explode(",", $gps);
$bat = `grep BATTERY: /var/log/messages | tail -1 | awk '{print $8}'`;
?>
<title>Location of my Palm Pre</title>
<iframe width="600" height="500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/?ie=UTF8&q=<?php echo $lat ?>,<?php echo $lon ?>&z=16&ll=<?php echo $lat ?>,<?php echo $lon ?>&output=embed"></iframe><br />
<small><a href="http://maps.google.com/?ie=UTF8&q=<?php echo $lat ?>,<?php echo $lon ?>&z=16&ll=<?php echo $lat ?>,<?php echo $lon ?>&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>
<?php echo $hacc ?>, <?php echo $bat ?>
</html>
Also, you can see which of the GPS variables get defined there. I just use the lat and lon in the Google Map and link, and then just include the accuracy and the battery % remaining as text below the map. If the accuracy is in the thousands, then the phone didn't get a GPS lock, and it's giving you location of the nearest cell phone tower. If you want to use the other variables the GPS gives, you can see how they are defined. And as far as being able to turn the GPS on and off, here are the luna commands to do so, courtesy of Ikyo. I haven't sat down and plugged these into my webpage, but I don't see why it wouldn't work in php. Code:
luna-send -n 1 palm://com.palm.location/setUseGps {\”useGps\”:\”true\”} >/dev/null 2>&1
luna-send -n 1 palm://com.palm.location/setUseGps {\”useGps\”:\”false\”} >/dev/null 2>&1
|
10/01/2009, 11:52 PM
|
#22 (permalink) |
|
Member
![]() ![]() Join Date: Jul 2009
Location: Arizona
Posts: 716
Likes Received: 1
Thanks: 33
Thanked 374 Times in 163 Posts
|
if you really wanted security you could probably set up an .htaccess file with an encrypted username and password.....
I dont have any yet as I havent decided which I like better, the cron job with remote server, or using lighttpd.... the cron job does tend to get a better gps lock as I have it set to query the gps twice before sending the coordinates....
__________________
Avatar on Left Patch Call Rejecter Patch Make your messanger look like the iphone's SMS tone per Contact No Alert During call Thanks are always appreciated or for a really big Thanks you can always: (it can go a long way to convince my fiancee that this is worth my time)Please feel free to PM for more direct assistance. |
10/01/2009, 11:56 PM
|
#23 (permalink) | |
|
Member
![]() Join Date: May 2009
Posts: 353
Likes Received: 0
Thanks: 7
Thanked 57 Times in 41 Posts
|
Quote:
And i imagine for most guys, it would be enough to keep their girlfriend(s) out of the location page, as well.
|
|
10/01/2009, 11:58 PM
|
#24 (permalink) | |
|
Member
![]() Join Date: Aug 2009
Posts: 1,130
Likes Received: 3
Thanks: 87
Thanked 388 Times in 220 Posts
|
Quote:
Probably the easiest way to do that, is simply not tell your buddies or your girlfrind what they URL for your dynamic dns page is. |
|
10/02/2009, 12:09 AM
|
#25 (permalink) |
|
Member
![]() Join Date: Sep 2009
Location: Norfern Kali-Fornia
Posts: 778
Likes Received: 1
Thanks: 22
Thanked 160 Times in 84 Posts
|
Thinking about it... the cron job may actually be better as it doesn't require you to catch the phone being on at the time you "poke" it for location. With the cron job, the phone will always send it's location (in predetermined intervals) to your server when it is on/has service.
If someone steals your phone and turns it off after making off with it, at least you would have the possibility of seeing it's last location. Then if the phone is powered up later on, you have a real good chance of seeing where it is... rather than sitting there hitting refresh every few minutes for a few hours... hypothetically. I have to admit, the lighttpd server on the phone is pretty darn "elegant" (thanks VeeDub for letting me peek.), but may not be the best option for phone recovery. Thoughts? |
10/02/2009, 12:20 AM
|
#26 (permalink) |
|
Member
![]() Join Date: Aug 2009
Posts: 1,130
Likes Received: 3
Thanks: 87
Thanked 388 Times in 220 Posts
|
Well, it's a trade off really.
The cron job will eat your battery because it will be pulling gps info how ever often you schedule it, but you'll always have access to the location of the last polling. the lighttp server won't affect your battery, but won't work if the Pre is powered off or put in airplane mode. |
10/02/2009, 12:20 AM
|
#27 (permalink) |
|
Member
![]() Join Date: Aug 2009
Posts: 1,130
Likes Received: 3
Thanks: 87
Thanked 388 Times in 220 Posts
|
Well, it's a trade off really.
The cron job will eat your battery because it will be pulling gps info how ever often you schedule it, but you'll always have access to the location of the last polling. the lighttp server won't affect your battery, but won't work if the Pre is powered off or put in airplane mode. |
10/02/2009, 03:02 PM
|
#28 (permalink) |
|
Member
![]() Join Date: Sep 2009
Location: Norfern Kali-Fornia
Posts: 778
Likes Received: 1
Thanks: 22
Thanked 160 Times in 84 Posts
|
Good point. I don't see ant reason why you couldn't do both... run the cron job like a "fail safe", uploading every half hour to an hour, so battery usage is minimal, but also have the lighttpd service running so you can access the phone on demand if it is accessible.
If I'm not mistaken, if the phone is powered off and then back on, the cron job should upload info once as soon as it loads, and then the set intervals afterwards, right? |
10/02/2009, 03:13 PM
|
#29 (permalink) | |
|
Member
![]() Join Date: Aug 2009
Posts: 1,130
Likes Received: 3
Thanks: 87
Thanked 388 Times in 220 Posts
|
Quote:
How about patch the init scripts and shutdown scripts so that when the phone is turned off it grabs GPS and sends it before powering down, and sends one the first time it aquires a network after a power on? That way you get the best of both worlds. No battery drain, but if they shut off the phone off, you'll know where it was when it was shut off, and you'll be notified as soon as it comes back on as well. |
|
10/02/2009, 03:39 PM
|
#30 (permalink) |
|
Member
![]() Join Date: Sep 2009
Location: Norfern Kali-Fornia
Posts: 778
Likes Received: 1
Thanks: 22
Thanked 160 Times in 84 Posts
|
That's it! If the phone is on or off, you will know and can track it or sit and wait. Good thinking!
If you really wanted to be anal retentive, you could also put a cron job in there that could be manually started, a la SSH, so you could have a log of where it's been as well. |
10/02/2009, 05:39 PM
|
#31 (permalink) |
|
Member
![]() ![]() Join Date: Jul 2009
Location: Arizona
Posts: 716
Likes Received: 1
Thanks: 33
Thanked 374 Times in 163 Posts
|
doing the cron on start-up and shut-down only would be ideal... then use lighttpd while its on... you could even set up your server to notify you when its been updated.... so if stolen, you could activate the notification on your server and then just wait....
__________________
Avatar on Left Patch Call Rejecter Patch Make your messanger look like the iphone's SMS tone per Contact No Alert During call Thanks are always appreciated or for a really big Thanks you can always: (it can go a long way to convince my fiancee that this is worth my time)Please feel free to PM for more direct assistance. |
10/03/2009, 09:42 AM
|
#32 (permalink) | |
|
Member
![]() Join Date: Sep 2009
Posts: 9
Likes Received: 0
Thanks: 1
Thanked 0 Times in 0 Posts
|
Quote:
thanks, dave |
|
10/19/2009, 05:08 PM
|
#33 (permalink) |
|
Member
![]() Join Date: Sep 2009
Posts: 59
Likes Received: 0
Thanks: 22
Thanked 11 Times in 8 Posts
|
i've got ddns and lighttpd running on my pre with the google maps php script. via the webOS internals tutorial. I would like to disable lighttpd and the firewall rules allowing it to accept incoming connections at boot, but i'm having alot of trouble figuring out how to do this.
i've removed this file /etc/event.d/optware-lighttpd # don't start until the WebOS finishes it's normal boot # that way no delay is added to the GUI startup start on stopped finish stop on runlevel [!2] # Restart the lighttpd daemon if it exits/dies respawn exec /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf pre-start script /usr/sbin/iptables -D INPUT -p tcp --dport 8081 -j ACCEPT || /bin/true /usr/sbin/iptables -I INPUT -p tcp --dport 8081 -j ACCEPT end script but the server is up each time i reboot. with these firwall permissions in place. any help would be greatly appreciated. edit: /opt/etc/init.d/S80lighttpd stop --is not working to stop it either Last edited by nerubius; 10/19/2009 at 05:33 PM. |
05/27/2010, 12:54 AM
|
#34 (permalink) |
|
Member
![]() Join Date: Sep 2009
Location: Norfern Kali-Fornia
Posts: 778
Likes Received: 1
Thanks: 22
Thanked 160 Times in 84 Posts
|
Revisiting this.....
With the inception of Preware, along with easy install of Lighty and ipupdate, I'm thinking this could be a much easier setup for the less "Linux-fluent" types (myself included)... or, is there an even easier way? |
![]() |
|
| Tags |
| gps, lost, remote, stolen, tracking |
| Thread Tools | |
| Display Modes | |
|
|



