-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.php
217 lines (201 loc) · 9.32 KB
/
base.php
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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
session_start();
if(!$_SESSION['logged']){
header("Location: login.php");
exit;
}
if(($_SESSION['operator'])!="100"){
header("Location: index.php?page=rights");
exit;
}
?>
<div class="container">
<form id="addclient" method="post">
<div class="row">
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Номер полиса" autofocus name="number">
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Дата окончания" name="end">
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Компенсация" name="comp">
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="CK" name="sk">
</div>
</div>
<div class="row">
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Имя" name="firstname">
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Фамилия" name="lastname">
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Возраст" name="age">
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Стаж" name="exp">
</div>
</div>
<div class="row">
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Марка" name="model">
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Год" name="year">
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Объём" name="cc">
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Стоимость" name="cost">
</div>
</div>
<div class="row">
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="Телефон" name="phonenumber">
</div>
<div class="col-xs-3">
<?php
$con=dbConnect();
$result = mysqli_query($con,"SELECT username FROM users");
?>
<select name='op' class="form-control">
<?php
while($row = mysqli_fetch_assoc($result)) {?>
<option value="<?php echo $row['username'];?>"><?php echo $row['username'];?></option>
<?php
}
?>
</select>
</div>
<div class="col-xs-3">
<button form="addclient" name="addclient" type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-list"></span> Добавить клиента</button>
</div>
<div class="col-xs-3">
</div>
</div>
</form>
<!--<div class="col-xs-6">
<form id="start" method="post">
<input type="text" placeholder=" Начальный индекс" name="start">
</form>
<button form="start" type="submit" name="index" class="btn btn-primary"><span class="glyphicon glyphicon-sorts"></span>Изменить индекс</button>
</div>-->
<div class="row">
<div class="col-xs-3">
<form id="del" method="post" role="form">
<?php $number=$_GET['number'];?>
<input type="text" class="form-control" placeholder="Номер полиса" name="number" value="<?php echo $number;?>">
</form>
</div>
<div class="col-xs-3">
<button form="del" type="submit" name="deleteclient" class="btn btn-primary"><span class="glyphicon glyphicon-remove"></span> Удалить клиента</button>
</div>
<div class="col-xs-3">
</div>
<div class="col-xs-3">
</div>
</div>
<div class="row">
<div class="col-xs-3">
<form id="search" role="form" method="GET">
<input type="hidden" class="form-control" name='page' value="<?php echo $_GET['page']; ?>">
<input type=text class="form-control" name='search' value="<?php echo $_GET['search']; ?>">
</form>
</div>
<div class="col-xs-3">
<button form="search" type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> Поиск</button>
</div>
<div class="col-xs-4">
<?php
if (isset($_POST['addclient'])){
$number = mysqli_real_escape_string($con, $_POST['number']);
$end = mysqli_real_escape_string($con, $_POST['end']);
$comp = mysqli_real_escape_string($con, $_POST['comp']);
$sk = mysqli_real_escape_string($con, $_POST['sk']);
$firstname = mysqli_real_escape_string($con, $_POST['firstname']);
$lastname = mysqli_real_escape_string($con, $_POST['lastname']);
$age = mysqli_real_escape_string($con, $_POST['age']);
$exp = mysqli_real_escape_string($con, $_POST['exp']);
$model = mysqli_real_escape_string($con, $_POST['model']);
$year = mysqli_real_escape_string($con, $_POST['year']);
$cc = mysqli_real_escape_string($con, $_POST['cc']);
$cost = mysqli_real_escape_string($con, $_POST['cost']);
$phonenumber = mysqli_real_escape_string($con, $_POST['phonenumber']);
$op = mysqli_real_escape_string($con, $_POST['op']);
$client = new client($number, $end, $comp, $sk, $firstname, $lastname, $age, $exp, $model, $year, $cc, $cost, $phonenumber, $op);
$client->add();
}
if (isset($_POST['deleteclient'])){
$number = mysqli_real_escape_string($con, $_POST['number']);
client::del($number);
}
/*
if (isset($_POST['index'])){
if (isset($_POST['start']) && ($_POST['start']>0)){
$con=dbconnect();
$start = mysqli_real_escape_string($con, $_POST['start']);
$sql= " ALTER TABLE clients AUTO_INCREMENT = $start;";
if (!mysqli_query($con,$sql)) {
die('Error: ' . mysqli_error($con));
}
mysqli_close($con);
}
}
*/
list($list, $pagination, $rows) = client::findAll($_GET['search']);
?>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table table-hover table-condensed table-striped table-bordered">
<thead>
<tr>
<th>Номер полиса</th>
<th>Дата окончания</th>
<th>Компенсация</th>
<th>СК</th>
<th>Имя клиента</th>
<th>Фамилия клиента</th>
<th>Возраст</th>
<th>Стаж</th>
<th>Марка</th>
<th>Год</th>
<th>Объём</th>
<th>Стоимость</th>
<th>Коментарий/th>
<th>Номер агента</th>
<th>Телефон</th>
</tr>
</thead>
<tbody>
<?php echo $list; ?>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="pagination">
<?php echo $pagination; ?>
</div>
</div>
<div class="col-xs-2">
<div class="alert alert-success"><?php echo "Всего $rows";?></div>
</div>
<div class="col-xs-2">
<form id='page' method='GET'>
<input type="hidden" name='page' value="<?php echo $_GET['page']; ?>">
<input type="hidden" name='search' value="<?php echo $_GET['search']; ?>">
<input type=text class="form-control" placeholder="Номер страницы" name='pn' value="<?php echo $_GET['pn']; ?>">
</form>
</div>
<div class="col-xs-2">
<button form="page" type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-paperclip"></span> Страница</button>
</div>
</div>
</div>