1. PHP / Говнокод #25749

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    <?
    error_reporting(E_ALL ^ E_DEPRECATED);
    defined('_SECUR_GAMES') or die('Unknown Error!');
      function bbcode($var = "") {
            $var = preg_replace('#\[b\](.*?)\[/b\]#si', '<span style="font-weight: bold;">\1</span>', $var);
            $var = preg_replace('#\[i\](.*?)\[/i\]#si', '<span style="font-style:italic;">\1</span>', $var);
            $var = preg_replace('#\[u\](.*?)\[/u\]#si', '<span style="text-decoration:underline;">\1</span>', $var);
            $var = preg_replace('#\[s\](.*?)\[/s\]#si', '<span style="text-decoration: line-through;">\1</span>', $var);
            $var = preg_replace('#\[big\](.*?)\[/big\]#si', '<big>\1</big>', $var);
            $var = preg_replace('#\[small\](.*?)\[/small\]#si', '<small>\1</small>', $var);
            $var = preg_replace('#\[center\](.*?)\[/center\]#si', '<center>\1</center>', $var);
            $var = preg_replace('#\[right\](.*?)\[/right\]#si', '<span class="right">\1</span>', $var);
            $var = preg_replace('#\[hr\](.*?)\[/hr\]#si', '<hr>\1</hr>', $var);
            $var = preg_replace('#\[br\](.*?)\[/br\]#si', '<br>\1</br>', $var);
            $var = preg_replace('#\[p\](.*?)\[/p\]#si', '<p>\1</p>', $var);
            $var = preg_replace('#\[gold\](.*?)\[/gold\]#si', '<span style="color:gold">\1</span>', $var);       
          return $var;
        }
        function calculate_age($birthday) {
          $birthday_timestamp = strtotime($birthday);
          $age = date('Y') - date('Y', $birthday_timestamp);
          if (date('md', $birthday_timestamp) > date('md')) {
            $age--;
          }
          return $age;
        }
    	function generatePassword($length=8){
    	  $chars = 'qwedazxscvfrtgnbhyujmkiolp1234567890WEDAZXSCVFRTGNBHYUJMKIOLP';
    	  $numChars = strlen($chars);
    	  $string = '';
    	  for ($i = 0; $i < $length; $i++) {
    	    $string .= substr($chars, rand(2, $numChars) - 1,2);
    	  }
    	  return $string;
    	}
    	function generatePass_word($length=8){
    	  $chars = 'qcvfrtgnbhyujmlp567890WEDAZXSCVFRBHYIOLP';
    	  $numChars = strlen($chars);
    	  $string = '';
    	  for ($i = 0; $i < $length; $i++) {
    	    $string .= substr($chars, rand(2, $numChars) - 1,2);
    	  }
    	  return $string;
    	}
    	function generateLogin($length=8){
    	  $chars = 'qweascv8fjmk6iolp123450WEXSCVFRTGNUOLP';
    	  $numChars = strlen($chars);
    	  $string = '';
    	  for ($i = 0; $i < $length; $i++) {
    	    $string .= substr($chars, rand(2, $numChars) - 1,2);
    	  }
    	  return $string;
    	}
    	function check($str)
    	{
    		$str = htmlentities($str, ENT_QUOTES, 'UTF-8');
    		$str = str_replace("\'", "&#39;", $str);
    		$str = str_replace("\r\n", "<br/>", $str);
    		$str = strtr($str, array(chr("0") => "", chr("1") => "", chr("2") => "", chr("3") => "", chr("4") => "", chr("5") => "", chr("6") => "", chr("7") => "", chr("8") => "", chr("9") => "", chr("10") => "", chr("11") => "", chr("12") => "", chr
    		("13") => "", chr("14") => "", chr("15") => "", chr("16") => "", chr("17") => "", chr("18") => "", chr("19") => "", chr("20") => "", chr("21") => "", chr("22") => "", chr("23") => "", chr("24") => "", chr("25") => "", chr("26") => "", chr("27") =>
    		"", chr("28") => "", chr("29") => "", chr("30") => "", chr("31") => ""));
    		$str = str_replace('\\', "&#92;", $str);
    		$str = str_replace("|", "I", $str);
    		$str = str_replace("||", "I", $str);
    		$str = str_replace("/\\\$/", "&#36;", $str);
    		$str = str_replace("[l]http://", "[l]", $str);
    		$str = str_replace("[l] http://", "[l]", $str);
    		$str = mysql_real_escape_string($str);
    		return $str;
    	}
    	class PAGINGS
    	{
    		public $total;
    		private $total_pages;
    		private $page;
    		private $start;
    		private $end;
    		public $get;
    		public $count_get;
    
    		public function __construct($size, $query)
    		{
    			$this->total = mysql_result(mysql_query(preg_replace('~SELECT (.*?) FROM~isU', 'SELECT COUNT(*) FROM', $query).' ;'), 0);
    			$this->total_pages = ceil($this->total / $size);
    			$this->page = isset($_POST['page']) ? $_POST['page'] : $_GET['page'];
    			$this->page = !empty($this->page) && ctype_digit($this->page) && $this->page >= 1 && $this->page <= $this->total_pages ? $this->page : 1;
    			$this->start = ($this->page * $size) - $size;
    			$this->end = $this->start + $size < $this->total ? $this->start + $size : $this->total;
    			$this->get = mysql_query($query.' LIMIT '.$this->start.', '.htmlspecialchars(stripslashes(addslashes(strip_tags(mysql_real_escape_string(trim($size)))))).' ;');
    			$this->count_get = @ mysql_num_rows($this->get);
    		}

    Взял перл из спора с каким-то мамкиным экспертом, утверждавшим "функциональщина - сраный легаси, ооп - наше всё". Здесь ещё куча алмазиков:
    https://bymas.ru/downloads/view/77400

    Запостил: monobogdan, 05 Августа 2019

    Комментарии (95) RSS

    Добавить комментарий