Source for file voice_login.php

Documentation is available at voice_login.php

  1. <?php
  2. /**
  3. * Voice Login Script
  4. *
  5. * Verifies the login information and stores the user information
  6. * is session variables
  7. * @package Phone2Dev
  8. * @author Stanislav Miroshnikov
  9. */
  10.  
  11. //start the session
  12. session_start();
  13.  
  14. print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
  15.  
  16. /**
  17. * Requires a custom error handler
  18. */
  19. require_once("voice_error.php");
  20. //error handler test
  21. //trigger_error('This is an information log message.', E_USER_NOTICE);
  22.  
  23.  
  24.  
  25. /**
  26. * Requires PHP VoiceXML library
  27. */
  28. require_once ("phpvoice/vxml.class.php");
  29.  
  30. //NOTE: default values are for debuging purposes only
  31. /*
  32. $pin = "1234";
  33. if(isset($_POST['pin'])) $pin = $_POST['pin'];
  34.  
  35. $phone = "9149540786";
  36. if(isset($_POST['phone'])) $phone = $_POST['phone'];
  37. */
  38.  
  39. /**
  40. * Requires Phone2Dev class for database access
  41. */
  42. require_once ("phone2dev.php");
  43. $objP2D = &new Phone2Dev();
  44.  
  45. // connect to the database
  46. $objP2D->dbConnect();
  47.  
  48. $intUserId = $objP2D->authPhonePin($phone, $pin);
  49.  
  50. if($intUserId > 0) {
  51. // user was autheticated correctly
  52. // set the user session variables
  53. $_SESSION['intUserId'] = $intUserId;
  54.  
  55. // get the id of the main menu for the user
  56. $_SESSION['intMainManuId'] = $objP2D->getMainMenuId($intUserId);
  57.  
  58. // start the vxml document
  59. $app =& new gonx_vxml();
  60. $app->start_vxml("", "", "", "", "", "2.0"); {
  61.  
  62. // catch the disconnect event
  63. $app->start_catch("connection.disconnect"); {
  64. $app->start_exit_c();
  65. }$app->end_catch();
  66. //show the connection success menu
  67. $app->start_form("login_success",""); {
  68. $app->start_block(); {
  69. $app->start_prompt(); {
  70. $app->write("Login success.");
  71. $app->write("You telephone is ");
  72. $app->start_say_as("telephone");{
  73. $app->write($phone);
  74. }$app->end_say_as();
  75. $app->write(".");
  76. $app->write("The pin you entered is ");
  77. $app->start_say_as("number:digits");{
  78. $app->write($pin);
  79. }$app->end_say_as();
  80. $app->write(".");
  81. }$app->end_prompt();
  82. }$app->end_block();
  83. // $app->start_goto_c("voice_menu.php");
  84. }$app->end_form();
  85. // end of the vxml document
  86. }$app->end_vxml();
  87.  
  88. // generate the document
  89. $app->generate();
  90.  
  91. } else {
  92. // user was not autheticated correctly
  93. $app =& new gonx_vxml();
  94. $app->start_vxml("", "", "", "", "", "2.0"); {
  95. // catch the disconnect event
  96. $app->start_catch("connection.disconnect"); {
  97. $app->start_exit_c();
  98. }$app->end_catch();
  99. //show the connection success menu
  100. $app->start_form("login_failure",""); {
  101. $app->start_block(); {
  102. $app->start_prompt(); {
  103. $app->write("Authentication information provided is not valid.");
  104. $app->write("Please try again or go to our website to register.");
  105. }$app->end_prompt();
  106. }$app->end_block();
  107. }$app->end_form();
  108. // end of the vxml document
  109. }$app->end_vxml();
  110.  
  111. // generate the document
  112. $app->generate();
  113. }
  114.  
  115. // disconnect from the database
  116. $objP2D->dbDisconnect();
  117.  
  118. ?>

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