Phone number attribution query and name PHP reads the phone number from the database and generates a picture

Source: Internet
Author: User
Here's the code:

Copy the Code code 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-bit digital picture
Header ("Content-type:image/png"); Tell the browser that the following data is a picture, not a text display
Define Picture Width height
$nwidth = 120;
$nheight = 25;
$im = @imagecreate ($nwidth, $nheight) or Die ("Can ' t initialize new GD image stream"); Creating images
Picture color settings
$background _color=imagecolorallocate ($im, 255,255,255); Match color
$text _color=imagecolorallocate ($im, 23,14,91);
Draw a picture border
Imagefilledrectangle ($im, 0,0, $nwidth-1, $nheight-1, $background); Rectangle Area Coloring
Imagerectangle ($im, 0,0, $nwidth-1, $nheight-1, $background _color); Draw a rectangle
Srand (Double) microtime () *1000000); Gets the current time of one out of 10,000 seconds value to execute when the random number of one out of 10,000 seconds seeds
$randval =rand ();
$randval = $p; 5-digit number
Imagestring ($im, 8,10,2, $randval, $text _color); Draw a cross-string
Adding 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); Creating PNG patterns
Imagedestroy ($im); End chart Type
}else{
echo "The merchant did not enter a phone number";
}
?>

The above describes the phone number of the attribution of the query and the name of PHP to read the database phone number and generate images, including the phone number attribution to the query and the name of the content, I hope that the PHP tutorial interested friends have helped.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.