相關(guān)關(guān)鍵詞
關(guān)于我們
最新文章
- PHP中opcode緩存簡單用法分析
- thinkPHP控制器變量在模板中的顯示方法示例
- PHP move_uploaded_file() 函數(shù)(將上傳的文件移動(dòng)到新位置)
- dirname(__FILE__)的含義和應(yīng)用說明
- thinkPHP5框架實(shí)現(xiàn)分頁查詢功能的方法示例
- PHP中單雙號與變量
- PHP獲得當(dāng)日零點(diǎn)時(shí)間戳的方法分析
- Laravel ORM對Model::find方法進(jìn)行緩存示例詳解
- PHP讀寫文件高并發(fā)處理操作實(shí)例詳解
- 【CLI】利用Curl下載文件實(shí)時(shí)進(jìn)度條顯示的實(shí)現(xiàn)
php+mysql實(shí)現(xiàn)簡單登錄注冊修改密碼網(wǎng)頁
對于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>