用php写的一个登陆页如何实现???请各位高人指点!!!

解决方案 »

  1.   

    想学php,可自己又苦于自学,需要指导的速速加QQ群,85140816 该群刚刚开放,现在面向全国免费教php,从零开始到能让你完整开发一个php项目!! 最重要的是所有课程免费!!!!赶快报名参加吧 机不可失 时不再来!!!  85140816 
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    <!--
    .STYLE1 {font-size: 16px}
    .STYLE2 {font-size: 18px; }
    -->
    </style>
    </head>
    <script language="javascript">
    function check(){
    if (form1.username.value == ""){
    alert('用户名不能为空');
    form1.username.focus();
    return false;
    }
    else if(form1.password.value == ""){
    alert('密码不能为空!');
    form1.password.focus();
    return false;
    } }

    </script>
    <body>
    <form id="form1" name="form1" method="post" action="ChkLogin.php" onsubmit="return check()">
      <p>&nbsp;</p>
      <p align="center" class="STYLE2">用户登录</p>
      <p align="center">用户名:<input type="text" name="username" value="" /></p>
      <p align="center">&nbsp;密  码:
      <input type="text" name="password" value="" /></p>
      <p align="center"> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="submit" name="button1" value="登录" />&nbsp;&nbsp;
      <input type="reset" name="reset1" value="取消" />
      </p>
    </form></body>
    </html>
    自己在连个数据库就行了,不过我的没有用MD5加密。
      

  3.   

    判断的
    <?php
    //获得提交的用户名和密码;
    $name = $_POST['username'];
    $pword = $_POST['password'];

    //进行数据链接,查询;
    $conn = mysql_connect("localhost:3306","root","123") or die ("无法连接数据库".mysql_error());
    mysql_select_db("study",$conn)or die("无法选择数据库".mysql_error());

    $sql1 = "select * from userinfo where username = '$name' and password = '$pword'";
    $result = mysql_query($sql1,$conn);

    $num = mysql_num_rows($result);

    if ($num > 0){

    header("Location:bbspage.php");
    }
    else{
    echo "用户名或者密码出错!";

    }
    mysql_close();
    ?>写的简单,别见笑
      

  4.   

    简单的一个登陆<?php
    if(isset($_POST['submit'])){
        session_start();
        mysql_connect("localhost","root","");
        mysql_select_db("php");
        mysql_query("set names utf8");
        $uname = $_POST[uname];
        $pwd = $_POST[pwd];
        $uname = trim($uname);
        $sql = "select * from user where username='$uname' and password='$pwd'";
        $result = mysql_query($sql);    $row = mysql_fetch_array($result);
        if ($row) {      echo '登陆成功';
        }
        else
            echo "用户名或密码错误";
    }?>
    <html>
    <form  method="POST">
    用户名:<input type="text" name="uname"><br>
    密  码:<input type="password" name="pwd"><br>
    <input type="submit" value="登陆" name="submit"></form>
    </html>