//Connect to MYSQL & select Database.
$connection = mysql_connect("mysql6.servage.net","sore4x4", "07850785") or die ("unable to connect to mysql");
$selected = mysql_select_db("sore4x4", $connection) or die ("unable to open database sore4x4");
$path = explode('/',$_SERVER['REQUEST_URI']); //Get current address
//Start Main content algorithm
if ($path[2] == 'db'){
include("db");
}
elseif ($path[2]=='faq'){
echo ' Frequently Asked Questions
';
include ('http://sore4x4.com/faq');
}
elseif ($path[2] == 'links'){
include ('links');
}
elseif ($path[2] == 'link'){
include ('link');
}
elseif ($path[2] == 'link-mail'){
include ('http://sore4x4.com/link-mail.php');
}
elseif ($path[2] == 'gearcalc'){ // Gear Ratio Calculator
include ("gearcalc");
}
elseif ($path[2] == 'games'){
echo 'Games
More games coming soon!
';
echo '';
include('http://sore4x4.com/curveball.html');
echo '';
}
elseif ($path[2] == 'features'){
echo 'Features
Bigger & better features soon to arrive!
';
echo '';
}
else { // case for NO extras selected, eg sore4x4.com/home
echo ' Sore4x4 Home!
';
echo ' Wheeling Trip: May 7
';
echo '
Well, it is time for a wheeling trip. This one is going to be very mild, just kind of an introductory run. If you have any questions or comments post up here.
We will meet at the Washougal Chevron, directly off of Highway 14, at 10:30 am, on Sunday, May 7th.
';
//Start Welcome content algorithm
echo 'Death to Thieves.
';
$table = "admin_msg";
$result = mysql_query("select text from $table order by date DESC");
if (!$result) {
echo 'could not run query #skmt095yhk: '. mysql_error();
exit;
}
$content = mysql_fetch_array($result,MYSQL_ASSOC);
stringecho($content,"5500","./",'text');
//Random info article!
echo 'Over 1000 Inspiring pictures added to the gallery!
I added a vast picture assortment of built 4x4s-- including Fords, Chevys, Jeeps,
and Toyotas. More pictures are coming soon, but there is enough
here to definitely keep you busy for a while!
';
//Random funny tidbit :)
echo ' Lol, This is Just Too true!
This is from "George Constanza\'s Words of Wisdom"
"The most unfair thing about life is the way it ends. I mean, life is tough. It takes up a lot of time. What do you get at the end of it? A death. What\'s that, a bonus?!? I think the life cycle is all backwards. You should die first, get it out of the way. Then you go live in an old age home. You get kicked out for being too healthy, go collect your pension, then, when you start work, you get a gold watch on your first day. You work forty years until your yound enough to enjoy your retirement. You drink alcohol, you party, and you get ready for High School. You go to primary school, you become a kid, you play, you have no responsibilities, you become a littel baby, you go back, you spend your last 9 months floating with luxuries like central heating, spa, room service on tap, then you finish off as an orgasm!! Amen"
';
//Start BLOG content algorithm
echo 'Random Useless Article!
';
$table = "blog";
$id = 3;
$result = mysql_query("select text from $table where id = $id");
if (!$result) {
echo 'could not run query #vkmblaeu084ukb: '. mysql_error();
exit;
}
$content = mysql_fetch_array($result,MYSQL_ASSOC);
stringecho($content,"5000","./","text");
}
function random_db_id ($table){
$order[0] = "DESC";
$order[1] = "ASC";
for ($n=0; $n<2; $n++){
$result = mysql_query("SELECT id FROM $table ORDER BY id $order[$n]");
if (!$result){
echo 'mysql error #tekaeoci09: '.mysql_error();
exit;
}
$id = mysql_fetch_array($result);
$id_extreme[$n] = $id[0];
}
$id = rand($id_extreme[1],$id_extreme[0]);
return $id;
}
function stringecho($content,$max_length,$target_url,$cname){
$content[$cname] = preg_replace('##Umi',"",$content[$cname]);
$length = strlen($content[$cname]);
if ($length > $max_length){
echo substr($content[$cname],0,$max_length);
echo "more...";
}
else echo $content[$cname];
}
?>