Home  >  Article  >  Backend Development  >  [Transfer]php user login code_PHP tutorial

[Transfer]php user login code_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 16:59:25753browse

A very detailed login code, which is of great help to PHP beginners. Friends in need can view it for free.

Rendering.

index.php tutorial

The code is as follows Copy code
 代码如下 复制代码




系统登录


 

 
系统后台登陆

   

     

用户名:
       
      *


     

密 码:
       
      *


     

验证码:
       
        *


     


       
       
     


   

 





System login

 代码如下 复制代码

$connect=mysql教程_connect("localhost","root","")or die("服务器连接失败");
mysql_select_db("test",$connect)or die("没有建立相应的数据库");
$sql="select * from admin";
?>



 System background login


Username:
          
*


Password  Code:
          
*


Verification code:
          
                                                                                                                     


          
          






Database tutorial connection connect.php
The code is as follows Copy code
$connect=mysql tutorial_connect("localhost","root","")or die("Server connection failed");
mysql_select_db("test",$connect)or die("No corresponding database was created");
$sql="select * from admin";
?>

图片验证码 piccheck.php

 代码如下 复制代码
/*
* Created on 2011-8-10
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclips教程e - PHP - Code Templates
*/
session_start();
$code=rand(0,9).dechex(rand(10,15)).rand(0,9).dechex(rand(10,15));
$_SESSION[pic]=$code;
$image=imagecreatetruecolor(50,18);
$color=imagecolorallocate($image,0,0,0);//第一次使用调色板,会设为背景颜色
$colortext=imagecolorallocate($image,rand(100,255),rand(100,255),rand(100,255));
imagestring($image,10,rand(1,15),rand(1,5),$code,$colortext);
imagegif($image);
?>

css.css文件

 代码如下
 代码如下 复制代码

@charset "utf-8";
/* CSS Document */

body {
 background-color: #9CF;
 text-align: left;
}
#denglu {
 width: 400px;
 margin-top: 0px;
 margin-right: auto;
 margin-bottom: 0px;
 margin-left: auto;
 background-image: url(images/login.gif);
 background-repeat: no-repeat;
 height: 320px;
 text-indent: 6px;
}
#box #denglu form {
 position: relative;
 top: 50px;
 left: 10px;
 width: 92%;
}
.must {
 color: #F00;
 font-size: 12px;
}
#box #denglu #pic {
 background-image: url(images/dot1.gif);
 background-repeat: no-repeat;
 height: 20px;
 width: 100px;
 font-size: 12px;
 color: #F00;
 text-align: left;
 line-height: 18px;
 left: 10px;
 top: 30px;
 position: relative;
}

复制代码
@charset "utf-8";
/* CSS Document */

body {
 background-color: #9CF;
 text-align: left;
}
#denglu {
 width: 400px;
 margin-top: 0px;
 margin-right: auto;
 margin-bottom: 0px;
 margin-left: auto;
 background-image: url(images/login.gif);
 background-repeat: no-repeat;
 height: 320px;
 text-indent: 6px;
}
#box #denglu form {
 position: relative;
 top: 50px;
 left: 10px;
 width: 92%;
}
.must {
 color: #F00;
 font-size: 12px;
}
#box #denglu #pic {
 background-image: url(images/dot1.gif);
 background-repeat: no-repeat;
 height: 20px;
 width: 100px;
 font-size: 12px;
 color: #F00;
 text-align: left;
 line-height: 18px;
 left: 10px;
 top: 30px;
 position: relative;
}

http://www.bkjia.com/PHPjc/631327.htmlwww.bkjia.com
true
http://www.bkjia.com/PHPjc/631327.html
TechArticle一款讲得非常详细的登录代码,对php入门者有很大的帮助,有需要的朋友可以免费查看。 效果图。 index.php教程 代码如下 复制代码 !DOCTYPE...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn