Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am benmmurphy on github.
  • I am benmmurphy (https://keybase.io/benmmurphy) on keybase.
  • I have a public key whose fingerprint is 00A5 6C45 F31E F22D 756A 6056 7B8B 0822 23EE 18E2

To claim this, I am signing this object:

@benmmurphy
benmmurphy / msisdn_verify.php
Last active June 6, 2016 14:23
zensend verify step 3 (alternative)
<?php
$client->msisdn_verification_status($session);
?>
@benmmurphy
benmmurphy / msisdn_verify.php
Last active June 6, 2016 14:23
zensend verify step 3
<?php
$user = USERS[$username];
try {
$verify->verify_response($user["msisdn"]);
header("Location: /login_success.php");
} catch (Exception $e) {
header("Location: /login_fail.php");
}
?>
@benmmurphy
benmmurphy / msisdn_verify_page.inc
Created June 6, 2016 13:41
zendsend verify step 2 (alternative)
<script type='text/javascript' src='https://verify.zensend.io/assets/msisdn_verification.js'></script>
<div id="z-msisdn-verification" data-callback-url="<?php echo $callback_url ?>" data-session="<?php echo $session ?>"></div>
@benmmurphy
benmmurphy / msisdn_verify_page.inc
Created June 6, 2016 13:40
zensend verify step2
<?php $verify->write_tags("http://" . $_SERVER['HTTP_HOST'] . "/msisdn_verify.php"); ?>
@benmmurphy
benmmurphy / login.php
Last active June 6, 2016 14:23
zensend verify step 1 (alternative)
<?php
$client = new ZenSend\Client(API_KEY);
$options = new ZenSend\VerifyOptions();
$options->message = "{{token}} is your COMPANY verification code";
$options->originator = "YOURCOMPANY";
$verify->create_session($user["msisdn"], $options);
$session = $client->create_msisdn_verification($msisdn, $options);
?>
@benmmurphy
benmmurphy / login.php
Last active June 6, 2016 14:22
zensend verify step 1
<?php
$verify = new ZenSend\Verify(API_KEY);
$username = $_POST["username"];
$user = USERS[$username];
if ($user && $user["password"] == $_POST["password"]) {
session_start();
$_SESSION["username"] = $username;
$options = new ZenSend\VerifyOptions();
@benmmurphy
benmmurphy / ssh_config
Created March 10, 2016 11:48
appending unresolvable domains to ssh hosts
Host * !gateway !*.*
HostName %h.internal.domain
ProxyCommand ssh gateway exec nc %h %p
<?php
$details["attempts"] = $details["attempts"] + 1;
$_SESSION["msisdn_verification"] = $details;
if ($details["attempts"] >= MAX_VERIFY_ATTEMPTS) {
return "max_attempts";
} else {
return "invalid_token";
}
?>
<?php
if (hash_equals($token, $details["token"])) {
$_SESSION["verified_msisdn"] = $details["msisdn"];
unset($_SESSION["msisdn_verification"]);
return TRUE;
}
?>