<?php
include("loginkey.php");//引入公共变量文件
include("include/config.php");//引入公共变量文件
include("include/common.php");//引入公共变量文件
$uname = cinput($_POST['username']);
$upass = md5(cinput($_POST['upassword']));
$upass2 = md5(cinput($_POST['upassword2']));
$uid = cinput($_POST['userid']);
$umail = cinput($_POST['usermail']);
$getip = getip();
$getdate = date("Y/m/d");
if($upass<>$upass2){
	viewmsg('两次密码不相同','reguser.php');
	}
//查找数据库是否有同名
$sqlstr="select * from limao_admin where lm_username='".mysql_real_escape_string($uname)."' limit 1";
$rs = limaors($sqlstr);
$rows=mysql_fetch_assoc($rs);
if($rows){
 viewmsg('用户已经存在','reguser.php');
}else{
//写入数据库 
$sql="insert into limao_admin(lm_username,lm_password,lm_userid,lm_userlateip,lm_userlatetime,lm_email,lm_useraction) values
('".mysql_real_escape_string($uname)."','".mysql_real_escape_string($upass)."','".mysql_real_escape_string($uid)."','$getip','$getdate','".mysql_real_escape_string($umail)."',-1)";

$resule = limaors($sql);
viewmsg('用户注册成功！','user_list.php');   
} 
?>