PHP Classes

File: example.php

Recommend this page to a friend!
  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: 10 years ago
Size: 1,036 bytes


Class file image Download
//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'>
} else {
//Test password against customer username
$result = $provider->testAuth($customerUsername,$_POST['password']);
$result) {?>
<h1>Authentication successful</h1>
<?php } else { ?>
<h1>Authentication Failed</h1>