<?php
header("Content-type:text/html;charset=utf-8");  

function addtestuser($userid, $username) {
	$usertype = 1;//EnterpriseUsers 
    $canfound = isset($_POST['canfound']) ? $_POST['canfound'] : '0'; 
    $nickname = isset($_POST['nickname']) ? $_POST['nickname'] : ''; 
	if (trim($nickname) == '') $nickname = $username;
    $actualname = isset($_POST['actualname']) ? $_POST['actualname'] : ''; 
    $sex = isset($_POST['sex']) ? $_POST['sex'] : '0'; 
    $age = isset($_POST['age']) ? $_POST['age'] : '-1'; 
    $birth_year = isset($_POST['birth_year']) ? $_POST['birth_year'] : '0'; 
    $birth_month = isset($_POST['birth_month']) ? $_POST['birth_month'] : '0'; 
    $birth_day = isset($_POST['birth_day']) ? $_POST['birth_day'] : '0'; 
    $province = isset($_POST['province']) ? $_POST['province'] : '0'; 
    $city = isset($_POST['city']) ? $_POST['city'] : '0'; 
    $address = isset($_POST['address']) ? $_POST['address'] : ''; 
    $telephone = isset($_POST['telephone']) ? $_POST['telephone'] : ''; 
	$telephone_short = isset($_POST['telephone_short']) ? $_POST['telephone_short'] : ''; 
    $telephone2 = isset($_POST['telephone2']) ? $_POST['telephone2'] : ''; 
	$telephone2_short = isset($_POST['telephone2_short']) ? $_POST['telephone2_short'] : ''; 
    $mobile = isset($_POST['mobile']) ? $_POST['mobile'] : ''; 
	$mobile_short = isset($_POST['mobile_short']) ? $_POST['mobile_short'] : ''; 
    $mobile2 = isset($_POST['mobile2']) ? $_POST['mobile2'] : ''; 
	$mobile2_short = isset($_POST['mobile2_short']) ? $_POST['mobile2_short'] : ''; 
    $fax = isset($_POST['fax']) ? $_POST['fax'] : ''; 
    $qq = isset($_POST['qq']) ? $_POST['qq'] : ''; 
    $weixin = isset($_POST['weixin']) ? $_POST['weixin'] : ''; 
	$weibo = isset($_POST['weibo']) ? $_POST['weibo'] : ''; 
    $email = isset($_POST['email']) ? $_POST['email'] : ''; 
	$roomname = isset($_POST['roomname']) ? $_POST['roomname'] : '';
	$roomnumber = isset($_POST['roomnumber']) ? $_POST['roomnumber'] : '';
	$idnumber = isset($_POST['idnumber']) ? $_POST['idnumber'] : '';
	$carnumber = isset($_POST['carnumber']) ? $_POST['carnumber'] : '';
    $homepage = isset($_POST['homepage']) ? $_POST['homepage'] : ''; 
    $departid = isset($_POST['departid']) ? $_POST['departid'] : '0'; 
    $departname = isset($_POST['departname']) ? $_POST['departname'] : ''; 
    $jobtitle = isset($_POST['jobtitle']) ? $_POST['jobtitle'] : ''; 
    $jobnumber = isset($_POST['jobnumber']) ? $_POST['jobnumber'] : ''; 
    $introduction = isset($_POST['introduction']) ? $_POST['introduction'] : ''; 
    $password = isset($_POST['pwd']) ? $_POST['pwd'] : 'E10ADC3949BA59ABBE56E057F20F883E'; //123456(md5)
	$salt = '';

	$methodname = 'Admin.AddUser';
	$requestinfo = '<?xml version="1.0" encoding="utf-8"?><request>' . 
		'<ip>' . '127.0.0.1' . '</ip>' . 
		'<userid>' . $userid . '</userid>' . 
		'<username>' . $username . '</username>' .
		'<usertype>' . $usertype . '</usertype>' . 
		'<canfound>' . $canfound . '</canfound>' .
		'<nickname>' . $nickname . '</nickname>' .
		'<actualname>' . $actualname . '</actualname>' .
		'<sex>' . $sex . '</sex>' .
		'<age>' . $age . '</age>' .
		'<birth_year>' . $birth_year . '</birth_year>' .
		'<birth_month>' . $birth_month . '</birth_month>' .
		'<birth_day>' . $birth_day . '</birth_day>' .
		'<province>' . $province . '</province>' .
		'<city>' . $city . '</city>' .
		'<address>' . $address . '</address>' .
		'<telephone>' . $telephone . '</telephone>' .
		'<telephone_short>' . $telephone_short . '</telephone_short>' .
		'<telephone2>' . $telephone2 . '</telephone2>' .
		'<telephone2_short>' . $telephone2_short . '</telephone2_short>' .
		'<mobile>' . $mobile . '</mobile>' .
		'<mobile_short>' . $mobile_short . '</mobile_short>' .
		'<mobile2>' . $mobile2 . '</mobile2>' .
		'<mobile2_short>' . $mobile2_short . '</mobile2_short>' .
		'<fax>' . $fax . '</fax>' .
		'<qq>' . $qq . '</qq>' .
		'<weixin>' . $weixin . '</weixin>' .
		'<weibo>' . $weibo . '</weibo>' .
		'<email>' . $email . '</email>' .
		'<roomname>' . $roomname . '</roomname>' .
		'<roomnumber>' . $roomnumber . '</roomnumber>' .
		'<idnumber>' . $idnumber . '</idnumber>' .
		'<carnumber>' . $carnumber . '</carnumber>' .
		'<homepage>' . $homepage . '</homepage>' .
		'<departid>' . $departid . '</departid>' .
		'<departname>' . $departname . '</departname>' .
		'<jobtitle>' . $jobtitle . '</jobtitle>' .
		'<jobnumber>' . $jobnumber . '</jobnumber>' .
		'<introduction>' . $introduction . '</introduction>' .
		'<password>' . $password . '</password>' .
		'<salt>' . $salt . '</salt>' .
		'</request> ';
	$responseinfo = '';
	$responsexml = null;
	$errorcode = 0;

	$cmd = new COM("OpenCom.Command");
	$methodname = iconv('UTF-8', 'GBK//IGNORE', $methodname);
	$requestinfo = iconv('UTF-8', 'GBK//IGNORE', $requestinfo);
	if ($cmd->Execute($methodname, $requestinfo, $responseinfo, 5000)) {
		$responseinfo = iconv('GBK', 'UTF-8//IGNORE', $responseinfo);
		$responsexml = simplexml_load_string($responseinfo);
		$errorcode = $responsexml->errorcode;
	}
	$cmd = null;

	echo $username . '(' . $errorcode . ')<br>';
}
echo 'addtestusers start...<br>';
for($i = 1; $i <= 10000; $i++ ) addtestuser($i, 'user' . $i);
echo 'addtestusers complete.<br>';

?>