Page 2 of 2 FirstFirst 12
Results 21 to 35 of 35
  1. #21  
    Quote Originally Posted by DrHeathenScum View Post
    I would be interested in seeing it if you don't mind.

    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>
    No problem. Nothing special really, but a couple of little wrinkles beyond just the plain Google Map. The original didn't separate all the data the GPs gives you into separate variables like this does, so you couldn't get just the accuracy number, for instance. Notice this password prompt doesn't use encryption or anything, so it's not REALLY secure, but the simple password means I can show it to my friends, and even if they just go back in their history, they won't be able to just click once and see where I am. Just one little wrinkle for a bit of extra piece of mind.

    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
  2. elryon's Avatar
    Posts
    715 Posts
    Global Posts
    720 Global Posts
    #22  
    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.
  3. #23  
    Quote Originally Posted by elryon View Post
    if you really wanted security you could probably set up an .htaccess file with an encrypted username and password.....
    Yeah, I didn't really care that much. My doofus friends would just take one look at it and give up, which is all I want. I just don't want them to be able to look and see where I am at any given time and be able to screw with me.

    And i imagine for most guys, it would be enough to keep their girlfriend(s) out of the location page, as well.
  4. #24  
    Quote Originally Posted by pullbangdead View Post
    Yeah, I didn't really care that much. My doofus friends would just take one look at it and give up, which is all I want. I just don't want them to be able to look and see where I am at any given time and be able to screw with me.

    And i imagine for most guys, it would be enough to keep their girlfriend(s) out of the location page, as well.

    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.
  5.    #25  
    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?
  6. #26  
    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.
  7. #27  
    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.
  8.    #28  
    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?
  9. #29  
    Quote Originally Posted by DrHeathenScum View Post
    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?

    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.    #30  
    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.
  11. elryon's Avatar
    Posts
    715 Posts
    Global Posts
    720 Global Posts
    #31  
    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.
  12. #32  
    Quote Originally Posted by pullbangdead View Post
    Code:
    <code deleted cause I can post links >
    
    No problem.  Nothing special really, but a couple of little wrinkles beyond just the plain Google Map.  The original didn't separate all the data the GPs gives you into separate variables like this does, so you couldn't get just the accuracy number, for instance.  Notice this password prompt doesn't use encryption or anything, so it's not REALLY secure, but the simple password means I can show it to my friends, and even if they just go back in their history, they won't be able to just click once and see where I am.  Just one little wrinkle for a bit of extra piece of mind.
    
    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.
    I'm not familiar with PHP at all, but I tried this version out and all I get is a blank window. When I use the original track.php it works fine. Any ideas as to what may be wrong?

    thanks,
    dave
  13. nerubius's Avatar
    Posts
    58 Posts
    Global Posts
    59 Global Posts
    #33  
    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.
  14.    #34  
    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?
  15.    #35  
    Anyone?
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions