數據被截獲是無法避免的,除非用SSL加密。
比較安全的方法可以這樣:
1. 數據正常提交至lr.php
2. 獲取一個當前時間time()
3. 將密碼組合time()後md5
4. 將組合後的密碼md5值和之前獲取的time()一起存入資料庫。
當今後需要登錄時首先獲取用戶名對應的time(),再組合上密碼進行md5,和資料庫內的密碼md5對比。
B. php 成功邀請好友注冊,邀請人跟被邀請人都有金幣 功能實現
注冊頁的表單中加個隱藏域
<inputtype="hidden"name="uid"value="<?phpecho$_GET['uid']?intval($_GET['uid']):'';?>">
我們注冊了會員會有個會員id值,利用這個id值來傳值
比如我的注冊頁面時register.php
邀請好友注冊時我們可以生成一個URL 比如 /register.php?uid=123
uid=123 這個是邀請人的id值
當被邀請人點擊這個鏈接時,表單中的隱藏域name="uid" 則有值,我們注冊POST提交給後台處理,
後台判斷$_POST['uid']是為空,不為空則是邀請,
注冊成功,然後給雙方寫Sql語句更新 金幣值
望採納Thx
C. 如何用php做出登陸注冊留言板
用php做出登陸注冊留言板:
<form id="form1" name="form1" method="post" action="<?php echo site_url()."/publish/user_message"?>">
<textarea rows="5" cols="50" name="huifu" <?php if($uere_name == "0"){echo "disabled";}?> >
<?php
if($uere_name == "0")
{echo "抱歉你還沒登錄不能進行留言";}
?>
</textarea>
<input class="wole" name="author" value="<?php echo $author;?>" /><!--接受方帖子作者-->
<input class="wole" name="news_id" value="<?php echo $news_idx;?>" /><!--文章id-->
<input type="submit" name="Submit"/>
</form>
<script language="javascript">
function updateinfo(){
if(<?php echo $uere_name;?> == 1){
document.form1.Submit.value = "留言";
document.form1.Submit.disabled = false;
}
else{
document.form1.Submit.value = "還未登錄";
document.form1.Submit.disabled = "disabled";
}
}
updateinfo();
</script>
回復帖子:
<p>這里是<?php echo $is;?>樓 用戶:<?php echo $sel->receiver_author;?> <br />留言內容:<?php echo $sel->content?>
<a onClick="showdiv('contentid<?php echo $is;?>','showtext<?php echo $is;?>')" href="javascript:void(0)">回復</a>
<div id="contentid<?php echo $is;?>" class="none">
<?php
$query = $this->db->query("select * from message where son_id ='$sel->id' order by id");//獲取指定父id的子回復
$revis = $query->result();
foreach($revis as $row){?>
<p><?php if($row->sender_author == $row->receiver_author){echo $row->sender_author;}
else{ echo $row->sender_author."回復了:".$row->receiver_author;}?>
內容是:<?php echo $row->content?></p>
<?php }?>
<form action="<?php echo site_url()."/publish/son_message"?>" method="post">
<input name="son_idx" class="wole" value="<?php echo $sel->id?>" />
<input name="receiver_author" class="wole" value="<?php echo $sel->receiver_author;?>" />
<input class="wole" name="news_id" value="<?php echo $news_idx;?>" /><!--文章id-->
<textarea rows="5" cols="50" name="huifux"></textarea>
<br><input type="submit" name="sub" value="回復"></form></div></p>
<script language="JavaScript" type="text/JavaScript">
<!--
function showdiv(targetid,objN){
var target=document.getElementById(targetid);
var clicktext=document.getElementById(objN)
if (target.style.display=="block"){
target.style.display="none";
clicktext.innerText="回復";
} else {
target.style.display="block";
clicktext.innerText='收起';
}
}
-->
</script>
效果圖: