<?php
/****************************************************
* update active state
***************************************************/
include_once("config.php");
include_once("mysql_interface.php");
include_once("func_core.php");
?>
<body bgcolor=#eeffaa>
<?php
if(!isset($_GET['strid']) || !isset($_GET['strckd'])
	|| "" == $_GET['strid'] || "" == $_GET['strckd'])
{
	show_error("update active state failed", "update error");
	?>
	<meta http-equiv = 'refresh' content=3;URL='userinfo_manage.php' />
	<?php
}
else
{
	$idlist = $_GET['strid'];
	$ckstlist = $_GET['strckd'];
	try{
			$id = explode("|", $idlist);
			$ck = explode("|", $ckstlist);
			$unikey_db = new mydb();//create database object
			
			if(!($unikey_db->connect($_config['host'], $_config['dbuser'], $_config['passwd'], $_config['port'], $_config['dbname'])))//check database connect
			{
				throw new Exception("Connect database failed");
			}
			$count = count($id);
			for($i = 1; $i < $count; ++$i)
			{
				$sql = "update UniMateToken_UserInfo set active = ".$ck[$i]." where id = '".$id[$i]."'";
			
				if(!($result = $uni_db->query($sql)))
				{
					echo $id[$i]." update failed.<br>";
				}
			}
			show_done("update active state success", "update succeed");
			?>
			<meta http-equiv='refresh' Content=5;URL='userinfo_manage.php'>
			<?php
		}
	catch(Exception $e)
	{
		show_error($e->GetMessage(),"update error");
	}
}

?>
</body>