<?php
/* 
Meta tag randomizer,
(C) 2002 Simon Carr. 
BSD License

This little script has two functions; 
1) to make meta tags / keywords more managable.
2) to make some meta tags random to give the illusion that the 
site is changing constantly.  Search engines seem to like this 
in theory!

Anyway, in any event, it's good to have a complete
set of meta tags.

INSTRUCTIONS: 
The keyword, description etc.. files are all lists
seperated by newlines.  The newlines will be read
and randomized in the meta tag data.  Some of the 
variables are strings.  

Include this file into your PHP script where the 
<HEAD></head> would be.. eg 

<HEAD>
    <TITLE>My page!</title>
    <?php include("meta.php"); ?>
</head>
*/

// The title (I might randomize this too later)
$title_str "The title is here." 

// The author
$author_str "Simon Carr" 

// The owner
$owner_str "me@simoncarr.com" 

// The subject FILE
$subject_file "test.tags" 

// The rating
$rating_str "GENERAL" ;

// The description FILE
$description_file "test.tags" 

// The abstract FILE (this can be the same as the description file
$abstract_file "test.tags" 

// Your keyword FILE
$keyword_file "test.tags" ;

// Revisit after (INT)
$revisit_int "30" // 30 days is reccomended. 

// The generator
$generator_str "http://www.simoncarr.com" 

// The language
$language_str "EN" 

// Copyright 
$copyright_str "Simon Carr, or whoever." 

// I dunno, I just like to let ALL robots hit my page, I'm not 
// on a bandwidth budget or anything. 
$robots_str "ALL" 

/** END OF CONFIGURABLE OPTIONS **/ 

function return_keywords($file) { 
    
$fh fopen($file,'r'); 
    
$fout fread($fh,filesize($file)); 
    
fclose($fh);
    
$final explode("\n",$fout); 
    
$count count($final); 
    
$realfinal array_rand($final,$count); 
    foreach(
$realfinal as $fin) { $output .= "$final[$fin],"; }  
    return(
$output); 
}

function 
return_one_line($file) { 
    
$fh fopen($file,'r');
    
$fout fread($fh,filesize($file));
    
fclose($fh);
    
$final explode("\n",$fout);
    
$count count($final);
    
$realfinal array_rand($final,1);
    
$output .= $final[$realfinal]; 
    return(
$output);
}

?>

<!-- keywords: <?php print return_keywords("$keyword_file"); ?>-->
    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
    <meta name="distribution" content="Global">
    <META NAME="TITLE" CONTENT="<?php print $title_str?>">
    <META NAME="AUTHOR" CONTENT="<?php print $author_str?>">
    <META NAME="OWNER" CONTENT="<?php print $owner_str?>">
    <META NAME="SUBJECT" CONTENT="<?php print return_one_line("$subject_file"); ?>">
    <META NAME="RATING" CONTENT="<?php print $rating_str?>">
    <META NAME="DESCRIPTION" CONTENT="<?php print return_one_line("$description_file"); ?>">
    <META NAME="ABSTRACT" CONTENT="<?php print return_one_line("$abstract_file"); ?>">
    <META NAME="KEYWORDS" CONTENT="<?php print return_keywords("$keyword_file"); ?>">
    <META NAME="REVISIT-AFTER" CONTENT="<?php print $revisit_int?> DAYS">
    <META NAME="GENERATOR" CONTENT="<?php print $generator_str?>">
    <META NAME="LANGUAGE" CONTENT="<?php print $language_str?>">
    <META NAME="COPYRIGHT" CONTENT="<?php print $copyright_str?>">
    <META NAME="ROBOTS" CONTENT="<?php print $robots_str?>">