先會(huì)寫(xiě)html的表單
建網(wǎng)站原本是網(wǎng)站策劃師、網(wǎng)絡(luò)程序員、網(wǎng)頁(yè)設(shè)計(jì)師等,應(yīng)用各種網(wǎng)絡(luò)程序開(kāi)發(fā)技術(shù)和網(wǎng)頁(yè)設(shè)計(jì)技術(shù)配合操作的協(xié)同工作。創(chuàng)新互聯(lián)專業(yè)提供成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作,網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站制作(企業(yè)站、成都響應(yīng)式網(wǎng)站建設(shè)公司、電商門(mén)戶網(wǎng)站)等服務(wù),從網(wǎng)站深度策劃、搜索引擎友好度優(yōu)化到用戶體驗(yàn)的提升,我們力求做到極致!
然后會(huì)寫(xiě)php接收表單。
然后會(huì)連接數(shù)據(jù)庫(kù),查找數(shù)據(jù)庫(kù)對(duì)應(yīng)字段。
判斷下
匹配跳轉(zhuǎn)到相應(yīng)頁(yè)面,或者記錄session等。
在php文件中嵌入html代碼(包含表單,做好表單驗(yàn)證),提交到一個(gè)表單處理文件(php文件),處理文件里查詢數(shù)據(jù)庫(kù),和用戶提交的用戶名,密碼匹配,異常則登錄失敗,正常則登錄成功,跳轉(zhuǎn)頁(yè)面(重定向或轉(zhuǎn)發(fā))。注冊(cè)同理做好html頁(yè)面,提交到注冊(cè)處理頁(yè),先校驗(yàn)數(shù)據(jù)庫(kù)是否存在用戶名,有則返回注冊(cè)頁(yè),提示注冊(cè)失敗,無(wú)則在數(shù)據(jù)庫(kù)插入用戶注冊(cè)表單的信息。
要是說(shuō)教程,沒(méi)有哪個(gè)教程是指定講哪個(gè)問(wèn)題的,這里面涉及的知識(shí),易語(yǔ)言操作mysql或post或網(wǎng)頁(yè)填表。教程都很好找。為什么說(shuō)或,因?yàn)槌S么蟾啪瓦@三種方法。
直接操作數(shù)據(jù)庫(kù),易語(yǔ)言直接鏈接網(wǎng)站的數(shù)據(jù)庫(kù),可以不通過(guò)php來(lái)操作,直接把要注冊(cè)的帳號(hào)寫(xiě)進(jìn)數(shù)據(jù)庫(kù),這是最直接的方法。
post,首先用httpwatch或其他抓包工具,抓取注冊(cè)時(shí)的數(shù)據(jù)包,然后用易語(yǔ)言(精益模塊)網(wǎng)頁(yè)_訪問(wèn)這個(gè)方法來(lái)進(jìn)行自制數(shù)據(jù)包提交。來(lái)完成注冊(cè)。
網(wǎng)頁(yè)填表,屬于在超文本瀏覽框內(nèi)打開(kāi)網(wǎng)站注冊(cè)頁(yè)面,然后模擬手動(dòng)來(lái)填寫(xiě)注冊(cè)信息。
建議使用的方法是post,因?yàn)橹苯硬僮鲾?shù)據(jù)庫(kù)安全性不高,網(wǎng)頁(yè)填表每次都要打開(kāi)一次注冊(cè)頁(yè)面,效率不高,建議使用post方法。post視頻教程可以找 之乎者也的post教程,關(guān)于post的教程有很多
登錄頁(yè):login.php
?php
include("conn.php");
$username=$_POST['name'];
$password=$_POST['password'];
$yanzheng=$_POST['yanzheng'];
if(isset($_POST['submit']))
{
$sql=("select username,password from member where username='$username' and password='$password'") or die("sql語(yǔ)句執(zhí)行失敗");
//print_r($sql);
$ar=mysql_query($sql);
if($ar)
{
if($row=mysql_fetch_array($ar))
{
session_start();
if($_POST["yanzheng"])
{
if($yanzheng!=$_session[pic]||$yanzheng=="")
{
echo "驗(yàn)證碼輸入有誤";
exit;
}
if($yanzheng==$_session[pic])
{
header("location:index.php");
}
}
}
else
{
echo "用戶名或密碼錯(cuò)誤";
}
}
}
?
form action="login.php" method="post"
table border=1 align=center width=500 height=300 bgColor=#DFFFDF bordercolor=#fffbec
tr
td colspan=2 align=center用戶登錄/td
/tr
tr
td用戶姓名:/td
tdinput type="text" name="name" id="name"http://td
/tr
tr
td用戶密碼:/td
tdinput type="password" name="password" id="password"http://td
/tr
tr
td驗(yàn)證碼:/td
tdinput type="text" name="yanzheng" id="yanzheng"/
img src="yanzheng1.php" width="50" height="30"/img
/td
/tr
tr
td colspan=3 align=center
input type="submit" name="submit" value="登錄"/
input type="reset" name="reset" value="重置"/
a href="register.php"注冊(cè)/a
/td
/tr
/table
/form
注冊(cè)頁(yè):register.php
?php
include("conn.php");
if(isset($_POST['submit'])$_POST['submit']) {
if($_POST['username']=='')
{
echo "用戶名不能為空";
exit();
}
if($_POST['password']=='')
{
echo "密碼不能為空";
exit();
}
if($_POST['realpass']!=$_POST['password'])
{
echo "兩次密碼輸入不一致";
exit();
}
$sql="insert into member(username,real_name,password,email,headimg) values('$_POST[username]','$_POST[username]','$_POST[password]','$_POST[email]','')";
$ar=mysql_query($sql);
if($ar)
{
header("location:index.php");
}
else
{
echo mysql_error();
}
}
?
body
form action="register.php" method="post"
table border=1 align=center width=500
tr
td height=40 bgColor=#DFFFDF colspan=2會(huì)員注冊(cè) [a href="login.php"返回登錄頁(yè)/a]/td
/tr
tr
td height=40 bgColor=#fffbec 會(huì)員ID/td
tdinput type="text" name="username" id="username"http://td
/tr
tr
td height=40 bgColor=#fffbec密碼/td
tdinput type="password" name="password" id="password"http://td
/tr
tr
td height=40 bgColor=#fffbec確認(rèn)密碼/td
td
input type="password" name="realpass" id="realpass"/
/td
/tr
tr
td height=40 bgColor=#fffbecEMAIL/td
tdinput type="text" name="email" id="email"/
/tr
tr
td height=40 bgColor=#fffbec/td
tdinput type="submit" name="submit" value="注冊(cè)"/input type="reset" value="重置"/td
/tr
/table
/form
/body
主頁(yè)顯示:index.php
?php
include("conn.php");
function cutstr($str,$cutleng)
{
$str = $str; //要截取的字符串
$cutleng = $cutleng; //要截取的長(zhǎng)度
$strleng = strlen($str); //字符串長(zhǎng)度
if($cutleng$strleng)return $str;//字符串長(zhǎng)度小于規(guī)定字?jǐn)?shù)時(shí),返回字符串本身
$notchinanum = 0; //初始不是漢字的字符數(shù)
for($i=0;$i$cutleng;$i++)
{
if(ord(substr($str,$i,1))=128)
{
$notchinanum++;
}
}
if(($cutleng%2==1)($notchinanum%2==0)) //如果要截取奇數(shù)個(gè)字符,所要截取長(zhǎng)度范圍內(nèi)的字符必須含奇數(shù)個(gè)非漢字,否則截取的長(zhǎng)度加一
{
$cutleng++;
}
if(($cutleng%2==0)($notchinanum%2==1)) //如果要截取偶數(shù)個(gè)字符,所要截取長(zhǎng)度范圍內(nèi)的字符必須含偶數(shù)個(gè)非漢字,否則截取的長(zhǎng)度加一
{
$cutleng++;
}
return substr($str,0,$cutleng);
}
?
html
head
script type="text/javascript"
function All(e, itemName)
{
var aa = document.getElementsByName(itemName);
for (var i=0; iaa.length; i++)
aa[i].checked = e.checked; //得到那個(gè)總控的復(fù)選框的選中狀態(tài)
}
function Item(e, allName)
{
var all = document.getElementsByName(allName)[0];
if(!e.checked) all.checked = false;
else
{
var aa = document.getElementsByName(e.name);
for (var i=0; iaa.length; i++)
if(!aa[i].checked) return;
all.checked = true;
}
}
/script
/head
?php
include("conn.php");
if(isset($_POST['del']))
{
$mm = $_POST["selected"];
$id =implode(",",$mm);
$sql = "delete from forums where id in(".$id.")";
//echo $sql;
$result=mysql_query($sql);
echo $result?"刪除成功":"刪除失敗";
}
?
table style="BORDER-BOTTOM-WIDTH: 1px; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=600 align=center border=1 bordercolor=#ddddff
tr align=middle
td height=40 bgColor=#DFFFDF colspan=3論壇列表/td
/tr
tr
td colspan=3a href="login.php" style="float:right"[退出系統(tǒng)]/aa href="add_forum.php" style="float:right"[添加論壇]/a/td
td/td
/tr
tr align=middle
td height=40 bgColor=#DFFFDF width=80狀態(tài)/td
td height=40 bgColor=#DFFFDF論壇/td
td height=40 bgColor=#DFFFDF最后更新/td
/tr
?php
$sql="select * from forums";
$result=mysql_query($sql);
$num=mysql_num_rows($result);
if($num0)
{
while($row=mysql_fetch_array($result)){
?
tr align=middle
td bgColor=#fffbecinput type="checkbox" name="selected" value="1"http://td
td height=50 bgColor=#fffbec width=300
?php
echo "diva href=\"forums.php?F=".$row['ID']."\"".$row['forum_name']."/a/div";
echo cutstr($row['forum_description'],24);//最多顯示24個(gè)字節(jié),12個(gè)字,多余部分用省略號(hào)代替
echo "……";
?
/td
td height=50 bgColor=#fffbecdiv?php echo $row['last_post_time']."by".$row['last_post_author']?/div/td
/tr
?php
}
}
else
{
echo "tr bgColor=#fffbectd colspan=3對(duì)不起,論壇尚在創(chuàng)建中……/td/tr";
}
?
tr
td colspan=3 input type="checkbox" name="selected" value="1" onclick="All(this,'selected')"/全選/不全選/td
/tr
tr
tdinput type="button" name="del" id="del" value="刪除選中項(xiàng)"/
?php
?
/td
/tr
/table
/html
數(shù)據(jù)庫(kù)你就自己建,望采納~