日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

PHP登陸頁面完整代碼

 quasiceo 2014-05-12

PHP登陸頁面完整代碼

/*

包括的文件

*/

/*

login.php

*/

 

<?php
require('./mysql.php');
$username=$_REQUEST['username'];
$passwd=$_REQUEST['passwd']
session_start();
$_SESSION['s_username']=$username;
$query_user="select * from user where username = '$username' and passwd = '$passwd'";
$db=new mysql();//實(shí)例化類mysql
$result = $db->query_exec($query_user);//驗(yàn)證用戶
$num_results=$result->num_rows;//取得數(shù)據(jù)庫中的記錄行

if($num_results==0)
{
    echo 'login fail!!';
?>
<p><a href="./template/login.htm">返回登陸</a></p>
<?php
}else{
header("Location: ./index.php");
}
?>

/*

templates/login.tpl

*/

<html>
<head>
<meta http-equiv="text/html;charset='utf-8'">
<link  rel="stylesheet" type="text/css" href="./css/login.css">
<script type="text/javascript" src="js/face.js"></script>
</head>
<body>
<table width="400px" height="208" border="0" cellpadding="0" cellspacing="0" >
<form id="login" name="login" method="post" action="a.php" onSubmit="">
  <tr>
    <td height="25"  align="right">用戶名:</td>
    <td><input name="name" type="text" onmouseover="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#e8f4ff'" size="15" /></td>
  </tr>
  <tr>
    <td height="25" align="right">密碼:</td>
    <td><input name="password" type="password" id="password"  onmouseover="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#e8f4ff'" size="15" /></td>
  </tr>
  <tr>
    <td height="25"align="right">驗(yàn)證碼:</td>
    <td><input name="check" type="text" id="check"  onmouseover="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#e8f4ff'" size="10" /><img src="code.php" id="code" /></td>
  </tr>

/*

mysql.php

*/

<?php
    var $db_host    = 'localhost';
    var $db_username= 'root';
    var $db_password= '123';
    var $db_database= 'new';

  
        $db =mysql_connect($ db_host,$db_username,$-> db_password,$-> db_database);
        if (mysqli_connect_errno()) {
            echo "連接數(shù)據(jù)庫失敗!";
            exit;
        }
        return $db;
    }
   
}
?>

/*

效果為*/

posted @ 2012-06-01 11:09 losesea 閱讀(13842) 評(píng)論(3) 編輯 收藏
評(píng)論列表
  
#1樓 2013-02-01 11:30 金英  
您學(xué)過php沒有?php用var定義變量?javascript的語法吧!$-> db_password?這個(gè)你也錯(cuò)了!發(fā)到網(wǎng)上的東西,也得負(fù)責(zé)任吧,OK?
  
#2樓 2013-11-07 10:18 lipisam  
能方便 發(fā)截圖里面的全部文件 給學(xué)習(xí)嗎? 郵箱2450674172@qq.com
  
#3樓 2014-04-13 11:04 頭頭0312  
mysql.php是要寫類嗎?你的類呢?????、class不知道嗎?還用var定義變量,你會(huì)嗎???????

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多