This simple source to create image validator function :
function generate_image_validator(){
global $app;
// Create an image where width=155 pixels and height=35 pixels
$val_img = imagecreate(155, 35);
// Allocate 2 colors to the image
$color1 = imagecolorallocate($val_img, 46,60,31);
$color2 = imagecolorallocate($val_img, 238,239,239);
// Create a seed to generate a random number
srand((double)microtime()*1000000);
// Run the random number seed through the MD5 function
$seed_string = md5(rand(0,9999));
// Chop the random string down to 5 characters
// This is the validation code we will use
$val_string = substr($seed_string, 17, 5);
// Set the background of the image to color2
imagefill($val_img, 0, 0, $color2);
// Print the validation code on the image in color1
imagestring($val_img, 4, 75, 10, $val_string, $color1);
// Write the image file to the current directory
imagejpeg($val_img, "img.jpg");
imagedestroy($val_img);
$app[val_string]=$val_string;
return;
}
Custom Search
Sunday, May 18, 2008
How to : Image Validator In PHP
Label:
PHP
Saturday, May 17, 2008
Using FindControl and PreviousPage with Master Pages
In theory, PreviousPage lets you access data on the page the user just requested. In practice it doesn't work if you're also using Master Pages unless you understand ASP.NET naming containers.
PreviousPage promises a lot: You transfer to a target page using either Server.Transfer on the server or cross-page posting from the browser.
Once you arrive at the target page, you can use its PreviousPage property to reach back to a control on the previous page and retrieve its data.
PreviousPage promises a lot: You transfer to a target page using either Server.Transfer on the server or cross-page posting from the browser.
Once you arrive at the target page, you can use its PreviousPage property to reach back to a control on the previous page and retrieve its data.
For more complete article click here
Label:
asp.net
Using Database Commands in ASP.NET
The SqlDataSource control can be used to represent four different types of SQL commands that use for executing inline SQL statements. The control supports the following four properties:
selectCommand, insertCommand, updateCommand, and deleteCommandExample
asp:SqlDataSource
id="srcStudent"
SelectCommand="SELECT * FROM student"
ConnectionString="<%$ ConnectionStrings:Student %>"
Runat="server"
Label:
asp.net
Subscribe to:
Posts (Atom)
