Home > Backend Development > PHP Tutorial > Phone number location query and name php reads the phone number in the database and generates a picture

Phone number location query and name php reads the phone number in the database and generates a picture

WBOY
Release: 2016-07-29 08:38:44
Original
3168 people have browsed it

The following is the code:

Copy the code The code is as follows:


$id=$_GET[id];
include("admin/config.php") ;
$sql="select * from user where id=$id";
$data=mysql_fetch_array(mysql_query($sql));
$p=SBC_DBC($data[Phone],1);
function get_str($ str,$strlen=16) {
$str=stripslashes($str);
for($i=0;$i<$strlen;$i++)
if(ord(substr($str,$i,1) )>0xa0) $j++;
if($j%2!=0) $strlen++;
$tmp_str=substr($str,0,$strlen);
return $tmp_str;
}
if($p< >''){
//Generate a 5-digit digital image
Header("Content-type:image/png"); //Tell the browser that the following data is an image instead of displaying it as text
//Definition Image width and height
$nwidth=120;
$nheight=25;
$im=@imagecreate($nwidth,$nheight) or die("Can't initialize new GD image stream"); ​​//Create image
/ /Image color setting
$background_color=imagecolorallocate($im,255,255,255); //Matching color
$text_color=imagecolorallocate($im,23,14,91);
//Draw the image border
imagefilledrectangle($im,0, 0,$nwidth-1,$nheight-1,$background); //Rectangular area coloring
imagerectangle($im,0,0,$nwidth-1,$nheight-1,$background_color); //Draw a rectangle
//srand((double)microtime()*1000000); //Get the millionth of a second value of the current time, and use the millionth of a second at execution time as the random number seed
//$randval=rand() ;
$randval=$p; //5-digit
imagestring($im,8,10,2,$randval,$text_color); //Draw a horizontal string
//Add interference factors
//for( $i=0;$i<478;$i++)
//{
//$randcolor=imagecolorallocate($im,rand(0,255),rand(0,255),rand(0,255));
//imagesetpixel($ im,rand()%100,rand()%30,$randcolor); //Point
//}
//imagestring($im,3,5,5,"A Simple Text String",$text_color);
//imageinterlace($im,1);
imagepng($im); //Create png graphic
imagedestroy($im); //End graphic
}else{
echo " The merchant did not enter a phone number";
}
?>

The above introduces the phone number location query and name. PHP reads the phone number in the database and generates a picture, including the phone number location query and name. I hope it will be helpful to friends who are interested in PHP tutorials.

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template