showmsg.inc (663B)
1 <?php 2 require_once("ressources/strings.inc"); 3 4 function showmsg() { 5 global $strings; 6 7 if (isset($_GET['showmsg'])) { 8 $msg = $_GET['showmsg']; 9 $errmsg = false; 10 11 if (array_key_exists($msg, $strings)) { 12 $errmsg = preg_match('/^err_/', $msg); 13 $okmsg = preg_match('/^ok_/', $msg); 14 $msg = $strings[$msg]; 15 } else { 16 $errmsg = true; 17 $msg = $strings['err_index_invalid_msg']; 18 } 19 20 if($errmsg) 21 echo '<p class="message warning">'.htmlspecialchars($msg).'</p>'; 22 else if($okmsg) 23 echo '<p class="message success">'.htmlspecialchars($msg).'</p>'; 24 else 25 echo '<p class="message other">'.htmlspecialchars($msg).'</p>'; 26 } 27 } 28 29 showmsg(); 30 31 ?>