發下我用手機驗證的方法吧。大家一起學些了。My Phone介面用的是移動夢網的,其他的我也試過。都差不多。我的介面檔案放在e/class目錄下面。首先在會員註冊頁面e/template/member/register.php下,在幾個隨機6位元的變數,如果你覺的驗證碼6位不夠,可以修改。$reg=rand(100000,999999);//產生隨機6位元$reg_a=base64_encode($reg);//隨機6位元加密然後在會員註冊表單裡面加入手機號欄位:phome;驗證碼欄位:yzm,將他的value="$reg_a"然後開啟e/class/user.php大概613行左右吧。自己對照著看了在加入//郵箱啟用if($checked==0&&$public_r['regacttype']==1){include('../class/qmemberfun.php');SendActUserEmail($userid,$username,$email);}//審核if($checked==0){$phone=$_POST[phone];$yzm=$_POST[yzm];$CONTENT=base64_decode($yzm);// 夢網簡訊平台include_once('fasong/Client.php');$smsInfo['server_url'] = 'http://ws.montnets.com:9002/MWGate/wmgw.asmx?wsdl';$smsInfo['user_name'] = '夢網使用者名稱';$smsInfo['password'] = '夢網使用者密碼';$smsInfo['pszSubPort'] = '*';$content = "你註冊的某某平台驗證碼為{$CONTENT}";$mobiles = array($phone);$sms = new Client($smsInfo['server_url'],$smsInfo['user_name'],$smsInfo['password']);$sms->pszSubPort = $smsInfo['pszSubPort'];$sms->setOutgoingEncoding("utf-8");$result = $sms->sendSMS($mobiles,$content);$location="/e/member/EditInfo/jihuo.php?yzm=$yzm&phone=$phone";//這個頁面註冊後,跳轉到啟用頁面,需要自己寫。 printerror("RegisterSuccessCheck",$location,1);}紅色部分為驗證頁面,頁面如下/e/member/EditInfo/jihuo.php,這個路徑,這個使用者名稱<?php$url="<a href=../../../>首頁</a> > <a href=../cp/>控制台</a> > 修改資料";require(ECMS_PATH.'/e/data/template/cp_1.php');$phone=$_GET[phone];$yzm=$_GET[yzm];//$reg_b=base64_decode($yzm);//echo $phone;//echo $reg_b;?><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="50" bgcolor="#fff8ed" class="logo_tbs"><div class="logo_listclassname">註冊會員啟用</div></td></tr><tr><td class="logo_tbsxx"><br><table width='80%' border='0' align='center' cellpadding='3' cellspacing='1' bgcolor="#ffd5be" class="tableborder"><form name=useryanzheng method=post action="/e/escape/yanzheng.php"> //這個為驗證手機驗證碼的<input type=hidden name=yzm value=<?=$yzm?> /><input type=hidden name=phone value=<?=$phone?> /><tr><td width="25%" height="25" bgcolor="#FFFFFF">手機驗證碼:</td><td width="45%" height="25" bgcolor="#FFFFFF"><input type="text" name="sryzm" id="sryzm" /></td><td width="35%" bgcolor="#FFFFFF"><input type='submit' name='Submit' value='點擊驗證' /></td></tr></form></table><br></td></tr></table><?phprequire(ECMS_PATH.'/e/data/template/cp_2.php');?>這個頁面代碼如下,路徑什麼的就說了/e/escape/yanzheng.php<?phprequire("../class/connect.php");require("../class/db_sql.php");require("../class/q_functions.php");require("../data/dbcache/class.php");require LoadLang("pub/fun.php");$link=db_connect();$empire=new mysqlquery();$sryzm=$_POST[sryzm];$phone=$_POST[phone];$yzm=$_POST[yzm];$yzm_b=base64_decode($yzm);$sql = $empire->query("select * from fc_enewsmemberadd where phone='{$phone}' and yzm='{$yzm}'");$r=$empire->fetch($sql);$hl_phone=$r[phone];$hl_yzm=$r[yzm];$userid=$r[userid];$updata=$r[updata];//echo $sryzm."<br>".$phone."<br>".$yzm_b."<br>".$hl_phone."<br>";if($phone== $hl_phone && $sryzm==$yzm_b){$sql = $empire->query("update fc_enewsmember set checked=1 where userid='{$userid}'");echo "<script>alert('啟用成功!');window.location.href='/e/member/login/index.php';</script>";}if($phone== $hl_phone && $sryzm!=$yzm_b && $updata<3){$sql = $empire->query("update fc_enewsmemberadd set updata=updata+1 where userid='{$userid}'");$jihui=2-$updata;echo $jihui;echo "<script>alert('手機驗證碼輸入錯誤!您還有{$jihui}次機會。');window.location.href='/e/member/EditInfo/jihuo.php?yzm={$yzm}&phone={$phone}';</script>";echo $updata;}else{echo "<script>alert('您輸入的資訊有誤!');window.location.href='/e/member/register/index.php?groupid=1';</script>";}db_close();$empire=null;?>手機驗證只有三次機會,自己在這個表裡面_enewsmemberadd增加,updata欄位。原文出自:http://blog.sina.com.cn/s/blog_66a0738b01016gwz.html