/* Blogger Meta Data */
interactive systems and activism projects that employ them
|
|||||
///////// Get feature.txt file
$j = "feature.txt"; // file name
$tb = file ($j); // Put into array
$bb = count($tb); // get number of elements in array
do {
// Get random item
$idb = rand (1, $bb); // random number between 1 and $bb inclusive
$idb--; // move back one to get location
$ff = $tb[$idb]; // Get's value at location idb
$ff = str_replace (array("Å_rÅ_n", "Å_nÅ_r", "Å_n", "Å_r"), '', $ff); // Take out carriage returns
$ff = trim ($ff); // Take out blank spaces
// Make sure next reshuffle is not the same is last one
$m = "lastfeature.txt"; // file name
$mm = file ($m); // Put into array
} while ($ff == $m[0]);
// Write new lastfeature to file
$lf = "../lastfeature.txt";
$lfh = fopen($lf, 'w');
fputs($lfh, $ff);
fclose($lfh);
chmod($lf, 0777); //Make CHMOD 777
// Get that id's text file
$b = 'text/'.$ff.'-m.txt';
if (file_exists($b)) { // If there is a text file archive of this id:
$fb = file ($b); // Put text file into array
?>
} // End if file_exists //Make table configurations: $set = array ('m.m.s.m.s.s.s.m.s.s.s', 's.m.s.m.s.m.s.s.s.s.s', 'm.m.s.m.s.s.s.s.s.s.s', 's.m.s.m.s.m.s.m.s.s.s'); $rr = rand (0, 3); $config = $set[$rr]; // chosen config as a string $array = explode ('.', $config); // Puts config string into array ready to use // Make tables: $p = 0; // Table counter $w = 0; // Config array locator //////////// Get count.txt file $f = "count.txt"; // file name $to = file ($f); // Put into array $t = $to[0]; // total number of entries $r = range (1, $t); // Make array of all possible counters ///////////// Fill rest of the cards while ($p <= 10) { // Get random item $idn = rand (1, $t); //if ($idn != $feat) { // Get a random feature not equal to feat $idn--; if ($r[$idn]) { // If the value is still in array, i.e. has not been used if ($r[$idn] != $ff) { // Check if it has not been used as Feature $id = $r[$idn]; // Get's value at location idn $r[$idn] = ''; // Delete that value from key // Get text file $f = 'text/'.$id.'-m.txt'; if (file_exists($f)) { // If there is a text file archive of this id: $fj = file ($f); // Put text file into array // Get height if ($array[$w] == "m") { $height = 124; $col = '999999'; $im = 'im100/'.$id.'-100.jpg'; //Image filename $imw = 100; //Image width $imh = 100; //Image height $cl = 'one'; //Start of class identifier $text = $fj[9]; // Text for 100 x 100 } else { $height = 74; $col = 'CCCCCC'; $im = 'im50/'.$id.'-50.jpg'; //Image filename $imw = 50; //Image width $imh = 50; //Image height $cl = 'fifty'; // Start of class identifier $text = $fj[8]; // Text for 50x50 } // End if ?>
if (($p == 0 ) || ($p == 5)) { // Print column dividers ?> |
} // End if p == 0 } // End if file_exists $w++; $p++; } // End of Check if not same as Feature } // End if still in array, otherwise goes back and shuffles for more //} // End if $idn != $feat } //End while ?> | ||||
|
|||||