php生成会员账号

PHP 投稿 10500 0 评论

php生成会员账号

这篇关于php用户会员系统的文章,主要介绍php生成会员账号,觉得挺不错的,感兴趣的php开发者可以参考下,希望对大家在学习php的成长路上有所帮助!

自己用php写的生成会员账号功能,仅供参考,代码如下:


function get_number($table,$filed){
	if(!isset($table) || !isset($filed)){
		return '';
	}
	if(trim($table)=='' || trim($filed)==''){
		return '';
	}
	global $db;
	$user_number=str_shuffle(substr(randomname(-5),11));
	$sql="select `id` from `".$table."` where `".$filed."`='".$user_number."'";
	if($db->getRowsNum($sql) || strpos($user_number,'0')==0){
		get_number($table,$filed);
	}
	return $user_number;
}

/***********生成随机数[随机数是后五位,一共是19位]****************/
function randomname($start,$len=''){
	if(!isset($start) || !is_numeric($start) || ($len!='' && !is_numeric($len))){
		return '';
	}echo '-----';
	$seedstr=explode(' ',microtime(),5); 
	$seed=$seedstr[0]*10000; 
	$random=date('YmdHis', time()).rand(10000,100000);
	return $len===''?substr($random,$start):substr($random,$start,$len);
}

总结

以上就是关于php用户会员系统全部内容,希望这篇php生成会员账号文章能够帮你解决如相关的PHP问题,更多请关注PHP栏目的其它相关文章!

编程笔记 » php生成会员账号

赞同 (53) or 分享 (0)
游客 发表我的评论   换个身份
取消评论

表情
(0)个小伙伴在吐槽