예제 #1
0
function login($details, $phone)
{
    if (count($details) == 1) {
        $ussd_text = "CON <br/> Enter your account number";
        ussd_proceed($ussd_text);
    } else {
        if (count($details) == 2) {
            $ussd_text = "CON <br/> Enter your Pin number";
            ussd_proceed($ussd_text);
        } else {
            if (count($details) == 3) {
                $ussd_text = "CON <br/> Select your options <br/> 1. For Account Balance <br/> 2. For Loan Status <br/> 3. For Funds Transfer";
                ussd_proceed($ussd_text);
            } else {
                if (count($details) == 4) {
                    $username = $details[1];
                    $password = $details[2];
                    $year = $details[3];
                    //$semester=$details[4];
                    $accbalance = "Ksh. 23,000";
                    $loanst = "Approved/Offer";
                    echo "END Account Details: <br/>\nAccount Number: " . $username . "<br/>" . "Account Balance: " . $accbalance . "<br/>" . "Loan Status: " . $loanst;
                }
            }
        }
    }
}
예제 #2
0
function login($details, $phone)
{
    if (count($details) == 1) {
        $ussd_text = "CON Enter your account number \n";
        ussd_proceed($ussd_text);
    } else {
        if (count($details) == 2) {
            $ussd_text = "CON Enter your Pin number \n";
            ussd_proceed($ussd_text);
        } else {
            if (count($details) == 3) {
                $ussd_text = "CON Select your options \n";
                $ussd_text .= "1. For Account Balance \n";
                $ussd_text .= "2. For Loan Status \n";
                $ussd_text .= "3. For Funds Transfer \n";
                ussd_proceed($ussd_text);
            } else {
                if (count($details) == 4) {
                    $username = $details[1];
                    $password = $details[2];
                    $nextoption = $details[3];
                    if ($nextoption == "1") {
                        $accbalance = "Ksh. 23,000";
                    } else {
                        if ($nextoption == "2") {
                            $loanst = "Approved/Offer";
                        }
                    }
                    echo "END Account Details: <br/>\nAccount Number: " . $username . "<br/>" . "Account Balance: " . $accbalance . "<br/>" . "Loan Status: " . $loanst;
                }
            }
        }
    }
}
예제 #3
0
function register($details, $phone, $dbh)
{
    if (count($details) == 2) {
        $ussd_text = "Please enter your Full Name and Email, each seperated by commas:";
        ussd_proceed($ussd_text);
        // ask user to enter registration details
    }
    if (count($details) == 3) {
        if (empty($details[1])) {
            $ussd_text = "Sorry we do not accept blank values";
            ussd_proceed($ussd_text);
        } else {
            $input = explode(",", $details[1]);
            //store input values in an array
            $full_name = $input[0];
            //store full name
            $email = $input[1];
            //store email
            $phone_number = $phone;
            //store phone number
            // build sql statement
            $sth = $dbh->prepare("INSERT INTO customer (full_name, email, phone) VALUES('{$full_name}','{$email}','{$phone_number}')");
            //execute insert query
            $sth->execute();
            if ($sth->errorCode() == 0) {
                $ussd_text = $full_name . " your registration was successful. Your email is " . $email . " and phone number is " . $phone_number;
                ussd_proceed($ussd_text);
            } else {
                $errors = $sth->errorInfo();
            }
        }
    }
}