<?php

if(function_exists("secuotp_auth"))
{
	$ret= secuotp_auth("guest", "94447589123456", $chg);
	if(SECUOTP_ERROR_SUCCESS == $ret)
	{
		echo "Authentication successfully!<br />";	
	}
	else
	{
		echo "Authentication failed!ERROR CODE:$ret<br />";	
	}
	$ret = secuotp_synchronize("guest", "13430056", "36289357");
	if(SECUOTP_ERROR_SUCCESS == $ret)
	{
		echo "Synchronize successfully!<br />";	
	}
	else
	{
	  echo "Synchronize failed!<br />";	
	}
	die;
//	echo "<br>".date("U")."<br>";
//	echo "<br>".gmdate('Y-m-d H:i:s')."</br>";
//	echo "<br>".strtotime(gmdate('Y-m-d H:i:s'))."<br>********************<br>";
//	echo "<br>".date("Y-m-d H:i:s");
//	echo "<br>".strtotime(date('Y-m-d H:i:s'))."<br>********************<br>";
//	echo "<br>".gmdate('Y-m-d H:i:s')."</br>";
//echo strtotime(gmdate('Y-m-d H:i:s'))."<br>";
//echo floor((strtotime(date('Y-m-d H:i:s'))-strtotime(gmdate('Y-m-d H:i:s')))/60/60)."<br>";
//	$hcounter = 0xffffffff;
//	$lcounter = 0xffffffff;
//	echo "<br>".secu_userauth("025663hello", "12345678901234567890", $hcounter, $lcounter, 2, "hello");
	//echo "<br>".$hcounter."		".$lcounter;
	/*$Challenge;
	secuotp_tokenimport("c:/cyper.uinf", "1234567890123456");
	
	echo "<br>";
	$ret = secuotp_tokendelete("1000000008");
	if(SECUOTP_ERROR_SUCCESS === $ret)
	{
		echo "delete succeed!<br>";	
	}
	else
	{
		echo "delete token failed!Error:$ret<br>";	
	}
	
	$ret = secuotp_makelog(10, "yang", 1, "makelog test", "127.0.0.1");
	if(SECUOTP_ERROR_SUCCESS === $ret)
	{
		echo "makelog succeed!<br>";	
	}
	else
	{
		echo "make log failed!#Error:$ret<br>";	
	}
	die();
	$ret = secuotp_setuserlock("yang", 0);
	if(SECUOTP_ERROR_SUCCESS === $ret)
	{
		echo "update user's lock success!<br>";	
	}
	else
	{
		echo "update user's lock failed!#Error:$ret<br>";
	}
	die();
	$ret = secuotp_setuserinvalid("yang", 0);
	if(SECUOTP_ERROR_SUCCESS === $ret)
	{
		echo "update user's valid success!<br>";	
	}
	else
	{
		echo "update user's valid failed!#Error:$ret<br>";
	}
	die();
	$ret = secuotp_deleteuser("testphp");
	if(SECUOTP_ERROR_SUCCESS === $ret)
	{
		echo "delete user succeed!<br>";	
	}
	else
	{
		echo "delete user failed!#ErrorCode:$ret<br>";	
	}
	die();
	$ret = secuotp_adduser("testphp", "130521198602073536", "15947115102", "1000000003",
													"test remark", "yangpeinmgdx@sktbj.com", "", "yang", "", 1
													);
	if(SECUOTP_ERROR_SUCCESS === $ret)
	{
		echo "add user succeed!<br>";
	}
	else
	{
		echo "add user failed!ErrorCode:$ret<br>";
	}
	die();
	
	$ret = secuotp_setauthtype("yang", 20);
	if(SECUOTP_ERROR_SUCCESS === $ret)
	{
		echo "set authentication type succeed!<br>";	
	}
	else
	{
		echo "set authentication type failed!<br>";	
	}
	
	$ret = secuotp_resetpin("yang", "helloword", "hello!!!word");
	if(SECUOTP_ERROR_SUCCESS === $ret)
	{
		echo "reset pin succeed!<br>";	
	}
	else
	{
		echo "reset pin failed!<br>";	
	}
	die;*/
	echo "<br>";
	$ret = secuotp_auth("yang", "056938",$Challenge);
	if(SECUOTP_ERROR_INVALID_PASSWORD === $ret)
	{
		echo "authentication failed. result:$ret<br>";
	}
	else if(SECUOTP_ERROR_SUCCESS === $ret)
	{
		echo "authentication succeed. result:$ret<br>";
	}
	if(100 == $ret)
	{
		echo "Challenge : $Challenge<br>";	
	}
	die("here");
	$synret = secuotp_synchronize("yang", "044077", "266458");
	if(SECUOTP_ERROR_SYNCHRONIZE_FAILED === $synret)
	{
		echo "synchronize failed. result:$synret<br>";
	}
	else
	{
		echo "synchronize succeed.result:$synret<br>";
	}
	
}
?>