<?php

/*
*	Copyright VeryIDE,2007-2010
*	http://www.veryide.com/
*
*	2011/6/5 Lay
*/

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

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

	//module
	require 'naver.php';

	//载入通行证函数
	file_exists(VI_ROOT."module/passport/") ? require VI_ROOT.'module/passport/function.php' : exit('<div id="state" class="failure">对不起，没有找到通行证模块！</div>');
    
	$action = getgpc('action');
	
	//连接数据库
	System :: connect();
	
	switch($action){
		
		//测试登录
		case "login":
			
			$username = getgpc("username");
			$password = getgpc('password');		
			
			$result = Passport :: login( $username, md5( $password ) );
			
		break;
		
		//测试积分
		case "credit":
			
			$userid = getnum("userid");
			$credit = getnum("credit");
			
			$before = Passport :: money( $userid );
			
			$result = Passport :: money( $userid, $credit );
			
		break;
		
		//测试消息
		case "notice":
			
			$userid = getnum("userid");
			$subject = getgpc("subject");
			$content = getgpc("content");
			
			$result = Passport :: notice( $userid, $subject, $content );
			
		break;
	}
	
	//关闭数据库
	System :: connect();
    
    ?>

	<div id="box">
    
	<form action="" method="post" name="from1" mode="edit" verify="true">        
                        
        <table cellpadding="0" cellspacing="0" class="form">
            <tr>
                <td colspan="3" class="section"><strong>用户登录</strong></td>                
            </tr>
            
            <tr>
                <td width="60"><strong>用户名：</strong></td>
                <td>
                	<input name="username" type="text" class="text" size="30" fix_name="用户名" fix_null="yes" value="<?php echo $username;?>" />
                </td>
                <?php
				if( $action == 'login' ){
				?>
                <td rowspan="3" class="block">
                    <p><b class="text-key">处理结果：</b><?php echo $result;?></p>
                    <p><b class="text-key">用户信息：</b><?php var_dump( $_G['member'] ) ;?></p>
                </td>
                <?php
				}
				?>
            </tr>
        
            <tr>
                <td width="60"><strong>密　码：</strong></td>
                <td>
                	<input name="password" type="password" class="text" size="30" fix_name="密　码" fix_null="yes" value="<?php echo $password;?>" />
                </td>
		</tr>
            
            <tr class="nobr">
                <td><strong></strong></td>
                <td>
                    <input name="action" type="hidden" value="login" />
                    <input type="submit" name="Submit" value="立即登录" class="submit" />
                </td>				
            </tr>
	    
		</table>
        </form>
    
        <form action="" method="post" name="from1" mode="edit" verify="true">        
                        
        <table cellpadding="0" cellspacing="0" class="form">
            <tr>
                <td colspan="3" class="section"><strong>积分操作</strong></td>                
            </tr>
            
            <tr>
                <td width="60"><strong>用户ID：</strong></td>
                <td>
                	<input name="userid" type="text" class="text" size="30" fix_name="用户ID" fix_number="yes" value="<?php echo $userid;?>" />
                    数字 ID
                </td>
                <?php
				if( $action == 'credit' ){
				?>
                <td rowspan="3" class="block">
                    <p><b class="text-key">积分类型：</b><?php echo $_G['setting']['passport']['currency'];?></p>
                    <p><b class="text-key">原始积分：</b><?php echo $before;?></p>
                    <p><b class="text-key">现在积分：</b><?php echo $result;?></p>
                </td>
                <?php
				}
				?>
            </tr>
        
            <tr>
                <td width="60"><strong>积分变化：</strong></td>
                <td>
                	<input name="credit" type="text" class="text" size="30" fix_name="积分变化" fix_number="no" value="<?php echo $credit;?>" />
                    例如：+10 或 -5
                </td>                
            </tr>
            
            <tr class="nobr">
                <td><strong></strong></td>
                <td>
                    <input name="action" type="hidden" value="credit" />
                    <input type="submit" name="Submit" value="立即操作" class="submit" />
                </td>				
            </tr>
		</table>
        </form>
    
		<form action="" method="post" name="from1" mode="edit" verify="true">        
                        
        <table cellpadding="0" cellspacing="0" class="form">
            <tr>
                <td colspan="3" class="section"><strong>消息操作</strong></td>                
            </tr>
            
            <tr>
                <td width="60"><strong>用户ID：</strong></td>
                <td>
                	<input name="userid" type="text" class="text" size="30" fix_name="用户ID" fix_null="yes" value="<?php echo $userid;?>" />
                    数字 ID
                </td>
                <?php
				if( $action == 'notice' ){
				?>
                <td rowspan="3" class="block">
                    <p><b class="text-key">处理结果：</b><?php echo var_dump($result);?></p>
                </td>
                <?php
				}
				?>
            </tr>
        
            <tr>
                <td width="60"><strong>消息主题：</strong></td>
                <td>
                	<input name="subject" type="text" class="text" size="30" fix_name="消息主题" fix_null="yes" value="<?php echo $subject ? $subject : '这是消息主题';?>" />
                </td>                
            </tr>
            
            <tr>
                <td width="60"><strong>消息内容：</strong></td>
                <td>
                	<input name="content" type="text" class="text" size="30" fix_name="消息内容" fix_null="yes" value="<?php echo $content ? $subject : '这是消息内容……';?>" />
                </td>                
            </tr>
            
            <tr class="nobr">
                <td><strong></strong></td>
                <td>
                    <input name="action" type="hidden" value="notice" />
                    <input type="submit" name="Submit" value="立即发送" class="submit" />
                </td>				
            </tr>
		</table>
        </form>
     
	</div>
     
<!--body end-->

<?php html_close();?>