- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 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("\'", "'", $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('\\', "\", $str);
$str = str_replace("|", "I", $str);
$str = str_replace("||", "I", $str);
$str = str_replace("/\\\$/", "$", $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