OptiPoint 600 SIP - WAP based phonebook

OptiPoint 600 SIP - WAP based phonebook


The Siemens OptiPoint 600 SIP contains a WAP browser, which can be used to access a server-based phonebook.

The phone will offer to dial a number, when following a link in the form
<a href="wtai://wp/mc;+491234567890">+49-1234-567890</a>

inside a WML page. This example is tailored to my database setup, you will have to make some adjustments:

<?PHP
header("Content-type: text/vnd.wap.wml");
print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="Phonebook" title="Phonebook">

<?PHP
require_once("formats.inc.php");
require_once("database.inc.php");

# Database
$dbhost             = "localhost";
$dbuser             = "www";
$dbpassword         = "xxx";

$step=5;

print "<p>\n";

if (InitDB("phonebook"))
  {
  $command = $_GET["command"];
  $start   = $_GET["start"];
  $id      = $_GET["id"];

  if ($command == "") { $command = "list"; }
  if ($start   == "") { $start = 0; }

  switch ($command)
    {
    case "list":

      $query = "SELECT persons.firstname, persons.name, persons.id FROM persons ORDER BY persons.name, persons.firstname LIMIT ".$start.",".$step.";";

      $result  = mysql_query($query);
      $matches = mysql_num_rows($result);

      if ($matches > 0)
        {
        while ($data = mysql_fetch_assoc($result))
          {
          print "<a href=\"wap.php?command=detail&id=".$data[id]."&start=".$start."\">".$data[name].", ".$data[firstname]."</a><br/>\n";
          }

        // Can anyone fix this? How can we use more than one key?
        print "<do type=\"accept\" label=\"Previous">\n";
        print "<go href=\"wap.php?command=list&start=".($start-$step)."\"/>\n";
        print "</do>\n";

        print "<do type=\"prev\" label=\"Next\">\n";
        print "<go href=\"wap.php?command=list&start=".($start+$step)."\"/>\n";
        print "</do>\n";

        }
      else
        {
        print "No entries found\n";
        }
      break;
    case "detail":
      $query = "SELECT name,firstname,address,zip,city,country FROM persons WHERE id=".$id.";";

      $result  = mysql_query($query);
      $matches = mysql_num_rows($result);

      if ($matches > 0)
        {
        $data = mysql_fetch_assoc($result);
        print $data[name].", ".$data[vorname]."<br/>\n";
        print "<small>".$data[strasse]."<br/>\n";
        print $data[plz]." ".$data[ort]."</small><br/>\n";
        }
      else
        {
        print "Person $id not found";
        }

      $query = "SELECT numbers.phone FROM numbers WHERE numbers.personid=".$id." LIMIT 10;";

      $result  = mysql_query($query);
      $matches = mysql_num_rows($result);

      if ($matches > 0)
        {

        while ($data = mysql_fetch_assoc($result))
          {
          print "<a href=\"wtai://wp/mc;".$data[phone]."\">".formatphonenumber($data[phone])."</a><br/>\n";
          }
        }
      else
        {
        print "No phone numbers found\n";
        }

      print "<do type=\"prev\" label=\"List\">\n";
      print "<go href=\"wap.php?command=list&start=".$start."\"></go>\n";
      print "</do>\n";



      break;
    }
  }
else
  {
  print "No connection to database\n";
  }
print "</p>\n";

?>
</card>
</wml>

OptiPoint 600 SIP - WAP based phonebook


The Siemens OptiPoint 600 SIP contains a WAP browser, which can be used to access a server-based phonebook.

The phone will offer to dial a number, when following a link in the form
<a href="wtai://wp/mc;+491234567890">+49-1234-567890</a>

inside a WML page. This example is tailored to my database setup, you will have to make some adjustments:

<?PHP
header("Content-type: text/vnd.wap.wml");
print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="Phonebook" title="Phonebook">

<?PHP
require_once("formats.inc.php");
require_once("database.inc.php");

# Database
$dbhost             = "localhost";
$dbuser             = "www";
$dbpassword         = "xxx";

$step=5;

print "<p>\n";

if (InitDB("phonebook"))
  {
  $command = $_GET["command"];
  $start   = $_GET["start"];
  $id      = $_GET["id"];

  if ($command == "") { $command = "list"; }
  if ($start   == "") { $start = 0; }

  switch ($command)
    {
    case "list":

      $query = "SELECT persons.firstname, persons.name, persons.id FROM persons ORDER BY persons.name, persons.firstname LIMIT ".$start.",".$step.";";

      $result  = mysql_query($query);
      $matches = mysql_num_rows($result);

      if ($matches > 0)
        {
        while ($data = mysql_fetch_assoc($result))
          {
          print "<a href=\"wap.php?command=detail&id=".$data[id]."&start=".$start."\">".$data[name].", ".$data[firstname]."</a><br/>\n";
          }

        // Can anyone fix this? How can we use more than one key?
        print "<do type=\"accept\" label=\"Previous">\n";
        print "<go href=\"wap.php?command=list&start=".($start-$step)."\"/>\n";
        print "</do>\n";

        print "<do type=\"prev\" label=\"Next\">\n";
        print "<go href=\"wap.php?command=list&start=".($start+$step)."\"/>\n";
        print "</do>\n";

        }
      else
        {
        print "No entries found\n";
        }
      break;
    case "detail":
      $query = "SELECT name,firstname,address,zip,city,country FROM persons WHERE id=".$id.";";

      $result  = mysql_query($query);
      $matches = mysql_num_rows($result);

      if ($matches > 0)
        {
        $data = mysql_fetch_assoc($result);
        print $data[name].", ".$data[vorname]."<br/>\n";
        print "<small>".$data[strasse]."<br/>\n";
        print $data[plz]." ".$data[ort]."</small><br/>\n";
        }
      else
        {
        print "Person $id not found";
        }

      $query = "SELECT numbers.phone FROM numbers WHERE numbers.personid=".$id." LIMIT 10;";

      $result  = mysql_query($query);
      $matches = mysql_num_rows($result);

      if ($matches > 0)
        {

        while ($data = mysql_fetch_assoc($result))
          {
          print "<a href=\"wtai://wp/mc;".$data[phone]."\">".formatphonenumber($data[phone])."</a><br/>\n";
          }
        }
      else
        {
        print "No phone numbers found\n";
        }

      print "<do type=\"prev\" label=\"List\">\n";
      print "<go href=\"wap.php?command=list&start=".$start."\"></go>\n";
      print "</do>\n";



      break;
    }
  }
else
  {
  print "No connection to database\n";
  }
print "</p>\n";

?>
</card>
</wml>

Created by: mali, Last modification: Sat 20 of Aug, 2005 (09:39 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+