数据被截获是无法避免的,除非用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>
效果图: