How can I code this in a better way, in one file? Output must be more than one (if there is more that one status_update with the given word "online or performancedegradation"), like:
#online System is operating at peak performance. #directonly Traffic is bypassing Smart CDN system, and going directly to websites.
<?php
$filename = "export_file_system_status_output";
$status_update = "online";
$handle = fopen($filename, "r");
$file = fread($handle,filesize($filename));
if (preg_match('#' . $status_update . '#', $file, $match)) {
echo "<div id=badge_subpage_system>
<h5>#online</h5>
<p>System is operating at peak performance.</p>
</div>";
}
?>
<?php
$filename = "export_file_system_status_output";
$status_update = "performancedegradation";
$handle = fopen($filename, "r");
$file = fread($handle,filesize($filename));
if (preg_match('#' . $status_update . '#', $file, $match)) {
echo "<div id=badge_subpage_system>
<h5>#performancedegradation</h5>
<p>Performance is slower than normal.</p>
</div>";
}
?>
<?php
$filename = "export_file_system_status_output";
$status_update = "directonly";
$handle = fopen($filename, "r");
$file = fread($handle,filesize($filename));
if (preg_match('#' . $status_update . '#', $file, $match)) {
echo "<div id=badge_subpage_system>
<h5>#directonly</h5>
<p>Traffic is bypassing Smart CDN system, and going directly to websites.</p>
</div>";
}
?>
It must sort by first status_update found:
online
#online System is operating at peak performance.
then performancedegradation
#directonly Traffic is bypassing Smart CDN system, and going directly to websites.