国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > PHP > 正文

php用戶登錄代碼

2024-05-04 23:06:18
字體:
供稿:網(wǎng)友

一款講得非常詳細的登錄代碼,對php入門者有很大的幫助,有需要的朋友可以免費查看,效果圖如下:

 

index.php,代碼如下:

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
  2. <html xmlns="http://www.w3.org/1999/xhtml"
  3. <head> 
  4. <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> 
  5. <title>系統(tǒng)登錄</title> 
  6. <link href="css.css" rel="stylesheet" type="text/css" /> 
  7. </head> 
  8. <body> 
  9. <div id="box"
  10.   <div id="denglu"
  11.   <div id="pic">&nbsp;系統(tǒng)后臺登陸</div> 
  12.     <form action="check.php" method="post"
  13.       <p>用戶名: 
  14.         <input type="text" name="name" id="name" /> 
  15.       <span class="must">*</span></p> 
  16.       <p>密&nbsp;&nbsp;碼: 
  17.         <input name="password" type="password" id="password" /> 
  18.       <span class="must">*</span></p> 
  19.       <p>驗證碼: 
  20.         <input name="check" type="text" id="check" size="8" /> 
  21.         <img src="piccheck.php" /> <span class="must">*</span></p> 
  22.       <p class="form_button"
  23.         <input type="submit" name="sub" id="sub" value="登陸" /> 
  24.         <input type="reset" name="unsub" id="unsub" value="取消" /> 
  25.       </p> 
  26.     </form> 
  27.   </div> 
  28. </div> 
  29. </body> 
  30. </html> 

 

數(shù)據(jù)庫連接connect.php,代碼如下:

  1. <?php 
  2.  $connect=mysql_connect("localhost","root","")or die("服務器連接失敗"); 
  3.  mysql_select_db("test",$connect)or die("沒有建立相應的數(shù)據(jù)庫"); 
  4. $sql="select * from admin"
  5. ?> 

 

圖片驗證碼 piccheck.php,代碼如下:

  1. <?php 
  2. /* 
  3.  * Created on 2011-8-10 
  4.  * 
  5.  * To change the template for this generated file go to 
  6.  * Window - Preferences - PHPeclipse - PHP - Code Templates 
  7.  */ 
  8.  session_start(); 
  9.  $code=rand(0,9).dechex(rand(10,15)).rand(0,9).dechex(rand(10,15)); 
  10.  $_SESSION[pic]=$code
  11.  $image=imagecreatetruecolor(50,18); 
  12.  $color=imagecolorallocate($image,0,0,0);//第一次使用調(diào)色板,會設(shè)為背景顏色 
  13.  $colortext=imagecolorallocate($image,rand(100,255),rand(100,255),rand(100,255)); 
  14.  imagestring($image,10,rand(1,15),rand(1,5),$code,$colortext); 
  15.  imagegif($image); 
  16. ?> 

 

css.css文件,代碼如下:

  1. @charset "utf-8"
  2. /* CSS Document */ 
  3. body { 
  4.  background-color#9CF
  5.  text-alignleft
  6. #denglu { 
  7.  width400px
  8.  margin-top0px
  9.  margin-rightauto
  10.  margin-bottom0px
  11.  margin-leftauto
  12.  background-imageurl(images/login.gif); 
  13.  background-repeatno-repeat
  14.  height320px
  15.  text-indent6px
  16. #box #denglu form { 
  17.  positionrelative
  18.  top: 50px
  19.  left: 10px
  20.  width92%
  21. .must { 
  22.  color#F00
  23.  font-size12px
  24. #box #denglu #pic { 
  25.  background-imageurl(images/dot1.gif); 
  26.  background-repeatno-repeat
  27.  height20px
  28.  width100px
  29.  font-size12px
  30.  color#F00
  31.  text-alignleft
  32.  line-height18px
  33.  left: 10px
  34.  top: 30px
  35.  positionrelative

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 烟台市| 嘉荫县| 罗源县| 普格县| 七台河市| 临邑县| 宜都市| 牡丹江市| 祁阳县| 西青区| 绥化市| 峡江县| 方城县| 宜章县| 和林格尔县| 左云县| 阿拉善右旗| 巩义市| 宁德市| 梨树县| 安龙县| 彭阳县| 广饶县| 白银市| 喜德县| 通州市| 交城县| 太谷县| 昭平县| 六枝特区| 合肥市| 晋江市| 长武县| 龙里县| 申扎县| 汨罗市| 巢湖市| 荔波县| 西盟| 哈尔滨市| 兖州市|