<?php

	session_start();
	
	require_once("db/db.php");	
	require_once("common/common.php");
	
	//设置统一语言格式
	//header("Content-type: text/html; charset=gb2312"); 
	
	$strSelChainNo=trim($_REQUEST['chainno']);	
	$strSelUserNo=trim($_REQUEST['fwuser']);	
	$strSelRoomNos=trim($_REQUEST['rmno']);	

	$strTradeMan=trim($_SESSION['username']);
	
	$intreturn = 0;
	
	if(strlen($strSelRoomNos)>0)
	{
		$strselroomno='';	
		$intpos=0;
		
		while(strlen($strSelRoomNos)>0)
		{
			//开始创建
			$intpos = strpos($strSelRoomNos,',');
			
			if($intpos=='')
			{
				//没有分割符号
				$strselroomno = $strSelRoomNos;
				$strSelRoomNos = '';
			}
			else
			{
				//得到房号
				$strselroomno = substr($strSelRoomNos,0,$intpos);
				$strSelRoomNos = substr($strSelRoomNos,$intpos+1);
			}
	
			$sql = sprintf("EXECUTE TRS_WebAllocateRoomToUser '%s','%s','%s','%s',0",$strSelChainNo,$strselroomno,$strSelUserNo,$strTradeMan);
			executeSql($sql);
		}
		
		closeDb();
	}	
	
	echo '*1*';	//成功执行
?>