<?php
// полезные проверки
  function rep($strin) {
      $in_wrd = array("select","update","insert","delete","truncate","create","drop","where","and"," or ","like","\'","`","&amp;quote;","&quot;","(",")","ascii","substring","between","union",";");
      $out_wrd = array("CELECT","APDATE","ENSERT","TELETE","DRUNCATE","GREATE","TROP","VHERE","ANND"," AR ","LICKE","nch039","lsquo","kav10078","kav10078","sko40","skz41","ASKII","SUBSTRINK","BEETWEEN","UNNION","tzpt1");
      if(!empty($strin)) {
       $strin = trim($strin);
       $strin = htmlspecialchars(stripslashes($strin));
       $strin = str_ireplace($in_wrd,$out_wrd,$strin);
       return $strin;
      }
   }

  function rep_back($strin) {
      $in_wrd = array("CELECT","APDATE","ENSERT","TELETE","DRUNCATE","GREATE","TROP","VHERE","ANND"," AR ","LICKE","nch039","lsquo","kav10078","kav10078","sko40","skz41","ASKII","SUBSTRINK","BEETWEEN","UNNION","tzpt1");
      $out_wrd = array("select","update","insert","delete","truncate","create","drop","where","and"," or ","like","\'","`","&quot;","&quot;","(",")","ascii","substring","between","union",";");
      if(!empty($strin)) {
       $strin = trim($strin);
       $strin = htmlspecialchars(stripslashes($strin));
       $strin = str_ireplace($in_wrd,$out_wrd,$strin);
       return $strin;
      }
   }

// выводим ошибки
function puterror($tema,$message) {
  if(!empty($tema)) {echo ("<table align='center' border='0'><tr><td><img alt='stop' src='../skins/".$tema."/stop.png' /></td><td align='left'><span class='bold_it'>".$message." </span><br /></td></tr></table>");}
   else {echo ("<table align='center' border='0'><tr><td><img alt='stop' src='../skins/base/stop.png' /></td><td align='left'><span class='bold_it'>".$message." </span><br /></td></tr></table>");}
 }

  function puterror2($tema,$message) {
  if(!empty($tema)) {echo ("<table align='center' border='0'><tr><td><img alt='stop' src='skins/".$tema."/stop.png' /></td><td align='left'><span class='bold_it'>".$message." </span><br /></td></tr></table>");}
      else {echo ("<table align='center' border='0'><tr><td><img alt='stop' src='skins/base/stop.png' /></td><td align='left'><span class='bold_it'>".$message." </span><br /></td></tr></table>");}
  }

  function puterror3($tema,$message) {
     if(!empty($tema)) {echo ("<table align='center' border='0'><tr align='center' ><td><img alt='stop' src='skins/".$tema."/stop.png' /></td></tr><tr  align='center' ><td><span class='bold_it'>".$message." </span><br /></td></tr></table>");}
      else {echo ("<table align='center' border='0'><tr align='center' ><td><img alt='stop' src='skins/base/stop.png' /></td></tr><tr align='center' ><td><span class='bold_it'>".$message." </span><br /></td></tr></table>");}
  }

  function puterror4($tema,$message) {
     if(!empty($tema)) {echo ("<table align='center' border='0'><tr align='center' ><td><img alt='stop' src='../skins/".$tema."/stop.png' /></td></tr><tr align='center' ><td><span class='bold_it'>".$message." </span><br /></td></tr></table>");}
      else {echo ("<table align='center' border='0'><tr align='center' ><td><img alt='stop' src='../skins/base/stop.png' /></td></tr><tr align='center' ><td><span class='bold_it'>".$message." </span><br /></td></tr></table>");}
  }

  function putok($tema,$message) {
     if(!empty($tema)) {echo ("<table align='center' border='0'><tr><td><img alt='ok' src='../skins/".$tema."/ok.png' /></td><td align='left'><span class='bold_it'>".$message." </span><br /></td></tr></table>");}
      else {echo ("<table align='center' border='0'><tr><td><img alt='ok' src='../skins/base/ok.png' /></td><td align='left'><span class='bold_it'>".$message." </span><br /></td></tr></table>");}
  }
  
  // Проверка наличия обновлений
  function update_check($url,$proxy) {
     if(!empty($url)) {
      if(trim($proxy) !== "") {
       $opts = array('http' => array('proxy' => $proxy, 'request_fulluri' => true));
       $context = stream_context_create($opts);
       $open_upd_file = file_get_contents($url, false, $context);
       } else {$open_upd_file = file_get_contents($url);}
        if(!$open_upd_file) {$upd_line = "";}
         else {$upd_line = $open_upd_file;}
         fclose($open_upd_file);
         return $upd_line;
         }
    }
?>