<?php 	
   require('library/Db.class.php');
   $username  = $_POST['username'];
   $password  = $_POST['password'];
   $db = new DB();
   $sql="select username from mr_user where username =:username";
   $name = $db->row($sql,array('username' => $username));//查找username 2种结果
   if($name){
   	echo -1;
   	exit;//结束
   }
   $addtime = time();//返回当前时间的 Unix 时间戳
   //注意 插入账号
   $insert_sql = "insert  into mr_user (username ,password ,addtime) value (:username,:password,$addtime)";
   $insert_id = $db->query($insert_sql,array('username' => $username, "password"=>md5($password)));
   if($insert_id)
   {echo 1;}
	else
   {echo 0;}
 ?>