Error   test

Online status indicator

Posted March 6, 2007 at 11:03pm in Computers, Programming

Here is the status scripts I wrote that power this: http://digital39.com/status.php. I wrote them so that people who do not use any chat services or do not have me added can check my status. This can be very handy for more internal things where you would not want everyone on your buddy list seeing what you are doing. I plan to write a GUI or web interface to add multiple users and their URLs for use with teams or among friends. It requires a web server running PHP and Python on your computer. I recommend you add a little security to the “set” so that not just anyone can change your status. It is also very simple, so if the server is down it will throw an error. I created it for personal use more than anything but if you can use it be my guest, just don’t try to take credit for it. I also recommend you use a program that has tabs such as Console, which you can see my screen shot here

How to use it:

Run “status.py” from the command line, it will show your current status and prompt you for an update. The script will continue to run until you type ‘exit’. You can also double check your online status is what you last set it as by typing ’show’. You must also make sure the directory where status.php can write to status.txt.

Enjoy

Python [Show Plain Code]:
  1. from urllib import urlopen, urlencode
  2. from base64 import b64decode, b64encode
  3.  
  4. f = urlopen(‘http://digital39.com/status.php?get’)
  5. statux = b64decode(f.read())
  6. tmp = statux
  7. print ‘Current Status: ‘+statux
  8. while (statux != ‘exit’):
  9.     statux = raw_input("Status: ")
  10.     if (statux == ’show’):
  11.         print ‘Current Status: ‘+tmp
  12.     elif (statux != ‘exit’):
  13.         f = urlopen(‘http://digital39.com/status.php?set=’+b64encode(statux))
  14.         tmp = b64decode(f.read())

and now the PHP

  1. $fname = "status.txt";
  2.  
  3. if (isset($_GET[’set’])) {
  4.     $fcontent = $_GET[’set’];
  5.     $handle = fopen($fname, ‘w’);
  6.     fwrite($handle, $fcontent);
  7.     fclose($handle);
  8.     echo $_GET[’set’];
  9. } else {
  10.     $handle = fopen($fname, "r");
  11.     $fcontent = fread($handle, filesize($fname));
  12.     fclose($handle);
  13.     if (!isset($_GET[‘get’])) {
  14.         $fcontent = "<html><head><title>Status</title></head><body>".base64_decode($fcontent)."</body></html>";
  15.     }
  16.     echo $fcontent;
  17. }

and there it is.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Google
  • del.icio.us
  • Digg
  • e-mail
  • Spurl
  • Facebook

2 Responses to “Online status indicator”

  1. Hans Says:
    March 8th, 2007 at 9:11 am

    wow ! nice stuff man :) Added to my friend’s post on showing your msn status, yours complete the pack :) thanks for sharing

  2. online status on your own web site? Says:
    April 9th, 2007 at 5:46 pm

    [...] on your own web site? Google search for "status indicator didn’t give too many options… Here’s one..http://www.digital39.com/index.php/programming/online-status-indicator/2007/03/187/ __________________ Maine-ly Web Design "where it all begins" - This site is under [...]



Leave a Reply