国产精品成人VA在线观看,亚洲日韩在线中文字幕综合,亚洲AV电影天堂男人的天堂,久久人人爽人人爽人人av东京热

News新聞

業(yè)界新聞動(dòng)態(tài)、技術(shù)前沿
Who are we?

您的位置:首頁      樂道系統(tǒng)FAQ      php+mysql實(shí)現(xiàn)簡單登錄注冊修改密碼網(wǎng)頁

php+mysql實(shí)現(xiàn)簡單登錄注冊修改密碼網(wǎng)頁

標(biāo)簽: 發(fā)布日期:2016-11-30 00:00:00 388

對于php和mysql的連接在許多blog上都有說明,為了將mysql中的查詢,修改,插入等操作掌握,本文介紹了一下如何采用mysql做一個(gè)登錄注冊修改密碼的網(wǎng)頁。

其中,如下

1.登錄-即為對數(shù)據(jù)庫中的內(nèi)容給予查詢,并驗(yàn)證html中的信息與數(shù)據(jù)庫是否匹配;
2.注冊-即為對數(shù)據(jù)庫中的內(nèi)容進(jìn)行插入,注冊帳號與密碼;
3.修改密碼-即為對數(shù)據(jù)庫中的內(nèi)容進(jìn)行修改。

這三個(gè)操作,我用了8個(gè)php和html文本來建立 具體見代碼部分
1.登錄的主界面index.html:

<p> 
  </p><pre name="code" class="html"> 
<!DOCTYPE html> 
<html> 
<head> 
<meta charset="UTF-8"> 
<title>登錄注冊修改密碼系統(tǒng)主頁</title> 
<style type="text/css"> 
form { 
  text-align: center; 
} 
</style> 
</head> 
<body> 
  <form action="enter.php" method="post" onsubmit="return enter()"> 
    用戶名<input type="text" name="username" id="username"><br> 密碼<input 
      type="password" name="password" id="password"><br> <input 
      type="submit" value="登錄">  <input type="button" 
      value="注冊" onclick="register();"> 
 
  </form> 
 
  <script type="text/javascript"> 
    function enter() 
    { 
      var username=document.getElementById("username").value;//獲取form中的用戶名 
      var password=document.getElementById("password").value; 
      var regex=/^[/s]+$/;//聲明一個(gè)判斷用戶名前后是否有空格的正則表達(dá)式 
      if(regex.test(username)||username.length==0)//判定用戶名的是否前后有空格或者用戶名是否為空 
        { 
          alert("用戶名格式不對"); 
          return false; 
        } 
      if(regex.test(password)||password.length==0)//同上述內(nèi)容 
      { 
        alert("密碼格式不對"); 
        return false; 
      } 
      return true; 
    } 
    function register() 
    { 
      window.location.href="register.html";//跳轉(zhuǎn)到注冊頁面 
    } 
  </script> 
</body> 
</html>