Blog
eXorithm – Execute Algorithm: History For Algorithm create_gradient
eXorithm – Execute Algorithm: History For Algorithm unique_image
eXorithm – Execute Algorithm: Algorithms Beginning with Y
eXorithm – Execute Algorithm: Algorithms Beginning with T
eXorithm – Execute Algorithm: View / Run Algorithm xithm_world_stats_population
function xithm_world_stats_population ($country_list
{
$connectionmysql_connect"xithmdb.aktiv.com""duppie""exorithm");
$y = array();
if$connection) {
$db=@mysql_select_db"xithm"$connection);
$sql = "select * from country_population"
ifis_array$country_list)){
ifcount$country_list) > 0) {
$sql .= " where country in ("
for ($ii=0; $iicount$country_list); $ii++) {
$sql .= "'"mysql_real_escape_string$country_list$ii])."',"
}
$sql .= "'')"
}
}
$mysql_result=@mysql_query$sql$connection);
while ($rowmysql_fetch_array$mysql_result)) {
$y$row[0]] = $row[1];
}
@mysql_close$connection);
} else {
throw new Exception"Could not connect.");
}
return $y
}
eXorithm – Execute Algorithm: History For Algorithm show_address
eXorithm – Execute Algorithm: View / Run Algorithm invert_image
function invert_image ($image
{
$image_width = imagesx$image);
$image_height = imagesy$image);
// if the image is not true color, make it so
if (!imageistruecolor$image)) {
$image2 = imagecreatetruecolor$image_width, $image_height);
imagecopy$image2$image,0,0,0,0,$image_width$image_height);
$image = $image2
}
// loop through all the pixels
for ($h = 0; $h < $image_height; $h++) {
for ($w = 0; $w < $image_width; $w++) {
// get the color at this pixel
$color = imagecolorsforindex$image, imagecolorat$image, $w, $h));
// invert the color
$color'red'] = 255 - $color'red'];
$color'green'] = 255 - $color'green'];
$color'blue'] = 255 - $color'blue'];
// create the new color
$new_color = imagecolorallocate$image, $color'red'], $color'green'], $color'blue']);
// set the color
imagesetpixel$image, $w, $h, $new_color);
}
}
return $image
}
eXorithm – Execute Algorithm: View / Run Algorithm validate_domain
function validate_domain ($domain
{
  return preg_match ("/^[a-zA-Z0-9-.]+.(com|org|net|mil|edu)$/i", $domain);
}Â
eXorithm – Execute Algorithm: Discuss Algorithm validate_domain
validate_domain    version 0.5    validate domain
There are no comments yet
New Comment