<?php

/*
*	Copyright VeryIDE,2007-2010
*	http://www.veryide.com/
*
*	$Id: ,v1 10:39 2008-7-27 Leilei $
*/

require("../../include/header.php");
html_start("会员列表 - VeryIDE");
?>

<!--body start-->
	<?php

	//module
	//require("naver.php");
	require("config.php");

	$q = GetQuery("q");
	$s = GetQuery("s");
	
	$uid = GetNumber("uid",0);
	$list = GetQuery("list");
	$status = GetNumber("status",1);
	$order = GetQuery("order");
	$action = GetQuery("action");
	
	//mysql open
	reader_mysql();

	if ($action){
	
		switch($action){
			//删除
			case "delete":
			
				//检查权限
				checker_func("mod-pk-mod");		
			
				mysql_query("delete from ".VI_DBMODPRE."forms where id in(".$list.")");
				mysql_query("delete from ".VI_DBMODPRE."groups where fid in(".$list.")");
				mysql_query("delete from ".VI_DBMODPRE."options where fid in(".$list.")");
				mysql_query("delete from ".VI_DBMODPRE."values  where fid in(".$list.")");				
				
				$Project["queries"]+=4;
				
				//删除缓存
				$array = explode(",",$list);
				for($i=0; $i<count($array); $i++){
					$file = VI_ROOT."/".$Project["cache"]."/module-forms-".$array[$i].".php";
					unlink($file);
				}
				
				reader_redirect($appid.".list.php","表单数据删除成功!");
				
			break;
			
			//状态
			case "create":
				//生成缓存
				cache_forms($list,$appid,$mysql);				
				
				reader_redirect($jump,"表单缓存更新成功!");
				
			break;
			
			case "status":
			
				//检查权限
				checker_func("mod-pk-mod");		
			
				$sql="update ".VI_DBMODPRE."forms set status=".$status." where appid='".$appid."' and id in(".$list.")";
				mysql_query($sql);
				
				$Project["queries"]++;
				
				//生成缓存
				cache_forms($list,$appid,$mysql);
				
				reader_redirect($jump,"表单状态更改成功!");

			break;
		}
	}
	
	//用户信息
    $sql="SELECT * FROM ".VI_DBMODPRE."members where id=".$uid;
    $result=mysql_query($sql,$mysql);
	
    $Project["queries"]++;
    
    if( mysql_num_rows($result)==1 ){
        $row = mysql_fetch_assoc($result);
    }
    ?>
    
    <div id="nav">
        <strong><?php echo $row["account"];?></strong> 个人信息 	
    </div>
    
    <table width="100%" border="0" cellpadding="1" cellspacing="1" id="table" class="table">
                    
        <?php
        
        //用户数据
		$i = 0;
        foreach ($Modules["member"]["fieds"] as $fied => $name){
			
            //转换数据					
            switch($fied){
            
                case 'sex':						
                    $val = $Project["sex"][$row[$fied]];
                break;
            
                case 'marriage':						
                    $val = $Project["marriage"][$row[$fied]];
                break;
            
                case 'modify':						
                case 'dateline':						
                    $val = date("Y/m/d H:i:s",$row[$fied]);
                break;
            
                default:						
                    $val = $row[$fied];
                break;
            
            }
			
            echo '<tr class="'.($i%2?'title':'line').'"> <td width="100" align="right">'.$name.'</td> <td class="text-yes"> '.$val.' </td></tr>';
			
			$i++;
        }
        
        
        ?>
    </table>
    
    <?php
  
    //mysql close
    reader_mysql(true);
    
    ?>
    
<!--body end-->

<?php html_close();?>