日期:2013-01-03  浏览次数:20482 次

#####################
# func.php #########
####################
<?php
require("config.inc.php");
##### 检查用户是否存在 #####
function is_user_exits($name) {
         $name=trim($name);
         $name=ereg_replace("'","‘",$name);
         $name=htmlspecialchars($name);
         $SQL="SELECT name FROM user WHERE name='$name'";
         $result=mysql_query($SQL) or die(mysql_error());
         $row=mysql_fetch_Array($result);
         $name=$row[name];
         return $name;
}
##### 检查版面是否存在 #####
function is_board_exits($baord){
         $sql="select name from boardinfo where name='$baord'";
         $result=mysql_query($sql) or die("出现错误");
         $row=mysql_fetch_array($result);
         $name=$row[name];
         return $name;
}
##### 添加新用户 Function #####
function adduser(){
         global $name,$sex,$realname,$password,$address,$oicq,$homepage,$phone,$email,$qm,$regtime;
         $name=trim($name);
         $name=ereg_replace("'","‘",$name);
         $password=trim($password);
         $name=htmlspecialchars($name);
         $realname=htmlspecialchars($realname);
         $address=htmlspecialchars($address);
         $oicq=htmlspecialchars($oicq);
         $homepage=htmlspecialchars($homepage);
         $phone=htmlspecialchars($phone);
         $email=htmlspecialchars($email);
         $qm=htmlencode2($qm);
         $regtime=date("Y-m-d H:i:s");
         $sql="insert into user (name,sex,realname,password,address,oicq,homepage,score,phone,email,qm,regtime,slaveboard) values('$name','$sex','$realname','$password','$address','$oicq','$homepage','0','$phone','$email','$qm','$regtime','')";
         mysql_query($sql) or die(mysql_error());
}
##### URL 重定向 ######
function redirect2($url){
         header("Location:$url");
}
##### 创建版面 ######
function create_board_table($name,$chinesename){
         $name=trim("$name");
         $sql="CREATE TABLE $name(id int(11) NOT NULL AUTO_INCREMENT,title varchar(50) NOT NULL,writer varchar(50) NOT NULL,cont longtext, size int,writetime varchar(20) NOT NULL,hits int(4) DEFAULT '0',good varchar(1),renum int(4) DEFAULT '0',slaveid int(11) DEFAULT '0',fromip varchar(15),PRIMARY KEY (id))";
         mysql_query($sql);
         $sql="insert into boardinfo (