Documentation is available at voice_login.php
- <?php
- /**
- * Voice Login Script
- *
- * Verifies the login information and stores the user information
- * is session variables
- * @package Phone2Dev
- * @author Stanislav Miroshnikov
- */
- //start the session
- session_start();
- print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
- /**
- * Requires a custom error handler
- */
- require_once("voice_error.php");
- //error handler test
- //trigger_error('This is an information log message.', E_USER_NOTICE);
- /**
- * Requires PHP VoiceXML library
- */
- require_once ("phpvoice/vxml.class.php");
- //NOTE: default values are for debuging purposes only
- /*
- $pin = "1234";
- if(isset($_POST['pin'])) $pin = $_POST['pin'];
- $phone = "9149540786";
- if(isset($_POST['phone'])) $phone = $_POST['phone'];
- */
- /**
- * Requires Phone2Dev class for database access
- */
- require_once ("phone2dev.php");
- $objP2D = &new Phone2Dev();
- // connect to the database
- $objP2D->dbConnect();
- $intUserId = $objP2D->authPhonePin($phone, $pin);
- if($intUserId > 0) {
- // user was autheticated correctly
- // set the user session variables
- $_SESSION['intUserId'] = $intUserId;
- // get the id of the main menu for the user
- $_SESSION['intMainManuId'] = $objP2D->getMainMenuId($intUserId);
- // start the vxml document
- $app =& new gonx_vxml();
- $app->start_vxml("", "", "", "", "", "2.0"); {
- // catch the disconnect event
- $app->start_catch("connection.disconnect"); {
- $app->start_exit_c();
- }$app->end_catch();
- //show the connection success menu
- $app->start_form("login_success",""); {
- $app->start_block(); {
- $app->start_prompt(); {
- $app->write("Login success.");
- $app->write("You telephone is ");
- $app->start_say_as("telephone");{
- $app->write($phone);
- }$app->end_say_as();
- $app->write(".");
- $app->write("The pin you entered is ");
- $app->start_say_as("number:digits");{
- $app->write($pin);
- }$app->end_say_as();
- $app->write(".");
- }$app->end_prompt();
- }$app->end_block();
- // $app->start_goto_c("voice_menu.php");
- }$app->end_form();
- // end of the vxml document
- }$app->end_vxml();
- // generate the document
- $app->generate();
- } else {
- // user was not autheticated correctly
- $app =& new gonx_vxml();
- $app->start_vxml("", "", "", "", "", "2.0"); {
- // catch the disconnect event
- $app->start_catch("connection.disconnect"); {
- $app->start_exit_c();
- }$app->end_catch();
- //show the connection success menu
- $app->start_form("login_failure",""); {
- $app->start_block(); {
- $app->start_prompt(); {
- $app->write("Authentication information provided is not valid.");
- $app->write("Please try again or go to our website to register.");
- }$app->end_prompt();
- }$app->end_block();
- }$app->end_form();
- // end of the vxml document
- }$app->end_vxml();
- // generate the document
- $app->generate();
- }
- // disconnect from the database
- $objP2D->dbDisconnect();
- ?>
Documentation generated on Tue, 4 Jan 2005 13:48:12 -0500 by phpDocumentor 1.3.0RC3