小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

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();//實例化類mysql
$result = $db->query_exec($query_user);//驗證用戶
$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">驗證碼:</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) 評論(3) 編輯 收藏
評論列表
  
#1樓 2013-02-01 11:30 金英  
您學(xué)過php沒有?php用var定義變量?javascript的語法吧!$-> db_password?這個你也錯了!發(fā)到網(wǎng)上的東西,也得負責(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定義變量,你會嗎???????

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

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多