新聞中心
MySql和PHP實(shí)現(xiàn)用戶注冊(cè),數(shù)據(jù)庫(kù):reunion 表:accounts 字段:username,password,email,
用IF做判斷。然后獲取數(shù)據(jù)庫(kù)的比對(duì)值!這個(gè)沒(méi)檢查也沒(méi)測(cè)試。倉(cāng)促寫(xiě)的。若你有寫(xiě)SESSION,讓用戶注冊(cè)后登陸!

我們提供的服務(wù)有:成都網(wǎng)站制作、做網(wǎng)站、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、盤(pán)山ssl等。為超過(guò)千家企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的盤(pán)山網(wǎng)站制作公司
例子:
?php
SESSION_START();
if(!empty($_POST['user']) !empty($_POST['pass'])){
$user = $_POST['user'];
$pass = $_POST['pass'];
$email = $_POST['email'];
$level = $_POST['level'];
$realname = $_POST['realname'];
$mysql = "select * from `accounts` where `username`='$user'";
$query = mysql_query($username);
$num = mysql_num_rows($query);
if($num1){
$mysql_xr = "inser into`accounts`(`id`,`username`,`password`,`email`,`level`,`realname`)values('','$user','$pass','$email','level','realname')";
mysql_query($mysql_xr);
echo "scriptalert('恭喜您注冊(cè)成功!');window.location.href='這個(gè)可以寫(xiě)你要跳轉(zhuǎn)到得頁(yè)面.php'/script";
}else{
echo "scriptalert('注冊(cè)失敗,您提交的用戶名已存在!')/script";
}
}
?
php無(wú)需mysql數(shù)據(jù)庫(kù)支持,能夠?qū)崿F(xiàn)簡(jiǎn)單的用戶注冊(cè)
php無(wú)需mysql數(shù)據(jù)庫(kù)支持,能夠?qū)崿F(xiàn)簡(jiǎn)單的用戶注冊(cè)
注冊(cè)頁(yè)面:reg.html
form action="reg.php" method="POST"
table
trtd用戶名:/tdtdinput type="username" size="20"/td/tr
trtd密碼:/tdtdinput type="userpass" size="20"/td/tr
trtd確認(rèn)密碼:/tdtdinput type="ruserpass" size="20"/td/tr
trtd郵箱:/tdtdinput type="email" size="50"/td/tr
trtd電話:/tdtdinput type="telphone" size="20"/td/tr
trtdinput type="Submit" value="注冊(cè)"/td/tr
/table
/form
接收頁(yè)面:reg.php
%php
$db = mysql_connect("localhost", "root", "12345");
mysql_select_db("dataname", $db);
mysql_query("insert into tablename(username, userpass, email, telphone) values('$_POST[username]', '$_POST[userpass]', '$_POST[email]', '$_POST[telphone]')");
echo "注冊(cè)成功";
%
易語(yǔ)言+PHP+數(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的教程有很多
PHP如何寫(xiě)入數(shù)據(jù)庫(kù)實(shí)現(xiàn)注冊(cè)??
連接:mysql_connect("主機(jī)","用戶","密碼");
mysql_select_db("數(shù)據(jù)庫(kù)名");
寫(xiě)入數(shù)據(jù):mysql_query("insert
into
表名
(字段1,字段2)
values
("數(shù)據(jù)1","數(shù)據(jù)2")");
php+mysql怎么做登錄注冊(cè)
首先得到提交的數(shù)據(jù)
鏈接數(shù)據(jù)庫(kù),查詢數(shù)據(jù)庫(kù),查詢username 和pwd
提交的username 和 pwd? 跟數(shù)據(jù)庫(kù)查詢的username 和pwd做對(duì)比,
都相等那就是登陸成功
?php
mysql_connect('localhost','root','123');
mysql_select_db('lx');
mysql_query("SET?CHARACTER?SET?utf8");
mysql_query("SET?NAMES?utf8");
//數(shù)據(jù)庫(kù)lx?表user??字段id?username??pwd
//用md5加密,可以自己試試????
if(isset($_POST['user'])$_POST['tijiao']?==?'success'){
$query?=?mysql_query("select?pwd?from?user?where?username?=?'".$_POST['user']."'");
$num?=?mysql_num_rows($query);
if($num??0?){
while($info?=?mysql_fetch_array($query)){
if($info['pwd']?==?md5($_POST['pwd'])){
echo?'登陸成功';
}else{
echo?'登陸失敗';????
}
}
}else{
echo?'登陸失敗';
}
}
?
form?action=""?method="get"/
table?border="0"?cellspacing="0"?cellpadding="0"?
tr
td?class="fieldKey"?width="30%"用戶名:/td
td?class="fieldValue"?width="100%"input?type="text"?name="user"?//td
/tr
trtd?height="10"/td/tr
tr
td?class="fieldKey"密碼:/td
td?class="fieldValue"input?type="password"?name="pwd"?//td
/tr
/table
input?type="hidden"?name="tijiao"?value="success"?/
input?type="submit"?value="登陸"/
/form
分享名稱(chēng):php數(shù)據(jù)庫(kù)實(shí)現(xiàn)注冊(cè)用戶 php和mysql實(shí)現(xiàn)注冊(cè)
URL地址:http://www.dlmjj.cn/article/doodgcc.html


咨詢
建站咨詢
