⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 register.php

📁 我不介意你怎么用这个程序
💻 PHP
字号:
<?php
include("includes/fun_data.php");
include("includes/inc_var.php");
DB($g_db_host, $g_db_name, $g_db_user, $g_db_password);
$db = new DBReader;
if(!empty($_POST["name"]))
{
	include("includes/fun_post.php");
	$db->execute("SELECT * FROM ".$g_db_prefix."user WHERE u_name = '".$_POST["name"]."'");
	if(0!=$db->count())
	{
		echo "<script language='javascript'>window.alert('该用户名已存在!');self.location='register.php';</script>";
		exit();
	}
	if(isset($_POST["showip"]))
		$showIP = "S";
	else
		$showIP = "N";
	$db->execute("INSERT INTO `".$g_db_prefix."user` ( `u_ID` , `u_name` , `u_password` , `u_homepage` , `u_mail` , `u_title` , `h_ID` , `s_ID` , `u_pagesize` , `u_IP` ) VALUES ('', '".h2t($_POST["name"])."', MD5( '".$_POST["password"]."' ) , '".h2t($_POST["homepage"])."', '".h2t($_POST["mail"])."', '".h2t($_POST["title"])."', '".$_POST["head"]."', '".$_POST["style"]."', '".$_POST["pagesize"]."', '".$showIP."');");
	$db->execute("SELECT * FROM ".$g_db_prefix."user WHERE u_name = '".$_POST["name"]."'");
	$dbrow = $db->reader();
	echo "<script language='javascript'>window.alert('用户 ".$_POST["name"]." 注册成功!');self.location='index.php?id=".$dbrow["u_ID"]."';</script>";
	exit();	
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="includes/main.css" rel="stylesheet" type="text/css">
<title>星雨留言板</title>
<script language="JavaScript">
<!--
function verifyAddress(obj)  
{  
	var email = obj;  
	var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;  
	flag = pattern.test(email);  
	if(flag)  
		return true;  
	else  
		return false;  
}
function regcheck() {
	if (this.document.reg.name.value==""){
		window.alert("请输入用户名!");
		this.document.reg.name.focus();
		return;		
	}
	if (this.document.reg.password.value==""){
		window.alert("请输入密码!");
		this.document.reg.password.focus();
		return;		
	}
	if (this.document.reg.repassword.value==""){
		window.alert("请重复密码!");
		this.document.reg.repassword.focus();
		return;		
	}
	if (this.document.reg.password.value!=this.document.reg.repassword.value){
		window.alert("重复密码与密码不符!");
        document.reg.repassword.select();
		this.document.reg.repassword.focus();
		return;		
	}
	if((this.document.reg.homepage.value=="")||(this.document.reg.homepage.value=="http://")){
		window.alert("请输入主页!");
		this.document.reg.homepage.focus();
		return;		
	}
	if (this.document.reg.mail.value==""){
		window.alert("请输入电子邮件!");
		this.document.reg.mail.focus();
		return;		
	}
	if(!verifyAddress(document.reg.mail.value))
	{
		window.alert("请输入正确的电子邮件!");
		document.reg.mail.select();
		document.reg.mail.focus();
		return;
	}
	if(this.document.reg.title.value==""){
		window.alert("请输入网站标题!");
		this.document.reg.title.focus();
		return;
	}
	this.document.reg.submit();
	return;
}
//-->
</script>
</head>
<body topmargin="0">
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0" class="tableborder">
  <tr> 
    <th height="20"><a href="http://www.xxiyy.com">回到首页</a></th>
    <th><a href="mailto:mikespook@163.com">联系站长</a></th>
    <th><a href="http://www.xxiyy.com/phpBB2/">进入论坛</a></th>
    <th><a href="login.php">进入管理</a></th>
  </tr>
</table><p>
<?php
$db->execute("SELECT * FROM `".$g_db_prefix."user`");
$user = $db->count();
$db->execute("SELECT * FROM `".$g_db_prefix."style`");
$style = $db->count();
$db->execute("SELECT * FROM `".$g_db_prefix."head`");
$head = $db->count();
$db->execute("SELECT * FROM `".$g_db_prefix."words`");
$words = $db->count();
if($user == 0)
	$avg = 0;
else
	$avg = $words / $user; 
?>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0" class="tableborder">
  <tr>
    <th height="20">留言板信息</th>
  </tr>
  <tr> 
    <td height="20">系统提供样式模板 <strong><font color="#FF0000"><?php echo $style?></font></strong> 套;头像模板 <strong><font color="#FF0000"><?php echo $head?></font></strong> 套。 
    </td>
  </tr>
  <tr> 
    <td height="20">共有注册用户 <strong><font color="#FF0000"><?php echo $user?></font></strong> 人;共有留言 <strong><font color="#FF0000"><?php echo $words?></font></strong> 篇;平均每个注册用户有 <strong><font color="#FF0000"><?php echo $avg?></font></strong> 篇留言。</td>
  </tr>
</table>
<form action="register.php" method="post" name="reg" id="reg">
  <table width="640" border="0" align="center" cellpadding="0" cellspacing="0" class="tableborder">
    <tr> 
      <th height="20" colspan="2">申请留言板</th>
    </tr>
    <tr> 
      <td width="107" height="20" align="right">用户名: </td>
      <td width="479"> <input name="name" type="text" class="textbox" id="name" maxlength="16">
        进入管理时使用的用户名。 </td>
    </tr>
    <tr> 
      <td height="20" align="right">密码: </td>
      <td><input name="password" type="password" class="textbox" id="password" maxlength="255">
        进入管理时使用的密码。</td>
    </tr>
    <tr> 
      <td height="20" align="right">重复密码: </td>
      <td><input name="repassword" type="password" id="repassword" maxlength="255" class="textbox">
        重复密码。 </td>
    </tr>
    <tr> 
      <td height="20" align="right">主页: </td>
      <td><input name="homepage" type="text" class="textbox" id="homepage" value="http://" maxlength="255">
        您的主页地址。</td>
    </tr>
    <tr> 
      <td height="20" align="right">电子邮件: </td>
      <td><input name="mail" type="text" class="textbox" id="mail" maxlength="64">
        您的电子邮件地址。 </td>
    </tr>
    <tr> 
      <td height="20" align="right">标题: </td>
      <td><input name="title" type="text" class="textbox" id="title" maxlength="64">
        浏览器标题显示内容。</td>
    </tr>
    <tr> 
      <td height="20" align="right">样式模板: </td>
      <td><select name="style" class="button" id="style">
          <?php
$db->execute("SELECT * FROM `".$g_db_prefix."style`");
while($dbrow = $db->reader())
	echo "<option value=\"".$dbrow["s_ID"]."\">".$dbrow["s_name"]."</option>";
?>
        </select>
        使用图片与样式。</td>
    </tr>
    <tr> 
      <td height="20" align="right">头像模板: </td>
      <td><select name="head" class="button" id="head">
          <?php
$db->execute("SELECT * FROM `".$g_db_prefix."head`");
while($dbrow = $db->reader())
	echo "<option value=\"".$dbrow["h_ID"]."\">".$dbrow["h_name"]."</option>";
?>
        </select>
        使用头像。</td>
    </tr>
    <tr> 
      <td height="20" align="right">每页留言数: </td>
      <td><select name="pagesize" id="pagesize" class="button">
          <option value="5">5条</option>
          <option value="10">10条</option>
          <option value="15">15条</option>
          <option value="20">20条</option>
          <option value="25">25条</option>
          <option value="30">30条</option>
        </select></td>
    </tr>
    <tr> 
      <td height="20" align="right">显示留言IP: </td>
      <td><input name="showip" type="checkbox" class="button" id="showip" value="S" checked>
        是 </td>
    </tr>
    <tr> 
      <td height="20" colspan="2" align="center"><input type="button" name="Submit" value="注册" class="button" onClick="javascript:regcheck();"> 
        <input type="reset" name="Submit2" value="重置" class="button"></td>
    </tr>
  </table>
</form>
<form action="search.php" method="post" name="search" id="search">
  <table width="640" border="0" align="center" cellpadding="0" cellspacing="0" class="tableborder">
    <tr> 
      <th height="20" colspan="2">如果您已经注册,但是忘记了自己的留言板地址。请使用下面的搜索来查找您的留言板。切勿重复注册!</th>
    </tr>
    <tr> 
      <td width="280" height="20" align="right">注册时使用的用户名:</td>
      <td width="358"><input name="sname" type="text" class="textbox" id="sname">
        <input type="submit" name="Submit3" value="搜索" class="button"></td>
    </tr>
  </table>
</form>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0" class="tableborder">
  <tr> 
    <td height="20" align="center">Powered by <a href="http://www.xxiyy.com">mikespook 
      &amp; swill</a> (C) 2002, 2003 mikespook &amp; swill</td>
  </tr>
  <tr> 
    <td height="20" align="center">星雨留言板-PHP Version: <?php include("includes/inc_ver.php");echo $g_version;?></td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -