View file func.inc.php

File size: 16.67Kb
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
function all_time($str)
{
 $__time__str = $str;
                if ($__time__str >= 60)
                    {
                     if ($__time__str >= 3600)
                         {
                          $__dhour__str = ($__time__str/3600);
                          $__dhmin__str = ($__time__str%3600);
                         }
                     else
                         {
                          $__dhour__str = '0'; $__dhmin__str = '0';
                         }
                     $__mins__str = ($__time__str/60);
                     if ($__mins__str < 60) {$__dmin__str = $__mins__str;}
                     else {$__dmin__str = ($__mins__str%60);}
                     $__dsec__str = ($__time__str%60);
                     session_register('tec_time');
                     if ($__dhour__str < 10) {$__dhour__str = '0'.$__dhour__str;}
                     if ($__dmin__str < 10) {$__dmin__str = '0'.$__dmin__str;}
                     if ($__dsec__str < 10) {$__dsec__str = '0'.$__dsec__str;}
                     if (strpos($__dhour__str,'.')) {$__dhour__str = explode('.',$__dhour__str);
                     $__dhour__str = $__dhour__str['0'];}
                     $_SESSION['tec_time'] = substr($__dhour__str,0,strlen($__dhour__str)).':'.substr($__dmin__str,0,2).':'.$__dsec__str;
                    }
                else
                    {
                     session_register('tec_time');
                     if ($__time__str <= 9) {$_SESSION['tec_time'] = '00:00:0'.$__time__str;}
                         else {$_SESSION['tec_time'] = '00:00:'.$__time__str;}
                    }
                return $_SESSION['tec_time'];
}

function check_year ($__real__bday,$__real__bmonth,$__real__byear)
                     {
                      if (strlen($__real__bday) == 2 && strlen($__real__bmonth) == 2 && strlen($__real__byear) == 2
                          && '19'.$__real__byear >= (date('Y')-60) && '19'.$__real__byear <= (date('Y')-10))
                          {
                           if ($__real__bmonth == 01 || $__real__bmonth == 03 || $__real__bmonth == 05
                               || $__real__bmonth == 07 || $__real__bmonth == 08 || $__real__bmonth == 10
                               || $__real__bmonth == 12)
                               {
                                $d1 = 31;
                               }
                                if ($__real__bmonth == 02)
                                    {
                                     if ('19'.$__real__byear == 1996 || '19'.$__real__byear == 1992 || '19'.$__real__byear == 1988
                                         || '19'.$__real__byear == 1984 || '19'.$__real__byear == 1980 || '19'.$__real__byear == 1976
                                         || '19'.$__real__byear == 1972 || '19'.$__real__byear == 1968 || '19'.$__real__byear == 1964
                                         || '19'.$__real__byear == 1960 || '19'.$__real__byear == 1956 || '19'.$__real__byear == 1952
                                         || '19'.$__real__byear == 1948)
                                         {
                                          $d1 = 29;
                                         }
                                     else
                                         {
                                          $d1 = 28;
                                         }
                                    }
                                if ($__real__bmonth == 04 || $__real__bmonth == 06 || $__real__bmonth == 09
                                    || $__real__bmonth == 11)
                                    {
                               	     $d1 = 30;
                                    }
                                     if ($__real__bmonth >= 01 && $__real__bmonth <= 12)
                                         {
                                          if ($__real__bday >= 01 && $__real__bday <= $d1)
                                              {
                                               $__real__byears = $__real__bday.'-'.$__real__bmonth.'-'.$__real__byear;
                                               return $__real__byears;
                                              }
                                          else
                                              {
                                               $non = 'День введён неверно.';
                                              }
                                         }
                                     else
                                         {
                                          $non = 'Месяц введён неверно.';
                                         }


                          }
                      else
                          {
                           $non = 'Не верные параметры. Дата рождения должна иметь вид 01.02.88(дд.мм.гг). Возраст от 14 до 50 лет.';
                          }
                     }
