<?PHP
require_once 'db.php';
if($_POST[button]){
$sql="SELECT * FROM `gm_user` where (`user` = '".$_POST[textfield]."') ";
$query=$db->query($sql);
$userif= $db->fetch_array($query);
if($userif[id]<>null){
echo("´ËÕËºÅÒÑ¾­±»×¢²á");
}else{
$sql="INSERT INTO `gm_user` (`id`,`user`,`pass`,`ip`) VALUES (NULL,'".$_POST[textfield]."','".md5($_POST[textfield2])."','".$_SERVER["REMOTE_ADDR"]."') ";
$db->query($sql);
setcookie("zhanghao", $_POST[textfield], time() + 60*60*24*30*12);
setcookie("mima",md5($_POST[textfield2]), time() + 60*60*24*30*12);
} 

} 
?>