Name a Star for your loved one or special occasion

Site Launch: Name My Zodiac Star

Name my zodiac star - name a star

Name a star for a special occasion such as a Birthday or for an anniversary. Pick your star sign, or constellation to name your star in, then provide a special message and a name for the star of your choice.

Name My Zodiac Star provides a beautiful certificate for your star, information sheets, coordinates, and most uniquely of all a full colour photo of the constellation and your star.

Delivery can be electronic, a print quality PDF, or can be framed for you and posted directly to the gift recipient.

Built in PHP, using Shop Script, and a templated design.

A short history of ColdFusion

I just a trip down memory lane reading this article from Adobe's coprorate intranet, kindly reproduced by Damon Cooper for the rest of the world to read.

Thanks Damon!

I occasionaly play with other languages, most recently PHP and life is so much harder to get started, making a database call is not easy, and error reporting - oh don't get me started.

Long live ColdFusion and long may she continue to be the best!

Thredbo Ski Patrol site launch

Today is the launch for the Thredbo Ski Patrol site, one done by donation of time from various sources from within the patrol.

Special thanks go to Leo Kesselring, the designer from Red5 and The Web Showroom for providing his time to making it look so good. The CMS system is open source and provided by CMS Made Simple on a mySQL back end using PHP.

301 Permanent redirects in PHP

I recently moved my site from PHP over to ColdFusion, and this gave me a nice warm fluffy feeling.

However, some of the articles I posted actually received a fair amount of traffic, so I had to leave a few php pages in the system and ask them to redirect to the new and improved ColdFusion based pages.

PHP has a pretty nice system of being able to manipulate headers and make a redirect with a specific code. So these pages needed to be a specific http code to force search engines and the like to update their cache and indexes. For this purpose a 301 http status code should be sent. The 301 status code is used to indicate that a page has permanently moved:

[More]

2007 Web workers survey

Do you work with the web? Creating, editing, writing, programming? If so you are one of the people that the good folks at A List Apart want to have take the survey.

Why? Well, since the web is still pretty young, and we as the workers of that web, are not really statistics yet. no one really knows how old we are, where we come from, what we work with or do. So go and fill it out. I did!

Flickr Photos

I recently signed up to Flickr on a trial and added a few photos to see how it would go. I then enlisted the flickr API to see if I could get the photos on sixfive. It will take me a while to get everything up on flickr, but it shouldnt be too long. There will also be some friends and family only sections for which you will need to sign up to flickr to be able to see.

The best thing about flickr is that it has saved me writing some code to get photos on to the web via a phone camera because you can email phones to your flickr account!

After a quick google search for php flickr, I came out using this nifty script and abstraction for the API specifically for PHP. Now I wrote my own functions to show images in in a couple of functions:

Flickrtags: (This gives you 6 photos with a given tag.)
function flickrtags($tagname){
require_once("phpFlickr/phpFlickr.php");
// Create new phpFlickr object $f = new phpFlickr("41c8bf15de29a34d8e4d3d4e2fbf02f6");

$nsid = $f->people_findByUsername("length");
$photos_red = $f->photos_search(array("user_id"=>$nsid, "tags"=>$tagname, "sort"=>"interestingness-desc", "per_page"=>6));
echo "<div style='text-align:center;'>";
foreach ($photos_red['photo'] as $photo) {
// Build image and link tags for each photo echo "<a xhref=http://www.flickr.com/photos/$photo[owner]/$photo[id]>";
echo "<img border='0' alt='$photo[title]' ".
"src=" . $f->
buildPhotoURL($photo, "Square") . ">";
echo "<br>$photo[title]</a><br><br>";
}
echo "</div>";
}

flickr: (show the last x added photos, if horizontal aligned, then make rows of 6 * x)

function flickr($show,$orientation){
require_once("phpFlickr/phpFlickr.php");
// Create new phpFlickr object $f = new phpFlickr("41c8bf15de29a34d8e4d3d4e2fbf02f6");
if ($orientation != "v"){
$fetch = $show * 8;
}else{
$fetch = $show;
}
$i = 0;
// Find the NSID of the username inputted via the form $nsid = $f->people_findByUsername("length");
// Get the friendly URL of the user's photos $photos_url = $f->urls_getUserPhotos($nsid);
// Get the user's first 36 public photos $photos = $f->people_getPublicPhotos($nsid, NULL, $fetch);
//print_r($photos); echo "<div style='text-align:center;'>";
// Loop through the photos and output the html foreach ($photos['photo'] as $photo) {
echo "<a xhref=$photos_url$photo[id]>";
echo "<img border='0' alt='$photo[title]' ".
"src=" . $f->
buildPhotoURL($photo, "Square") . ">";
echo "</a>";
$i++;
if ($orientation != "v"){
// If it reaches the photo, insert a line break if ($i % 6 == 0) {
echo "<br>\n";
}
}else{
echo "<br>\n";
}
}
echo "</div>";
}

CAPTCHA - human authentication on a form

Recently I started to get a lot of junk in my in-box through the contact form. This was all generated by spam bots on the net so I added in the new feature of human evaluation by use of the image with a number on the contact and comment forms to slow the junk entering my in-box. This technique is known as CAPTCHA (Completely Automated Public Turing to tell Computers from Humans Apart).

A CAPTCHA test is a program that can generate and grade tests that most humans can pass and current computer programs can't pass.

So this particular one is written with PHP and GD (image manipulation part of PHP).

The first part of this is to get a suitably random number and store it somewhere. I have used a session variable so that I can reuse the random function.

function get_random()
{
srand(time());
$max = getrandmax();
$num = rand(1,$max) + rand(1,$max);
$_SESSION['rand'] = $num;
}

Generating the image using that number looks like this, I have saved this in a PHP file and we will look at how to call this in a minute. The code comments should be explanation enough on how it works.

session_start();
//call the function for the random number $number = get_random();
//assign number to a var $number = $_SESSION['rand'];
//create a blank image of size 100 x 18 $img_number = imagecreate(100,18);
//set colour vars $white = imagecolorallocate($img_number,255,255,255);
$black = imagecolorallocate($img_number,0,0,0);
$grey_shade = imagecolorallocate($img_number,255,153,0);
//fill the image with grey shade imagefill($img_number,0,0,$grey_shade);
//put black rectangle around ImageRectangle($img_number,0,0,99,17,$black);
//enter the randomnumber string onto image Imagestring($img_number,9,30,1,$number,$black);
//time to output - set type header to jpeg header("Content-type: image/jpeg");
//output image imagejpeg($img_number);

Now because we put the random number in the user Session, it makes it really easy to get a hold of it on processing the form.

$validation = $_SESSION['rand'];
$code = $_POST['code'];
if ($validation != $code){
error("Your validation code was incorrect - please check and try again");
}

BlogCFC was created by Raymond Camden. This blog is running version 5.9.001.