A New Year (2005)

It was exactly a year ago that I made the decision to move to San Francisco. I find it hard to believe how fast the time has flown by. A lot has happened since then. I feel like I’ve grown up quite a bit since I moved away and started living on my own, and have become quite a bit more responsible as well. Awesome changes all around. I think I have an interesting note I wrote down in a journal back in January of 2004 that pondered where I would be a year from now. I’ll have to dig it up when I return to S.F. in two weeks and post it. It’ll be an interesting comparison.

And where will I be in January of 2006? I’m going to New Zealand! (Still not official yet, but I am going to try to do everything in my power to go there). Where there’s a will, there’s a way!

Also, I think that I’ve finally conquered my irrational fear of roller coasters! I went to Magic Mountain yesterday with some friends and we went on nearly all of the rides! I had a blast and definitely wouldn’t mind going back again. Towards the end of the night, we all started feeling queezy though (of course most of that might be attributed to our New Year’s Party the night before). Regardless, it was a good time.

Anyway, changing to a more somber subject, it is amazing to see the amount of support people are showing for victims of the tsunamis. Right now, people have donated nearly 12.5 million to the Red Cross through Amazon.com’s donation system. The Red Cross alone is reporting nearly $48 million dollars in donations, which is incredible. Millions more have been donated to other organizations as well.

Regarding the tsunamis, my website apparently has a high Google ranking for anything relating to tsunamis. However, this is attributed to the fact that I have quite a few posts and photo galleries on this website dedicated to Tsunami Bomb, one of my favorite bands. In the last few days, my website has gotten over 400 hits from people searching Google and other search engines for tsunami related information. As a consequence of this, the search engines take them to my Tsunami Bomb photo galleries!

I know for a fact this isn’t what a lot of these people care to see. So to help facilitate the spreading of information, I coded up an interesting script that runs on all pages of the website. Basically, it uses PHP and it detects if the referring URL contains the words “tsunami” and “bomb.” If so, then the script doesn’t do anything, taking the user directly to the photo galleries, which is most likely what they want to see. However, if it detects the word “tsunami” but WITHOUT the word “bomb”, the script then intercepts the incoming visitor and redirects them to a special page I setup with information on the tsunami. You can view that page here.

I have to say, I absolutely LOVE using PHP for web design stuff. It is quite powerful and you can do some awesome things with it.

Anyway, for those interested (or for future hits from Google that are searching for how to do PHP redirects) I’ll post the code below for your own use.

< ?php

//Some source code taken from this page: http://us3.php.net/strpos
//Modified by David Schumaker (Dec 31, 2004)

function findStr($search, $target) {
$matches = 0;
$search = strtolower($search);
$target = strtolower($target);
$output = "";
// Create the "search" array, which holds all our search terms
$search = explode("*",$search); // You could change this to: '$search = explode(" ",$search);' if you wanted your search terms to be split by a space.
$pos = 0;
for ($i=0; $i
// Check if the current search term is in our target
if (strpos($target, $search[$i], $pos) != '' && strlen($search[$i])>0) {
$pos = strpos($target, $search[$i], $pos);
$matches++;
}
if (strlen($search[$i])<1) {
$matches++;
}
}
if ($matches == count($search)) {
return true;
} else {
return false;
}
}

$searchurl = $_SERVER['HTTP_REFERER'];

//find name for "tsunami"
$searcht = findStr("tsunami",$searchurl);

//search for tsunami bomb
$searchb = findStr("bomb",$searchurl);

//search for www.rockbandit.net (coming from within my domain name)
$searchrb = findStr("www.rockbandit.net",$searchurl);

//search function to determine where to go
if(($searcht==1) && ($searchb==1)) {
//Search relates to Tsunami Bomb, do nothing
} else if(($searcht==1) && ($searchb==0) && ($searchrb==1)) {
//Do nothing, search contains rockbandit, coming from within own website.
} else if(($searcht==1) && ($searchb==0) && ($searchrb==0)) {
//Search relates to tsunamis - redirect
$URL="http://www.rockbandit.net/tsunami.php";
header ("Location: $URL");
exit();
} else {
//Search does not relate to Tsunamis at all. Do nothing.
}?>

CategoriesUncategorized