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

require("common.php");

$openid = isset($_POST['openid']) ? $_POST['openid'] : ''; 

$methodname = 'WebVisitor.GetSessionStatus';
$requestinfo = '<?xml version="1.0" encoding="utf-8"?><request>' . 
	'<openid>' . $openid . '</openid>' . 
	'</request> ';
$responseinfo = '';
$responsexml = null;
$errorcode = ERRORCODE_UNKNOWN;

$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, 500)) {
	$responseinfo = iconv('GBK', 'UTF-8//IGNORE', $responseinfo);
	$responsexml = simplexml_load_string($responseinfo);
	$errorcode = $responsexml->errorcode;
}
$cmd = null;

switch($errorcode) {
	case ERRORCODE_OK: 
		echo $responsexml->sessionstatus;
		break;
	default:
		echo "";
}//switch
?>