-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathajax_card_scanner.php
More file actions
158 lines (155 loc) · 6.08 KB
/
ajax_card_scanner.php
File metadata and controls
158 lines (155 loc) · 6.08 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
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
<?
// ===================================================================
// Sim Roulette -> AJAX
// License: GPL v3 (http://www.gnu.org/licenses/gpl.html)
// Copyright (c) 2016-2025 Sim Roulette, https://sim-roulette.com
// ===================================================================
include("_func.php");
if ($_GET['do'])
{
if (!$d=$_GET['dev1']){$d=$_GET['dev2'];}
if ($_GET['new']=='true'){$new=1;} else {$new=0;}
if ($_GET['full']=='true'){$full=1;} else {$full=0;}
$answer=action_card_scanner($d,$_GET['span'],$new,$full);
if ($answer['message']=='ok')
{
?>
<div id="scanned">
<div id="action" class="tooltip" style="margin-bottom: 10px;">— Сканирование ожидает очереди...</div>
<div id="progress_percent" align="center">
0%
</div>
<progress id="progress" value="0" max="100"></progress>
<br><br>
<div id="loading"><img src="sr/loading.gif"></div>
<input type="button" onclick="kill=1;this.style.display='none';document.getElementById('loading').style.display='block';stopAction('<?=$answer['action']?>','scanned');" value="Остановить" style="background:#FF0000; padding: 10px; margin: 5px 0">
</div>
<script>
var timerId = setInterval(function()
{
getProgress(<?=$answer['action']?>);
}, 1000);
</script>
<?
exit();
}
else
{
echo $answer['message'];
exit();
}
}
$devices=array();
if ($result = mysqli_query($db, 'SELECT d.*,m.device FROM `devices` d
LEFT JOIN `modems` m ON m.`device`=d.`id`
ORDER BY d.`title`'))
{
while ($row = mysqli_fetch_assoc($result))
{
if (!$dev){$dev=$row['id'];}
$devices[$row['id']]=$row['title'];
$models[$row['id']]=$row['model'];
$data[$row['id']]=unserialize($row['data']);
$busy[$row['id']]=$row['device'];
}
if (count($devices)>1)
{
$dev=0;
?>
<u>Агрегатор</u>
<select id="device" style="margin-bottom: 10px;" onchange="getActions('ajax_card_scanner.php?device='+device.options[device.selectedIndex].value);">
<option value="0">— Выберите агрегатор —</option>
<?
foreach ($devices as $id=>$title)
{
?>
<option value="<? echo $id; echo '"'; if ($_GET['device']==$id){echo ' selected=1';} echo '>'.$title;?></option>
<?
}
?>
</select>
<?
}
else
{
if (!$_GET['device']){$_GET['device']=$dev;}
}
}
if (count($devices)<2 || $_GET['device'])
{
$m=$models[$_GET['device']];
if (strpos($m,'SR-Nano')!==false)
{
$hint='Место <em>(пример: A0)</em> • Диапазон <em>(A0-A99)</em> • Список <em>(A0, A99, B10)</em>';
$cardholder='Место (X), диапазон (X-X) или список (X,X)</u><br><u>Оставьте пустым для полного сканирования диска';
$placeholder='место, диапазон, список';
$autostart=0;
$new=1;
}
if ($m=='SR-Train')
{
$hint='Ряд <em>(пример: 0)</em> • Диапазон <em>(0-5)</em> • Список <em>(0, 2, 5)</em>';
$cardholder='Ряд (X), диапазон ('.$data[$_GET['device']]['row_begin'].'-'.$data[$_GET['device']]['rows'].') или список (X,X)';
$placeholder='ряд, диапазон, список';
$autostart=0;
}
if ($m=='SR-Organizer')
{
$autostart=1;
}
if ($m=='SR-Organizer-Smart')
{
$autostart=1;
}
if ($m=='SR-Box-Bank' || $m=='SR-Board')
{
$hint='Горизонтальный ряд (8 карт) <em>(пример: 1)</em> • Диапазон <em>(пример: 1-64)</em> • Список <em>(пример: 1,2,8)</em>';
$cardholder='Ряд (X), диапазон (X-X) или список (X,X)';
$placeholder='ряд, диапазон, список';
$autostart=0;
$rowhide=1;
}
if ($m=='SR-Box-2-Bank')
{
$hint='Горизонтальный ряд (8 карт) <em>(пример: 1)</em> • Диапазон <em>(пример: 1-64)</em> • Список <em>(пример: 1,2,8)</em>';
$cardholder='Ряд (X), диапазон (X-X) или список (X,X)';
$placeholder='ряд, диапазон, список';
$autostart=0;
$rowhide=1;
}
if ($m=='SR-Box-8')
{
$autostart=1;
}
if ($busy[$_GET['device']])
{
echo '<div class="tooltip danger">— Перед сканирование следует отключить Онлайн-режим!</div><br><br><span class="link" onclick="location.href=\'online.php?device='.$_GET['device'].'\'">Выключить Онлайн</span> <span class="link" onclick="getActions(\'ajax_card_scanner.php\');">Продолжить</span></div>';
}
else
{
if (!$autostart)
{
echo '<u>'.$cardholder.'</u>';
?>
<input type="text" id="span" maxlength="32" placeholder="<?=$placeholder?>">
<? if ($hint){ ?><div class="hint" style="margin:-5px 0 10px 0;"><?=$hint?></div><? }
?><div<? if (!$new){echo ' style="display:none;"';} ?>>
<div><input type="checkbox" id="new" value="1"> <label for="new">Пропускать просканированные карты</label></div>
<div><input type="checkbox" id="full" value="1"> <label for="full">Пропускать пустые ячейки</label></div>
</div>
<div>
<br>
<div id="loading"><img src="sr/loading.gif"></div>
<input type="button" style="margin-top: -5px;" onclick="this.style.display='none';document.getElementById('loading').style.display='block';getActions('ajax_card_scanner.php?dev1=<?=$dev; if ($dev==0){?>&dev2='+document.getElementById('device').options[document.getElementById('device').options.selectedIndex].value+'<? } ?>&do=1&span='+document.getElementById('span').value+'&new='+document.getElementById('new').checked+'&full='+document.getElementById('full').checked);" value="Выполнить" style="padding: 10px; margin: 5px 0">
<?
}
else
{
?>
<div class="tooltip">— Будут просканированы все СИМ-карты агрегатора.</div><br><br>
<div id="loading"><img src="sr/loading.gif"></div>
<input type="button" onclick="this.style.display='none';document.getElementById('loading').style.display='block';getActions('ajax_card_scanner.php?dev1=<?=$dev; if ($dev==0){?>&dev2='+document.getElementById('device').options[document.getElementById('device').options.selectedIndex].value+'<? } ?>&do=1');" value="Выполнить" style="padding: 10px; margin: 5px 0">
<?
}
}
} ?>