Home >Backend Development >PHP Tutorial >Generate member account in php_PHP tutorial

Generate member account in php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:30:561240browse

The function of generating member accounts written by myself in PHP is for reference only. The code is as follows:

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);
}

Articles you may be interested in

  • php program to generate histogram (statistical chart)
  • Use curl's post method and get method to submit data in php respectively Summary of methods for obtaining web page data
  • The idea and implementation method of PHP generating short URLs
  • PHP generating dynamic verification code images (gif)
  • PHP generating continuous numbers (letters) Array function range() analysis, PHP lottery program function
  • Summary of methods for generating QR codes in PHP
  • Several methods of PHP generating random numbers
  • PHP generating verification code function

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764176.htmlTechArticleThe function of generating member accounts written by myself in PHP is for reference only. The code is as follows: function get_number($table,$ filed){if(!isset($table) || !isset($filed)){return '';}if(trim($table)=='' |...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn