-
Notifications
You must be signed in to change notification settings - Fork 1
/
record.php
executable file
·56 lines (49 loc) · 1.71 KB
/
record.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
define('IN_ECS', true);
require('data/config_api.php');
require('includes/cls_mysql.php');
require('includes/cls_ecshop.php');
require_once ("includes/lib_soap.php");
$server = new soap_server;
//避免乱码
$server->soap_defencoding = 'UTF-8';
$server->decode_utf8 = false;
$server->xml_encoding = 'UTF-8';
$server->configureWSDL('addTongji');//打开wsdl支持
/*
注册需要被客户端访问的程序
类型对应值:bool->"xsd:boolean" string->"xsd:string"
int->"xsd:int" float->"xsd:float"
*/
$server->register( 'addTongji', //方法名
array("domain"=>"xsd:string"), //参数,默认为"xsd:string"
array("ip"=>"xsd:string"), //参数,默认为"xsd:string"
array("return"=>"xsd:string") );//返回值,默认为"xsd:string"
//isset 检测变量是否设置
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
//service 处理客户端输入的数据
$server->service($HTTP_RAW_POST_DATA);
/**
* 供调用的方法
* @param $name
*/
function sayHello($name) {
return "Hello, {$name}!";
}
function addTongji($domain,$ip) {
global $db,$db_host,$db_user,$db_pass,$db_name,$prefix;
$ecs = new ECS($db_name, $prefix);
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
list($dom,$domainname,$ext)=explode('.',$domain);
$domainname .= '.'.$ext;
$namemd5 = md5($domainname);
$userip = $ip;
try {
$sql = 'INSERT INTO '. $ecs->table('userinfo') . ' (`domain_name`, `name_md5`, `addtime`, `userip`, `userpv`) VALUES ("'.$domainname.'","'.$namemd5.'",'.time().',"'.$userip.'",0) ON DUPLICATE KEY UPDATE userpv=userpv+1';
$db->query($sql);
return '1';
} catch (Exception $e) {
return '0';
}
}
?>