威尼斯正规官网请勿出售本程序或其修改版,复制代码 代码如下
分类:博客热点

php 文件安装三

总共需两个页面,register.php 和 verify.php

?php/////////////////////////////////////////////////////////////////////////////// 迷你同学录 (_class)//// (c)PiscDong studio ()//// 程序完全免费,请保留这段代码。// 请勿出售本程序或其修改版,请勿利用本程序或其修改版进行任何商业活动。/////////////////////////////////////////////////////////////////////////////

  1. 用户注册表格 register.php

require_once('inc.php');if(!file_exists($l_file)){echo getstop(2);if($_SERVER['REQUEST_METHOD']=='POST' $_POST['title']!='' $_POST['username']!='' $_POST['name']!='' $_POST['password']!=''){require_once($c_file);echo 'div class=title安装MySQL数据库/divdiv class=gcontentul';$query=create table {$dbprefix}main (id int(10) NOT NULL auto_increment,title varchar(255) NOT NULL,school varchar(255) default NULL,classname varchar(255) default NULL,open int(5) NOT NULL default '0',openreg int(5) NOT NULL default '0',gid varchar(255) default '1|2|3',content text,email int(5) NOT NULL default '0',pagesize int(10) NOT NULL default '20',upload int(5) NOT NULL default '0',maxsize int(10) NOT NULL default '0',filetype varchar(255) default 'jpg',thum int(5) NOT NULL default '0',slink int(5) NOT NULL default '0',veri int(5) NOT NULL default '0',icp varchar(255) default NULL,skin int(10) NOT NULL default '0',timefix varchar(255) NOT NULL default '0',ip varchar(255) default NULL,UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'main:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

复制代码 代码如下:  

$query=create table {$dbprefix}member (id int(10) NOT NULL auto_increment,username varchar(255) NOT NULL,password varchar(255) NOT NULL,name varchar(255) NOT NULL,status int(5) NOT NULL default '0',power int(5) NOT NULL default '0',regdate int(15) NOT NULL default '0',visit int(10) NOT NULL default '0',visitdate int(15) NOT NULL default '0',question varchar(255) default NULL,answer varchar(255) default NULL,email varchar(255) default NULL,gender int(5) NOT NULL default '0',bir_y int(4) NOT NULL default '0',bir_m int(2) NOT NULL default '0',bir_d int(2) NOT NULL default '0',address varchar(255) default NULL,location varchar(255) default NULL,url varchar(255) default NULL,work varchar(255) default NULL,phone varchar(255) default NULL,tel varchar(255) default NULL,qq varchar(255) default NULL,msn varchar(255) default NULL,gtalk varchar(255) default NULL,gid int(5) NOT NULL default '0',rela varchar(255) default NULL,photo varchar(255) default NULL,pupload int(5) NOT NULL default '0',UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'member:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

 

$query=create table {$dbprefix}online (aid int(10) NOT NULL default '0',datetime int(15) NOT NULL default '0',online int(5) NOT NULL default '1',ip char(15) default NULL,UNIQUE KEY aid (aid)) .(chksqlv()?'ENGINE=MEMORY DEFAULT CHARSET=gb2312':'type=HEAP');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'online:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

  

$query=create table {$dbprefix}topic (id int(10) NOT NULL auto_increment,content text NOT NULL,aid int(10) NOT NULL default '0',datetime int(15) NOT NULL default '0',sticky int(5) NOT NULL default '0',sid int(10) NOT NULL default '0',tid int(5) NOT NULL default '0',mid int(5) NOT NULL default '0',disp int(5) NOT NULL default '0',`lock` int(5) NOT NULL default '0',rid int(10) NOT NULL default '0',lasttime int(15) NOT NULL default '0',UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'topic:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

      用户名:

$query=create table {$dbprefix}vote (id int(10) NOT NULL auto_increment,aid int(10) NOT NULL default '0',tid int(10) NOT NULL default '0',vid int(10) NOT NULL default '0',datetime int(15) NOT NULL default '0',UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'vote:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

      密码:

$query=create table {$dbprefix}photo (id int(10) NOT NULL auto_increment,url text NOT NULL,title varchar(255) default NULL,aid int(10) NOT NULL default '0',cid int(10) NOT NULL default '0',datetime int(15) NOT NULL default '0',upload int(5) NOT NULL default '0',disp int(5) NOT NULL default '0',vid int(5) NOT NULL default '0',UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'photo:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

      电子邮件:

$query=create table {$dbprefix}pcomment (id int(10) NOT NULL auto_increment,aid int(10) NOT NULL default '0',pid int(10) NOT NULL default '0',disp int(5) NOT NULL default '0',datetime int(15) NOT NULL default '0',content text NOT NULL,UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'pcomment:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

     

$query=create table {$dbprefix}camp (id int(10) NOT NULL auto_increment,title varchar(255) NOT NULL,aid int(10) NOT NULL default '0',sticky int(5) NOT NULL default '0',closed int(5) NOT NULL default '0',disp int(5) NOT NULL default '0',datetime int(15) NOT NULL default '0',cdate varchar(255) default NULL,cloc varchar(255) default NULL,cpay varchar(255) default NULL,content text,UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'camp:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

  

$query=create table {$dbprefix}ccomment (id int(10) NOT NULL auto_increment,aid int(10) NOT NULL default '0',cid int(10) NOT NULL default '0',sid int(10) NOT NULL default '0',disp int(5) NOT NULL default '0',datetime int(15) NOT NULL default '0',content text,UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'ccomment:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

 

$query=create table {$dbprefix}cuser (id int(10) NOT NULL auto_increment,aid int(10) NOT NULL default '0',cid int(10) NOT NULL default '0',tid int(10) NOT NULL default '1',datetime int(15) NOT NULL default '0',UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'cuser:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

 

$query=create table {$dbprefix}message (id int(10) NOT NULL auto_increment,aid int(10) NOT NULL default '0',tid int(10) NOT NULL default '0',datetime int(15) NOT NULL default '0',readed int(5) NOT NULL default '0',content text NOT NULL,UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'message:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

  1. 创建用户数据表格 Users
    复制代码 代码如下:
     CREATE TABLE IF NOT EXISTS `users` (

$query=create table {$dbprefix}adminop (id int(10) NOT NULL auto_increment,aid int(10) NOT NULL default '0',sid int(10) NOT NULL default '0',tid int(5) NOT NULL default '0',datetime int(15) NOT NULL default '0',content text NOT NULL,UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'adminop:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

   `id` int(11) NOT NULL auto_increment,

$query=create table {$dbprefix}link (id int(10) NOT NULL auto_increment,title varchar(255) NOT NULL,url varchar(255) NOT NULL,thread int(10) NOT NULL default '0',UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'link:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

   `status` varchar(20) NOT NULL,

$query=create table {$dbprefix}skin (id int(10) NOT NULL auto_increment,path varchar(255) NOT NULL,title varchar(255) default NULL,sfile varchar(255) NOT NULL,UNIQUE KEY id (id)) .(chksqlv()?'ENGINE=MyISAM DEFAULT CHARSET=gb2312':'type=MyISAM');$result=mysql_query($query);echo 'li建立数据表 '.$dbprefix.'skin:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

   `username` varchar(20) NOT NULL,

$title=htmlspecialchars(trim($_POST['title']),ENT_QUOTES);$query=sprintf('insert into %s (title) values (%s)', $dbprefix.'main',SQLString($title, 'text'));$result=mysql_query($query);echo 'li写入新数据 '.$dbprefix.'main:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

   `password` varchar(20) NOT NULL,

$username=trim($_POST['username']);$password=enc_p(trim($_POST['password']));$name=htmlspecialchars(trim($_POST['name']),ENT_QUOTES);$query=sprintf('insert into %s (username, password, name, power, regdate) values (%s, %s, %s, 9, %s)', $dbprefix.'member',SQLString($username, 'text'),SQLString($password, 'text'),SQLString($name, 'text'),time());$result=mysql_query($query);echo 'li写入新数据 '.$dbprefix.'member:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);

   `email` varchar(20) NOT NULL,

$query=sprintf('insert into %s (path, title, sfile) values (%s, %s, %s)', $dbprefix.'skin',SQLString('blue', 'text'),SQLString('蓝色梦想', 'text'),SQLString('styles.css', 'text'));$result=mysql_query($query);echo 'li写入新数据 '.$dbprefix.'skin:span style=font-weight:bold;color:#'.($result==true?'036;成功':'f00;失败').'/span/li';unset($query);unset($result);echo '/ulinput type=button value=完成 class=button onclick=location.href='../';//div';writeText($l_file,time());}else{?div class=title第2步:配置信息/divdiv class=lcontentform method=post onsubmit=if(document.form1.title.value=='' || document.form1.username.value=='' || document.form1.password.value=='' || document.form1.name.value==''){alert('请输入配置信息。');return false;}else if(document.form1.password.value!='' document.form1.password.value!=document.form1.password2.value){alert('请确认密码。');return false;} name=form1div class=formlinelabel for=formtitle标 题:/labelinput name=title id=formtitle size=32//divdiv class=formline管理员信息/divdiv class=formlinelabel for=formusername用户名:/labelinput name=username id=formusername size=32//divdiv class=formlinelabel for=formname姓 名:/labelinput name=name id=formname size=32//divdiv class=formlinelabel for=formpassword密 码:/labelinput type=password name=password id=formpassword size=32//divdiv class=formlinelabel for=formpassword2确 认:/labelinput type=password name=password2 id=formpassword2 size=32//divdiv class=formlineinput type=submit value=下一步 id=formsubmit class=button / input type=reset value=重置 class=button //div/form/div?php}echo getsfoot();}else{header('Location:../');}?

   `activationkey` varchar(100) NOT NULL,

   PRIMARY KEY  (`id`),

   UNIQUE KEY `username` (`username`),

   UNIQUE KEY `email` (`email`),

   UNIQUE KEY `activationkey` (`activationkey`)

 ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

  1. 创建验证码 用户注册信息存入数据表
    我们使用状态‘verify' 来表示尚未激活的用户。

复制代码 代码如下:
 $activationKey =  mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();

 $username = mysql_real_escape_string($_POST[username]);

 $password = mysql_real_escape_string($_POST[password]);

 $email = mysql_real_escape_string($_POST[email]);  

 $sql="INSERT INTO users (username, password, email, activationkey, status) VALUES ('$username', '$password', '$email', '$activationKey', 'verify')";

  1. 发送验证码
    复制代码 代码如下:
     echo "An email has been sent to $_POST[email] with an activation key. Please check your mail to complete registration.";

 ##Send activation Email

 $to      = $_POST[email];

 $subject = " YOURWEBSITE.com Registration";

 $message = "Welcome to our website!rrYou, or someone using your email address, has completed registration at YOURWEBSITE.com. You can complete registration by clicking the following link:r this is an error, ignore this email and you will be removed from our mailing list.rrRegards, YOURWEBSITE.com Team";

 $headers = 'From: noreply@ YOURWEBSITE.com' . "rn" .  

     'Reply-To: noreply@ YOURWEBSITE.com' . "威尼斯正规官网,rn" .  

     'X-Mailer: PHP/' . phpversion();  

 mail($to, $subject, $message, $headers);

  1. 验证激活代码 verify.php
    如果验证码相同,则激活用户。

复制代码 代码如下:
 $queryString = $_SERVER['QUERY_STRING'];

 $query = "SELECT * FROM users";

 $result = mysql_query($query) or die(mysql_error());

 while($row = mysql_fetch_array($result)){  

     if ($queryString == $row["activationkey"]){

        echo "Congratulations!" . $row["username"] . " is now the proud new owner of a YOURWEBSITE.com account.";

        $sql="UPDATE users SET activationkey = '', status='activated' WHERE (id = $row[id])";         

        if (!mysql_query($sql)) {

           die('Error: ' . mysql_error());

        }          

         // 到这里,用户已经完全激活了账号,你可以将页面跳转到登陆后的界面了  

     }

   } // end of while

本文由威尼斯在线注册平台发布于博客热点,转载请注明出处:威尼斯正规官网请勿出售本程序或其修改版,复制代码 代码如下

上一篇:采纳DISTINCT撤除重复值,SELECT 子查询和 SELECT 联接 下一篇:它的父对象或它们所实现的接口是否来自指定的对象类,1.多态的介绍和优势
猜你喜欢
热门排行
精彩图文