Advertising
- PDO signature
- Friday, May 18th, 2012 at 10:07:29am MDT
- <?php
- //error_reporting(0);//Un-comment when you have no errors or done debugging
- //PDO mysql connection initialization
- $pdo = new PDO('mysql:host=hostname;dbname=somedb','username','password');
- //Lets check if we have a name set
- print "No users found";
- }
- else{
- // XSS clean up
- $result = $pdo->prepare("SELECT * FROM yourtable WHERE username = :name LIMIT 1");//lets prepare the query
- $result->bindParam(':name', $var); //Lets binds the parameter
- $result->execute();//Lets push the query forward to MySQL server
- if($result->fetchColumn() > 0)//Lets check row here!
- {
- $text = imagecolorallocate($image, 255,255,255); //Lets set text color here and share the code with image parsed.
- $font = 'linktoyourfont.ttf';//Linux accepts only .ttf format.
- imagettftext($image, 12, 0, X co - ordinate, Y co - ordinate, $text, $font, $yourfetchedparameterfromserver);
- /* after adding all the parameters you want here :)*/
- imagepng($im); // Lets create the image from memory
- imagedestroy($im);// Lets display the image and destroy it from memory so it serves live.
- }
- else{
- print "Error!";
- }
- }
- ?>
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.