Source for file command.php

Documentation is available at command.php

  1. <?php
  2. /**
  3. * Command menu of the web interface
  4. *
  5. * Executes commands selected by the user and displays a confirmation
  6. * if successful or an error if not.
  7. * @package Phone2Dev
  8. * @author Stanislav Miroshnikov
  9. * @todo add an associative array that maps SIP error codes to
  10. * their descriptions.
  11. * @todo add template support
  12. */
  13. ?>
  14. <html>
  15. <head>
  16. <title>Phone2Dev: Command Menu</title>
  17. </head>
  18. <body>
  19. <?php
  20. // start the session
  21. session_start();
  22.  
  23. // check for required session and GET variables
  24. if(isset($_SESSION['intUserId'])
  25. && isset($_SESSION['intMainMenuId'])
  26. && isset($_GET['commandId'])
  27. && isset($_GET['menuId'])
  28. && isset($_GET['deviceId'])){
  29.  
  30. /**
  31. * Requires Phone2Dev Class for database access
  32. */
  33. require 'phone2dev.php';
  34. $objP2D = &new Phone2Dev;
  35. $objP2D->dbConnect();
  36.  
  37. // output the page header
  38. print "<h1>Phone2Dev</h1>";
  39. print "<p>You are logged in as: ".$_SESSION['strUsername']."</p>";
  40.  
  41. // activate the command
  42. $intStatus = $objP2D->executeCommand($_GET['commandId'],
  43. $_GET['deviceId'],
  44. $_SESSION['intUserId']);
  45.  
  46. // check if the message send was successful
  47. if($intStatus == 200) {
  48. print "<h3>Success</h3>";
  49. } else {
  50. print "<h3>Error: ".$intStatus."</h3>";
  51. }
  52.  
  53. if($_GET['menuId'] == $_SESSION['intMainMenuId']) {
  54. // this is command was activated from main menu
  55. // so it can only return to main menu
  56. print "<p>Return to <a href=\"menu.php?menuId="
  57. .$_SESSION['intMainMenuId']."\">Main Menu<a\></p>";
  58. } else {
  59. // give option to return to parent or main menus
  60. print "<p>Return to <a href=\"menu.php?menuId="
  61. .$_GET['menuId']."\">Previous Menu<a\></p>";
  62. print "<p>Return to <a href=\"menu.php?menuId="
  63. .$_SESSION['intMainMenuId']."\">Main Menu<a\></p>";
  64. }
  65. // give option to log out
  66. print "<p>Click here to<a href=\"logout.php\">logout</a>.</p>";
  67.  
  68. // disconnect from the database
  69. $objP2D->dbDisconnect();
  70. } else {
  71. print "<h1>Phone2Dev Command Error</h1>";
  72. print "<p>You are not properly logged in "
  73. ."or you are not entering a command.</p>";
  74. print "<p>You can login <a href=\"login.html\">here</a>.</p>";
  75. }
  76. ?>
  77. </body>
  78. </html>

Documentation generated on Tue, 4 Jan 2005 13:47:58 -0500 by phpDocumentor 1.3.0RC3