Designing a Department of Homeland Security Threat Level System for your website in PHP (No-Database required).

Essay by syedraza70 April 2005

download word file, 1 pages 5.0

Downloaded 55 times

Author : Syed R Fayyaz

Comments: This is a very simple script to display a security threat level on

your website. This script fetches data from Department of

homeland security Website and stores it into an array.

After parsing it gets the level of security.

Installation : You need to make 5 different images and place their links in the

appropriate conditions below.

EXAMPLE : There are total five threat levels: Severe, High, Elevated

Guarded and Low. You will make 5 different images for

these threat levels.

Now lets suppose the very first image you created to display

severe level, you saved it as "severe.jpg" and placed it in

the folder or directory name "img". At this point you know

that to access this image you just created, the path should

be www.your_website_name.com/img/severe.jpg .

So all you need to do is adjust links in the following code

to display images from your website.

In the code below you should see a comment saying

"//if the threat level is SEVERE then display severe image"

in that condition block see where it says

"echo "$threat = eregi_replace('.*CONDITION="(.*)" />', '\1', implode('\n', file("http://www.dhs.gov/dhspublic/getAdvisoryCondition")));

//if the threat level is SEVERE then display severe image

if (preg_match("/SEVERE/", $threat))

//the link of the image i gave is img/severe.jpg you should change it

//where ever you stored your images

{

echo "

}

//if the threat level is HIGH then display high image

elseif (preg_match("/HIGH/", $threat))

//the link of the image i gave is img/high.jpg you should change it

//where ever you stored your images

{

echo "

}

//if the threat level is Elevated

elseif (preg_match("/ELEVATED/", $threat))

//the link of the image i gave is img/elevated.jpg you should change it

//where ever you stored your images

{

echo "

}

//if the threat...