<?php
include "../include/conn.php";
include "../include/function.php";
//include "../include/userset.php";
 
	$S_Name=$mobile;
	$S_PassWord=$pass;
	$S_UseDate=$time;
	$S_UseType=1;//包月

	echo "$S_Name,$S_PassWord,$S_UseDate,$S_UseType";


 	$sql="select * from s_users where S_Name='".$S_Name."'";
	echo "$sql<br>";
	$result=$db->query($sql);
	if($row=$db->fetch_array($result))
	{
		$sql="update s_users set S_PassWord='$S_PassWord',S_UseDate='$S_UseDate' where S_ID=$row[S_ID]";
		//$db->query($sql);
		echo "$sql<br>";
		//echo "ok";

		if($db->query($sql)){
			  echo "ok";
			}
		else{
			die("<script>jAlert('会员添加失败!','操作提示',function(R){history.back();})</script>");
			}
	}
	else
	{
		/*
		$sql="insert into s_users (S_Name,S_PassWord,S_Question,S_Answer,S_Group,S_RealName,S_QQ,S_Email,S_StartIP,";
		$sql.="S_LastIP,S_State,S_Tel,S_Type,S_UseDate,S_LogTime,S_CreateTime,S_LogNum,S_LogIP,S_Coin,S_ChangeTime S_UseType)";
		$sql.=" values ('$S_Name','$S_PassWord','1','1','0','1','1','1','1','1',";
		$sql.="'0','1','5','$S_UseDate','4','1',0,'1','0','1','$S_UseType')";
		//$db->query($sql);
		echo "$sql<br>";
		//echo "OK";

		if($db->query($sql)){
			  echo "ok";
			}
		else{
			echo "cuowu";
			}


         */
		//$sql="insert into s_users (S_Name,S_PassWord,S_Question,S_Answer,S_Group,S_RealName,S_QQ,S_Email,S_StartIP,S_LastIP,S_State,S_Tel,S_Type,S_UseDate,S_LogTime,S_CreateTime,S_LogNum,S_LogIP,S_Coin,S_ChangeTime) values ('".$S_Name."','".$S_PassWord."','".$S_Question."','".$S_Answer."','".$S_Group."','".$S_RealName."','".$S_QQ."','".$S_Email."','".$S_StartIP."','".$S_LastIP."','".$S_State."','".$S_Tel."','".$S_Type."','".$S_UseDate."','".$S_LogTime."','".$S_CreateTime."',0,'".$UserIP."','".$S_Coin."','".$S_ChangeTime."')";
		$sql="insert into s_users (S_Name,S_PassWord,S_Question,S_Answer,S_Group,S_RealName,S_QQ,S_Email,S_StartIP,S_LastIP,S_State,S_Tel,S_Type,S_UseDate,S_LogTime,S_CreateTime,S_LogNum,S_LogIP,S_Coin,S_ChangeTime) values ('13718672503','123456','','','','','','','','','','','','2009-12-20','','',0,'','','')";
		echo "$sql<br>";
		if($db->query($sql))
		{
			echo "dddddddddddd";
		}
		else
		{
			echo "错误";
		}


 	}

?>