-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunc.php
More file actions
executable file
·65 lines (51 loc) · 1.65 KB
/
func.php
File metadata and controls
executable file
·65 lines (51 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
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
<?php
function xss($var){
if(is_array($var)) {
foreach($var as $k=>$v)
$new[$k] = xss($v);
return $new;
}
return htmlspecialchars(strip_tags($var));
}
function display_msg($type, $type_div, $msg) {
$output = '<div class="alert alert-block '.$type_div.' fade in"> <button type="button" class="close" data-dismiss="alert">×</button> <h4 class="alert-heading">'.$type.'!</h4> <p>'.$msg.'!</p>';
return $output;
}
function display_msg2($type, $type_div, $msg) {
$output = '<div class="alert alert-block '.$type_div.' fade in"> <h4 class="alert-heading">'.$type.'!</h4> <p>'.$msg.'!</p>';
return $output;
}
/* проверим, жив ли сервер */
function ping_db($connect) {
if (mysqli_ping($connect)) {
echo "Соединение в порядке!\n";
}
else {
echo "Ошибка: %s\n", mysql_error();
}
}
# Функция для определения параметров изображения
# Возвращает массив параметров если файл изображение и FALSE при ошибке
function get_image_info($file = NULL)
{
if(!is_file($file)) return false;
if(!$data = getimagesize($file) or !$filesize = filesize($file)) return false;
$extensions = array(1 => 'gif', 2 => 'jpg',
3 => 'png', 4 => 'bmp');
$result = array('width' => $data[0],
'height' => $data[1],
'extension' => $extensions[$data[2]],
'size' => $filesize,
'mime' => $data['mime']);
return $result;
}
function check_login() {
if (@$_SESSION['access']!='allowed' or @$_SESSION['user']['ip']!=$_SERVER['REMOTE_ADDR']) {
$a = false;
}
else {
$a = true;
}
return $a;
}
?>