PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Setec Astronomy  >  IM Status  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Test script
Class: IM Status
Check the online status of instant messaging users
Author: By
Last change:
Date: 11 years ago
Size: 1,885 bytes
 

Contents

Class file image Download
<?php
/*
* This script was writed by Setec Astronomy - setec@freemail.it
*
* This script is distributed under the GPL License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* http://www.gnu.org/licenses/gpl.txt
*
*/
?>
<html>
<head>
<title>CIMStatus Class Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="" method="get" name="CIMStatus">
  Medium :
  <select name="medium" size="1">
    <option value="aim">AIM</option>
    <option value="icq">ICQ</option>
    <option value="jabber">Jabber</option>
    <option value="msn">MSN</option>
    <option value="yahoo">Yahoo</option>
  </select>
  <br />
  Account
  <input name="account" type="text" value="<?php if (isset ($_GET["account"])) { print ($_GET["account"]); }?>">
  <input name="submit" type="submit" value="Query">
</form>
<?php
include ("CIMStatus.php");

if (isset (
$_GET["account"]) && isset ($_GET["medium"]))
{
   
$imstatus = new CIMStatus ($_GET["account"], $_GET["medium"]);
   
$status = $imstatus->execute ($errno, $errstr);
    if (
$status)
    {
        switch (
$status) {
            case
IM_ONLINE:
                print (
ucfirst ($_GET["medium"]) . " " . $_GET["account"] . " is online!");
                break;
            case
IM_OFFLINE:
                print (
ucfirst ($_GET["medium"]) . " " . $_GET["account"] . " is offline!");
                break;
            case
IM_UNKNOWN:
                print (
ucfirst ($_GET["medium"]) . " " . $_GET["account"] . " is in an unknown status!");
                break;
        }
    }
    else
// if ($status)
   
{
        print (
"An error occurred during CIMStatus query: <br />");
        print (
"Error n. " . $errno . ": " . $errstr);
    }
}
?>
</body>
</html>