PHP練手:一個小型論壇(帶後臺)

註冊相關函數

$value){
		if (!isset($key) || ($value=='')){
			return false;
		}
		return true;
	}
}

//驗證郵箱是否有效
function verifyemail($email){
	if (@ereg('^[a-zA-Z0-9_\.\-]+@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]+$', $email)){
		return true;
	}else {
		return false;
	}
}

//檢查用戶名是否已經存在
//$connectmysql為伺服器連接對象
function verifyname($username,$connectmysql){
	$sql="select * from db_reglog where username='$username'";
	$res=$connectmysql->getRowsNum($sql);
	if ($res !=''){
		return true;
	}else {
		return false;
	}
	
}

//將註冊信息寫入伺服器
//$connectmysql為伺服器連接對象
function register($name,$passd,$email,$connectmysql){
	$sql="insert into db_reglog values('$name',sha1('$passd'),'$email','')";
	$res=$connectmysql->uidresult($sql);
	if ($res != ''){
		return true;
	}else {
		return false;
	}
	
}

目錄結構



論壇首頁

內容頁vc3Ryb25nPjwvcD4KPHA+PGltZyBzcmM9″/uploadfile/Collfiles/20140415/20140415094305249.jpg” alt=””>

下載地址:https://pan.baidu.com/share/link?shareid=3104998419&uk=1094580398

You May Also Like