function utfmks($text)
{
$win = array("А","Б","В","Г","Д","Е","Ё","Ж","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ч","Ш","Щ","Ы","Ъ","Ь","Э","Ю","Я","а","б","в","г","д","е","ё","ж","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ч","ш","щ","ы","ъ","ь","э","ю","я");
$utf = array("Рђ","Р‘","Р’","Р“","Р”","Р•","РЃ","Р–","Р—","Р?","Р™","Рљ","Р›","Рњ","Рќ","Рћ","Рџ","Р ","РЎ","Рў","РЈ","Р¤","РҐ","Р¦","Р§","РЁ","Р©","Р«","РЄ","Р¬","Р­","Р®","РЇ","Р°","Р±","РІ","Рі","Рґ","Рµ","С‘","Р¶","Р·","Рё","Р№","Рє","Р»","Рј","РЅ","Рѕ","Рї","СЂ","СЃ","С‚","Сѓ","С„","С…","С†","С‡","С€","С‰","С‹","СЉ","СЊ","СЌ","СЋ","СЏ");
$text = str_replace($utf,$win,$text);
return $text;
}
function check($pass)
{
if (strpos($pass,'0') || strpos($pass,'1')
    || strpos($pass,'2') || strpos($pass,'3')
    || strpos($pass,'4') || strpos($pass,'5')
    || strpos($pass,'6') || strpos($pass,'7')
    || strpos($pass,'8') || strpos($pass,'9'))
    {
     if (strpos($pass,'a') || strpos($pass,'b') || strpos($pass,'c')
         || strpos($pass,'d') || strpos($pass,'e') || strpos($pass,'f')
         || strpos($pass,'g') || strpos($pass,'h') || strpos($pass,'i')
         || strpos($pass,'j') || strpos($pass,'k') || strpos($pass,'l')
         || strpos($pass,'m') || strpos($pass,'n') || strpos($pass,'o')
         || strpos($pass,'p') || strpos($pass,'q') || strpos($pass,'r')
         || strpos($pass,'s') || strpos($pass,'t') || strpos($pass,'u')
         || strpos($pass,'v') || strpos($pass,'w') || strpos($pass,'x')
         || strpos($pass,'y') || strpos($pass,'z'))
         {
          if (strpos($pass,'A') || strpos($pass,'B') || strpos($pass,'C')
              || strpos($pass,'D') || strpos($pass,'E') || strpos($pass,'F')
              || strpos($pass,'G') || strpos($pass,'H') || strpos($pass,'I')
              || strpos($pass,'J') || strpos($pass,'K') || strpos($pass,'K')
              || strpos($pass,'M') || strpos($pass,'N') || strpos($pass,'O')
              || strpos($pass,'P') || strpos($pass,'Q') || strpos($pass,'R')
              || strpos($pass,'S') || strpos($pass,'T') || strpos($pass,'U')
              || strpos($pass,'V') || strpos($pass,'W') || strpos($pass,'X')
              || strpos($pass,'Y') || strpos($pass,'Z'))
              {
               if (ctype_lower(substr($pass,0,1)) || ctype_upper(substr($pass,0,1)) || is_numeric(substr($pass,0,1)))
                   {
                   	if (ctype_lower(substr($pass,0,1)))
                   	    {
                   	     if (!ctype_lower(substr($pass,-1)))
                   	         {
                   	          return $pass;
                   	         }
                   	    }
                   	if (ctype_upper(substr($pass,0,1)))
                   	    {
                   	     if (!ctype_upper(substr($pass,-1)))
                   	         {
                   	          return $pass;
                   	         }
                   	    }
                   	if (is_numeric(substr($pass,0,1)))
                   	    {
                   	     if (!is_numeric(substr($pass,-1)))
                   	         {
                   	          return $pass;
                   	         }
                   	    }
                   }
              }
         }
    }
}
function checkl($user)
{
 if (!is_numeric($user))
     {
      if (!strstr($user,'--') && !strstr($user,'__')
          && !strstr($user,'==') && !strstr($user,'@@')
          && !strstr($user,'::'))
          {
           if (!strstr(strtolower($user),'aaa') && !strstr(strtolower($user),'bbb') && !strstr(strtolower($user),'ccc')
               && !strstr(strtolower($user),'ddd') && !strstr(strtolower($user),'eee') && !strstr(strtolower($user),'fff')
               && !strstr(strtolower($user),'ggg') && !strstr(strtolower($user),'hhh') && !strstr(strtolower($user),'iii')
               && !strstr(strtolower($user),'jjj') && !strstr(strtolower($user),'kkk') && !strstr(strtolower($user),'lll')
               && !strstr(strtolower($user),'mmm') && !strstr(strtolower($user),'nnn') && !strstr(strtolower($user),'ooo')
               && !strstr(strtolower($user),'ppp') && !strstr(strtolower($user),'qqq') && !strstr(strtolower($user),'rrr')
               && !strstr(strtolower($user),'sss') && !strstr(strtolower($user),'ttt') && !strstr(strtolower($user),'uuu')
               && !strstr(strtolower($user),'vvv') && !strstr(strtolower($user),'www') && !strstr(strtolower($user),'xxx')
               && !strstr(strtolower($user),'yyy') && !strstr(strtolower($user),'zzz'))
               {
               	if (!strstr($user,'111') && !strstr($user,'222') && !strstr($user,'333')
               	    && !strstr($user,'444') && !strstr($user,'555') && !strstr($user,'666')
               	    && !strstr($user,'777') && !strstr($user,'888') && !strstr($user,'999')
               	    && !strstr($user,'000'))
               	    {
                     for ($il = 0; $il <= (strlen($user)-1); $il++)
                          {
                           if (substr($user,$il,1) == '-')
                               {
                               	$ass++;
                               }
                           if (substr($user,$il,1) == '_')
                               {
                               	$bss++;
                               }
                           if (substr($user,$il,1) == '=')
                               {
                               	$css++;
                               }
                           if (substr($user,$il,1) == '@')
                               {
                               	$dss++;
                               }
                           if (substr($user,$il,1) == ':')
                               {
                               	$ess++;
                               }
                           if (substr(strtolower($user),$il,1) == 'a')
                               {
                               	$aas++;
                               }
                           if (substr(strtolower($user),$il,1) == 'b')
                               {
                               	$abs++;
                               }
                           if (substr(strtolower($user),$il,1) == 'c')
                               {
                               	$acs++;
                               }
                           if (substr(strtolower($user),$il,1) == 'd')
                               {
                               	$ads++;
                               }
                           if (substr(strtolower($user),$il,1) == 'e')
                               {
                               	$aes++;
                               }
                           if (substr(strtolower($user),$il,1) == 'f')
                               {
                               	$afs++;
                               }
                           if (substr(strtolower($user),$il,1) == 'g')
                               {
                               	$ags++;
                               }
                           if (substr(strtolower($user),$il,1) == 'h')
                               {
                               	$ahs++;
                               }
                           if (substr(strtolower($user),$il,1) == 'i')
                               {
                               	$ais++;
                               }
                           if (substr(strtolower($user),$il,1) == 'j')
                               {
                               	$ajs++;
                               }
                           if (substr(strtolower($user),$il,1) == 'k')
                               {
                               	$aks++;
                               }
                           if (substr(strtolower($user),$il,1) == 'l')
                               {
                               	$als++;
                               }
                           if (substr(strtolower($user),$il,1) == 'm')
                               {
                               	$ams++;
                               }
                           if (substr(strtolower($user),$il,1) == 'n')
                               {
                               	$ans++;
                               }
                           if (substr(strtolower($user),$il,1) == 'o')
                               {
                               	$aos++;
                               }
                           if (substr(strtolower($user),$il,1) == 'p')
                               {
                               	$aps++;
                               }
                           if (substr(strtolower($user),$il,1) == 'q')
                               {
                               	$aqs++;
                               }
                           if (substr(strtolower($user),$il,1) == 'r')
                               {
                               	$ars++;
                               }
                           if (substr(strtolower($user),$il,1) == 's')
                               {
                               	$asss++;
                               }
                           if (substr(strtolower($user),$il,1) == 't')
                               {
                               	$ats++;
                               }
                           if (substr(strtolower($user),$il,1) == 'u')
                               {
                               	$aus++;
                               }
                           if (substr(strtolower($user),$il,1) == 'v')
                               {
                               	$avs++;
                               }
                           if (substr(strtolower($user),$il,1) == 'w')
                               {
                               	$aws++;
                               }
                           if (substr(strtolower($user),$il,1) == 'x')
                               {
                               	$axs++;
                               }
                           if (substr(strtolower($user),$il,1) == 'y')
                               {
                               	$ays++;
                               }
                           if (substr(strtolower($user),$il,1) == 'z')
                               {
                               	$azs++;
                               }
                          }
                     if (($ass+$bss+$css+$dss+$ess) <= 4)
                         {
                          if ($ass <= 2 && $bss <= 2 && $css <= 2
                              && $dss <= 2 && $ess <= 2)
                              {
                               if ($aas <= 3 && $abs <= 3 && $acs <= 3
                                   && $ads <= 3 && $aes <= 3 && $afs <= 3
                                   && $ags <= 3 && $ahs <= 3 && $ais <= 3
                                   && $ajs <= 3 && $aks <= 3 && $als <= 3
                                   && $ams <= 3 && $ans <= 3 && $aos <= 3
                                   && $aps <= 3 && $aqs <= 3 && $ars <= 3
                                   && $asss <= 3 && $ats <= 3 && $aus <= 3
                                   && $avs <= 3 && $aws <= 3 && $axs <= 3
                                   && $ays <= 3 && $azs <= 3)
                                   {
                                    return $user;
                                   }
                              }
                         }
               	    }
               }
          }
     }
}
?>