Class User private ip private session public function __construct ip s

 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
Class User
{
private $ip;
private $session;
public function __construct($ip, $session)
{
$this->ip = $ip;
$this->session = $session;
}
public function getIp()
{
return $this->ip;
}
public function getSession()
{
return $this->session;
}
public function correctSession()
{
if(!empty($this->session) && is_string($this->session) && strlen($this->session) == 32)
{
return $this->session;
}
}
public function correctIp()
{
if(!empty($this->ip) && is_string($this->ip) && preg_match('[0-9]', $this->ip))
{
return $this->ip;
}
}
}
Class Form
{
public function getInput($class, $type, $width, $placeholder, $value)
{
$input_form = '<input class="'.$class.'" type="'.$type.'" value="'.$value.'" placeholder="'.$placeholder.'" style="width:'.$width.'"/>';
return $input_form;
}
public function getTextarea($class, $width, $height, $max_height, $placeholder, $value)
{
$width = 'max-width:'.$width.'; min-width:'.$width.';';
$height = 'max-height:'.$height.'; min-height:'.$height.'; max-height:'.$max_height.';';
$textarea_form = '<textarea class="'.$class.'" style="'.$width.' '.$height.'" placeholder="'.$placeholder.'">'.$value.'</textarea>';
return $textarea_form;
}
public function getButton($class, $width, $height, $value)
{
$button_form = '<button class="'.$class.'" style="width:'.$width.'; height:'.$height.';">'.$value.'</button>';
return $button_form;
}
}