Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andy Dixon  >  PHP SMS Authentication  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Very simple example
Class: PHP SMS Authentication
Authenticate users once using codes sent via SMS
Author: By
Last change:
Date: 2013-08-02 00:44
Size: 1,036 bytes
 

Contents

Class file image Download
<?php
require_once('class.smsAuthentication.php');
//Example use of the SMS Authentication System
//Requires PHP5 with cURL and mcrypt

 

$customerUsername='TestUsername'// The clients ID (username, etc., your information)
$customerMobileNumber '447000000000'// Somehow you have this from the username
$provider = new smsAuth('1327804','parsnip123'); //Your login details for the API (foreign details)

 

if(!@$_POST['password']) { // Bad way, but this is an example
//Create encrypted request and send it to the server. This will send the SMS request to the phone
$provider->sendAuthenticator($customerUsername$customerMobileNumber);
?>
<form method='post'>
Enter the code sent to your mobile:<input type='text' name='password'>
<input type='submit'>
</form>
<?php
} else {
//Test password against customer username
$result $provider->testAuth($customerUsername,$_POST['password']);
if(
$result) {?>
<h1>Authentication successful</h1>
<?php } else { ?>
<h1>Authentication Failed</h1>
<?php
}
}