利用PHP串連資料庫操作使用者註冊、審核與登入頁面

來源:互聯網
上載者:User

標籤:註冊登入   padding   .class   串連   get   登入   uid   cti   處理   

註冊頁面

<body >
<h1>註冊頁面</h1>
<form action="zhucechuli.php" method="post">
<div>使用者名稱:<input type="text" name="uid"/> </div>
<div>密碼:<input type="text" name="pwd"/> </div>
<div>姓名:<input type="text" name="name"/> </div>
<div>性別:<input type="text" name="sex"> </div>
<div>生日:<input type="text" name="birthday"> </div>
<input type="submit" value="註冊"/>
</form>
</body>

註冊處理頁面

<?php
$uid = $_POST["uid"];
$pwd = $_POST["pwd"];
$name = $_POST["name"];
$sex = $_POST["sex"];
$birthday = $_POST["birthday"];
 
include ("LZY.class.php");
$db = new LZY();
$sql = "insert into zhuce VALUES (‘{$uid}‘,‘{$pwd}‘,‘{$name}‘,‘{$sex}‘,‘{$birthday}‘,0)";
 
if($db->query($sql,0))
{
    header("location:zhuceyemiandenglu.php");
}
else
{
    echo "註冊失敗!";
}

登入頁面

<body>
<h1>頁面登入</h1>
<form action="zcdlchuli.php" method="post">
    <div>使用者名稱:<input type="text" name="uid"/> </div>
    <div>密  碼:<input type="password" name="pwd"/></div>
    <div><input type="submit" value="登入"/> </div>
</form>
</body>

註冊登入處理頁面

<?php
$uid = $_POST["uid"];
$pwd = $_POST["pwd"];
include ("LZY.class.php");
$db = new LZY();
 
 
 
$sql = "select * from zhuce where uid=‘{$uid}‘";
$arr = $db->Query($sql);
 
if($arr[0][1] == $pwd && !empty($pwd))
{
    if($arr[0][5])
    {
        header("location:zcmain.php");
    }
    else
    {
        echo "該使用者尚未通過審核!";
    }
}
else
{
    echo "登入失敗!";
}

註冊主介面

<body>
 
<h1>使用者審核</h1>
 
<table width="100%" border="1" cellpadding="0" cellspacing="0">
 
    <tr>
        <td>使用者名稱</td>
        <td>姓名</td>
        <td>性別</td>
        <td>生日</td>
        <td>操作</td>
    </tr>
 
    <?php
    include("LZY.class.php");
    $db = new LZY();
 
    $sql = "select * from zhuce";
    $arr = $db->Query($sql);
 
    foreach($arr as $v)
    {
        $str = $v[5]?"<span style=‘background-color:green‘>已通過</span>":"<a href=‘zctongguo.php?uid={$v[0]}‘>通過</a>";
 
        echo "<tr>
        <td>{$v[0]}</td>
        <td>{$v[2]}</td>
        <td>{$v[3]}</td>
        <td>{$v[4]}</td>
        <td>{$str}</td>
    </tr>";
    }
 
    ?>
 
</table>
 
</body>
</html>

審核通過代碼

<?php
$uid = $_GET["uid"];
include("LZY.class.php");
$db = new LZY();
 
$sql = "update zhuce set isok=1 where uid=‘{$uid}‘";
if($db->Query($sql,0))
{
    header("location:zcmain.php");
}
else
{
    echo "通過失敗!";
}

利用PHP串連資料庫操作使用者註冊、審核與登入頁面

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.