小型bbs论坛系统开发6 前台注册/登录页
来源:互联网 发布:mac不能导入照片 编辑:程序博客网 时间:2024/04/29 14:17
<?php include_once './inc/config.inc.php';include_once './inc/mysql.inc.php';include_once './inc/tool.inc.php';$link = sql_connect();//检查登录状态if($id = is_login($link)){ skip('index.php','error','你已经登录了,无需再注册!');}//用户提交注册if(isset($_POST['submit'])){//一:验证表单数据 include_once './inc/check_register.inc.php';//二:转义特殊字符,防止sql语句出现错误 $_POST = sql_escape($link,$_POST);//三:入库验证 //查询:注册用户名是否已经存在! $query = "select * from sfk_member where username = '{$_POST['username']}'"; $result = sql_execute($link,$query); if(mysqli_num_rows($result) == 1){ skip('register.php','error',"用户{$_POST['username']}已经存在"); }//四:入库 $query = "insert into sfk_member(username,password,register_time) values('{$_POST['username']}', md5('{$_POST['password']}'), now())"; sql_execute($link,$query);//五:入库后的验证 if(mysqli_affected_rows($link) == 1){ setcookie("sfk[username]","{$_POST['username']}"); setcookie("sfk[password]",md5("{$_POST['password']}")); skip('index.php','ok','用户注册成功!'); }else{ skip('register.php','error','用户注册失败!'); }}?> <?php include_once './inc/header.inc.php';?> <div id="register" class="auto"> <h2>欢迎注册成为 私房库会员</h2> <form method = "POST"> <label>用户名:<input type="text" name = 'username'/> <span>*请合法填入用户名</span> </label> <label>密码:<input type="password" name = 'password' /> <span>*请合法填入密码</span> </label> <label>确认密码:<input type="password" name = 'password2' /> <span>*请输入上方的密码</span> </label> <label>验证码:<input name="vcode" type="text" /> <span>*请输入下方验证码</span> </label> <img class="vcode" src="style/show_code.php" onClick="this.src='style/show_code.php?nocache='+Math.random()"/> <div style="clear:both;"></div> <input class="btn" type="submit" value="确定注册" name = 'submit' /> </form> </div> <?php include_once './inc/footer.inc.php';?>
<?php include_once './inc/config.inc.php';include_once './inc/mysql.inc.php';include_once './inc/tool.inc.php';//初始化css$cssArray = array('public.css','register.css');//初始化网站标题$webTitle = '用户登录页';//获取数据库连接$link = sql_connect();//验证登录状态if(is_login($link)){ skip('index.php','ok',"{$_COOKIE['sfk']['username']},您已经登录,正在返回首页!");}//验证表单数据--提交按钮if(isset($_POST['submit'])){ //一、验证表单数据 include_once './inc/check_login.inc.php'; //二、特殊字符转义,防止sql语句出现错误. $_POST = sql_escape($link,$_POST); //三、查询账户是否存在数据库中 $query = "select * from sfk_member where username = '{$_POST['username']}' and password = md5('{$_POST['password']}')"; $result = sql_execute($link,$query); //四、执行查询操作 if(mysqli_num_rows($result) == 1){ setcookie("sfk[username]","{$_POST['username']}",time()+$_POST['time']); setcookie("sfk[password]",md5("{$_POST['password']}"),time()+$_POST['time']); if(isset($_GET['url'])){ skip($_GET['url'],'ok',"{$_POST['username']},欢迎回来"); }else{ skip('index.php','ok',"{$_POST['username']},欢迎回来"); } }else{ skip('login.php','error','您的账户信息有误!'); }}?> <?php include_once './inc/header.inc.php';?> <div id="register" class="auto"> <h2>欢迎登录</h2> <form method = 'POST'> <label>用户名:<input type="text" name = 'username'/><span></span></label> <label>密码:<input type="password" name = 'password' /><span></span></label> <label>验证码:<input name="vcode" type="text" /><span>*请输入下方验证码</span></label> <img class="vcode" src="style/show_code.php" onClick="this.src='style/show_code.php?nocache='+Math.random()"/> <label>自动登录: <select style="width:236px;height:25px;" name="time"> <option value="3600">1小时内</option> <option value="86400">1天内</option> <option value="259200">3天内</option> <option value="2592000">30天内</option> </select> <span>*公共电脑上请勿长期自动登录</span> </label> <div style="clear:both;"></div> <input class="btn" type="submit" name = 'submit' value="登录" /> </form> </div> <?php include_once './inc/footer.inc.php'; ?>
0 0
- 小型bbs论坛系统开发6 前台注册/登录页
- 小型bbs论坛系统开发9 前台父板块列表页
- 小型bbs论坛系统开发10 前台子版块列表页
- 小型bbs论坛系统开发2 模板页首页制作
- 小型bbs论坛系统开发7 会员帖子发布页
- 小型bbs论坛系统开发8 首页
- 小型bbs论坛系统开发1 需求分析
- 小型bbs论坛系统开发3 后台父板块展示/删除
- 小型bbs论坛系统开发4 后台父板块添加/修改
- 小型bbs论坛系统开发5 后台子板块添加/修改
- C++开发的论坛系统 - BBS
- 基于SSH开发的BBS论坛系统
- BBS项目笔记之十:登录和注册模块的前台实现
- BBS论坛系统需求说明书
- Jsp论坛系统(BBS)源码
- 基于jsp,JQuery,Servlet,MySQL的小型BBS论坛
- dz论坛登录注册-dz论坛第三方登录注册
- 国内几大主流论坛(bbs)系统
- 模拟实现strcat
- 长度为N的数组乱序存放着0带N-1.现在只能进行0与其他数的swap操作,请设计并实现排序,必须通过交换实现排序。
- Activity到底是什么时候显示到屏幕上的呢?
- C/S和B/S的区别
- HTML5的文档结构
- 小型bbs论坛系统开发6 前台注册/登录页
- 问题六:C++中&是干嘛用的(引用类型)
- 模拟实现strcmp
- 【LeetCode】130. Surrounded Regions
- 关于socket中被动方的close的执行
- 集合框架_TreeMap集合键是Student值是String的案例
- 小型bbs论坛系统开发7 会员帖子发布页
- java、javax、org和com.sun包的区别
- java内部类的作用