<?php
	session_start();
	include "conn/conn.php";
	$c_sql = "select * from tb_music_user where name = '".$_POST[name]."'";
	$c_rst = $conn->execute($c_sql);
	if(!($c_rst == false)){
		if(!$c_rst->EOF){
			echo "<script>alert('用户名重复，请重新输入');history.go(-1);</script>";
			exit();
		}
	}
	if(isset($_POST[regi])){
	$sqlstr = "insert into tb_music_user(tb_music_user,tb_music_pass,tb_music_question,tb_music_answer,tb_music_sex,tb_music_email,tb_music_qq,tb_music_homepage,tb_music_whether) values ('".$_POST[name]."','".$_POST[password]."','".$_POST[question]."','".$_POST[answer]."','".$_POST[sex]."','".$_POST[email]."','".$_POST[qq]."','".$_POST[http]."','1')";
	if($conn->Execute($sqlstr) == false){
		echo "<script>alert('添加错误：".$conn->Errormsg()."');history.go(-1);</script>";
	}
	else{
		echo "<script>alert('恭喜,用户注册成功.请重新登录');window.close();</script>";
	}}
	else{
		echo "<script>alert('!@#$$#@!@#,非法登录');window.close();</script>";
	}
?>