Location: PHPKode > scripts > realThreat > realthreat/realThreat.php
<?php 
/*Howdy! Enjoy my code and icons and feel free to spread them around. The more people see it, the more
people might start to really think about the frightening and idiotic 
activities and actions of the Bush Administration. This is not an attempt to slam Republicans.
Rather, it is a call for people to vote for ANYONE, Republican or otherwise,
other than the Bush Administration. The group represented here by my program and icons
is, in my mind truly dangerous, immoral and (in at least 1 very prominant case) ignorant. 
I sincerely hope that, after the 2004 elections, this threat to us all will be over and I can retire the icons
presented with this program.
All contents copyright © 2004, realThreat
This code and the included icons are free for non-commercial use. Any other use is prohibited without express permission.
No warranty or guarantee of any kind is offered with this software
- rt (hide@address.com)
*/

// Opens the desired site
@ $site = fopen("http://www.dhs.gov/dhspublic/getAdvisoryCondition", "r"); 

// if the site doesn't respond... goes and checks another site 
if(!$site) {
	@ $site2 = fopen("http://www.whitehouse.gov/homeland/index.html", "r");
	$contents = "";
	do {
		@ $data = fread($site2, 8192);
		if (strlen($data) == 0) {
			break;;
		}
		$contents .= $data;
	} while (true);
	@fclose($site2);
	
//Reads the data to determine the threat level and puts it into a variable
	eregi ("homeland\/images\/threat\/([a-z]+)", $contents, $regs);
	$surveySays = $regs[1];
	$surveySays = strtoupper($surveySays);
	
//Outputs an image that corresponds to the current threat level as our backup site
	echo "<div align=\"center\"><img src=\"images/$surveySays.jpg\"></div>";
	exit;
	
// If the original site ( in line 2) exists, the previous "if" statement (starting on line 17) is skipped and the program resumes here 
} else { 
@ $data = fread($site, 80);
	@fclose($site);
	//Reads the data to determine the threat level and puts it into a variable
	eregi ("CONDITION\=\"([a-z]+)\"", $data, $regs);	
	$surveySays = $regs[1];
	$surveySays = strtoupper($surveySays);
//Outputs an image that corresponds to the current threat level as per dhs.gov
	echo "<div align=\"center\"><img src=\"images/$surveySays.jpg\"></div>";	
} 
?> 
 

Return current item: realThreat