<?php
session_start();
$action=$_GET["action"];
if ($action=='add')
{
$UserId = "";//请在这里输入您的用户ID
$key="";//请在这里更换您的KEY
$phone=$_POST["TextBox1"];
$code=trim($_POST["TextBox2"]);
if(!preg_match('/^[0-9]{11,13}$/',$phone))
{
print( "<script>alert('号码格式错误码')</script>");
exit();
}
$md5=md5($UserId.$phone.$key);
$curlPost ='UserId='.$UserId.'&phone='.$phone.'&Md5Str='.$md5;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://221.194.44.133/imccallInterface.php');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$curlPost);
$data =trim(curl_exec($ch));
curl_close($ch);
$startlen=strpos($data, 'charset=UTF-8')+strlen('charset=UTF-8');
$str=trim(substr($data, $startlen,strlen($data)-$startlen));
if(strlen($str)>1 and $str==trim($code))
{
print( "<script>alert('通证成功')</script>");
}
else
{
print( "<script>alert('未通证成功')</script>");
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>示例2</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: 12px;
color: #FF0000;
}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="explale2.php?action=add">
您手机号码:
<input name="TextBox1" type="text" id="TextBox1" />
请用您的手机号码拔打 05708573333(<span class="STYLE1">些号码需要向验证通网站购买</span>) 获取验证码<br />
<br />
验证码:
<input name="TextBox2" type="text" id="TextBox2" />
</label>
<br />
<br />
<label>
<input type="submit" name="Submit" value=" 确 定 " />
</label>
</form>
</body>
</html>