1    	<?php
2    	/*
3    	    Серверное приложение (бэкенд) Технологии полных выборок.
4    	    Язык исходного кода -- PHP
5    	
6    	    Авторские права (C) 2024-2026 info@fulldata-technology.ru. Все права защищены.
7    	
8    	    Эта программа является свободным программным обеспечением; вы можете 
9    	    распространять её и/или изменять в соответствии с условиями GNU General 
10   	    Public License, опубликованной Free Software Foundation; как версии 3, 
11   	    так и (по вашему выбору) любой более поздней версии.
12   	
13   	    Эта программа распространяется в надежде, что она будет вам полезна,
14   	    но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ; даже без подразумеваемой гарантии
15   	    ТОВАРНОЙ ПРИГОДНОСТИ или ПРИГОДНОСТИ ДЛЯ КОНКРЕТНОЙ ЦЕЛИ. Подробнее см.
16   	    GNU General Public License.
17   	
18   	    Вы должны были получить копию GNU General Public License
19   	    вместе с этой программой; в ином случае запросите копию в Free Software
20   	    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
21   	
22   	    --------------------------------------------------------------------------
23   	
24   	    Full-text search engine with inverted index.
25   	    Source language -- PHP
26   	
27   	    Copyright (C) 2024-2026 Fulldata-technology.ru. All rights reserved.
28   	
29   	    This program is free software; you can redistribute it and/or modify
30   	    it under the terms of the GNU General Public License as published by
31   	    the Free Software Foundation; either version 3 of the License, or
32   	    (at your option) any later version.
33   	
34   	    This program is distributed in the hope that it will be useful,
35   	    but WITHOUT ANY WARRANTY; without even the implied warranty of
36   	    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37   	    GNU General Public License for more details.
38   	
39   	    You should have received a copy of the GNU General Public License
40   	    along with this program; if not, write to the Free Software
41   	    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
42   	*/
43   	
44   	error_reporting(E_ALL);
45   	
46   	ini_set('session.save_path', $_SERVER['DOCUMENT_ROOT'] .'/../sessions/');
47   	ini_set('session.gc_maxlifetime', 120960);
48   	ini_set('session.cookie_lifetime', 120960);
49   	session_start();
50   	
51   	header('Content-Type: text/html; charset=utf-8');
52   	
53   	?>
54   	<html>
55   	<head>
56   	<script type="text/javascript" language="javascript" src="/all/sodi_0.js"></script>
57   	<script type="text/javascript" language="javascript" src="/all/sodi-a.js"></script>
58   	<link rel="stylesheet" href="../css.css" type="text/css" media="all" />
59   	<meta name="viewport" content="width=device-width, initial-scale=1">
60   	
61   	<!-- include jQuery -->
62   	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
63   	
64   	<!-- jQuery Modal -->
65   	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js"></script>
66   	<!--link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" /-->
67   	<link rel="stylesheet" href="jquery.css" />
68   	
69   	<script>
70   	function KeywordsOnOff(a) {
71   	  var checkBox = document.getElementById(a);
72   	  if (checkBox.checked == true){
73   	    loadSODI104('keywordsOnOff.php?action=on&a='+a+'&s=<?=$site?>','sodi-104');
74   	  } else {
75   	    loadSODI104('keywordsOnOff.php?action=off&a='+a+'&s=<?=$site?>','sodi-104');
76   	  }
77   	}
78   	</script>
79   	
80   	</head>
81   	<body>
82   	
83   	<style>
84   	.pos_fixed {
85   	    position:fixed;
86   	    top:0px;
87   	    left:0px;
88   	    z-index:1000;
89   	    background-color:#dddddd;
90   	    opacity:0.9;
91   	    padding:5px;
92   	    height:50px;
93   	}
94   	</style>
95   	
96   	<p class="pos_fixed">
97   	    <span id="status-104"></span>
98   	    <span id="sodi-104"></span>
99   	</p>
100  	
101  	<?php
102  	
103  	
104  	include "cache/qArr.inc";
105  	/*
106  	$qArrCached = array(
107  	    "0"=>"!changan !дилер",
108  	    "1"=>"!cherry !дилер",
109  	    "2"=>"!geely !дилер",
110  	    "3"=>"!haval !дилер",
111  	    "4"=>"!автомобиль !дилер",
112  	    "5"=>"(!lada_|!лада_|!ваз_|!vaz_)",
113  	    "6"=>"((!авто_запчасти)|автозапчасти) {r}",
114  	    "7"=>"((!авто_компоненты)|автокомпоненты) {r}",
115  	    "8"=>"авторемонт (t&c)",
116  	);
117  	*/
118  	
119  	$qArr = $qArrCached;
120  	
121  	/*
122  	echo "<pre>";
123  	print_r($qArr);
124  	print_r($_SESSION['keyWordsArr']);
125  	echo "</pre>";
126  	*/
127  	
128  	$matrixStr = "";
129  	$qArrChosen = array();
130  	
131  	if (!array_key_exists('keyWordsArr',$_SESSION)) {
132  	    $_SESSION['keyWordsArr'] = array();
133  	}
134  	
135  	
136  	foreach($qArr as $w) {
137  	    if (in_array($w,$_SESSION['keyWordsArr'])) {
138  	        $matrixStr .= "0";
139  	    } else {
140  	        $matrixStr .= "1";
141  	        $qArrChosen[]= $w;
142  	    }
143  	}
144  	
145  	/*
146  	echo "\$matrixStr=".$matrixStr."<br>\n";
147  	echo "<pre>";
148  	print_r($qArrChosen);
149  	echo "</pre>";
150  	*/
151  	
152  	//$w = $_GET['w']; // "((!авто_запчасти)|автозапчасти) {r}";
153  	$r = $_GET['r']; // moscow
154  	
155  	if ($r=='') $r = "moscow";
156  	
157  	
158  	// Путь до кэша счетчика
159  	$countPath = "auto-test/count-".$matrixStr.".inc";
160  	
161  	//echo $countPath;
162  	//echo "[".file_exists($countPath)."]";
163  	
164  	include $countPath;
165  	/*
166  	$domCountArr = array(
167  	    "samara"=>"5096",
168  	    "novokuybyshevsk"=>"290",
169  	    ...
170  	);
171  	*/
172  	
173  	//echo "[".count($domCountArr)."]<br>\n";
174  	//exit;
175  	
176  	?>
177  	
178  	<style>
179  	.modal {
180  	    width:900px;
181  	}
182  	</style>
183  	
184  	<div id="ex1" style="width:800px" class="modal">
185  	  <p>Ключевые фразы выборки:</p>
186  	<?php
187  	
188  	$wCountArr = array();
189  	
190  	echo "<table border=0>";
191  	
192  	foreach($qArrCached as $phrase) {
193  	
194  	    $w = urlencode($phrase);
195  	    //echo "\$w=".$w."<br>\n";
196  	    //echo "\$r=".$r."<br>\n";
197  	
198  	    if (!in_array($phrase,$_SESSION['keyWordsArr'])) {
199  	        $checked = " checked";
200  	    } else {
201  	        $checked = "";
202  	    }
203  	
204  	    $wPath = "auto-test/".$phrase.".inc";
205  	
206  	    include $wPath;
207  	/*
208  	$domTaskDate = array(
209  	 "algoritm" => "A1",
210  	 "moscow"=>array(
211  	    "marshal.chery.ru" => "178.1",
212  	    "targeuoo.ru" => "227",
213  	    "sillbn.kz" => "284.7",
214  	    ...
215  	);
216  	*/
217  	    if (array_key_exists($r, $domTaskDate)) {
218  	        $wCountArr[$phrase] = count($domTaskDate[$r]);
219  	    } else {
220  	        $wCountArr[$phrase] = 0;
221  	    }
222  	
223  	    //echo "[".count($domTaskDate[$r])."]";
224  	
225  	?>
226  	<tr><td>
227  	<input type="checkbox" id="<?=$w ?>" onClick="KeywordsOnOff('<?=$w ?>')"<?=$checked ?>>
228  	</td><td>
229  	 (<?=$wCountArr[$phrase] ?>)
230  	</td><td>
231  	<nobr>
232  	<a title="2026-06-22" target="_new" href="http://<?=$r ?>.lookover.su/search.php?q=<?=$w ?>">
233  	    <?=$phrase ?>
234  	</a>
235  	</nobr>
236  	</td></tr>
237  	<?php
238  	    //echo "".$phrase."";
239  	}
240  	?>
241  	</table>
242  	  <p>
243  	     <a href="#" rel="modal:close">Закрыть</a>
244  	  </p>
245  	</div>
246  	<?php
247  	
248  	include "geo-data-array.inc";
249  	/*
250  	$townsMin = array(
251  	    "samara"=>"Самара",
252  	    "novokuybyshevsk"=>"Новокуйбышевск",
253  	    "troitsk"=>"Троицк",
254  	    ...
255  	);
256  	*/
257  	?>
258  	
259  	<style>
260  	.nav {
261  	    table, td, th {
262  	    border: 1px solid;
263  	    }
264  	    table {
265  	    width:100;
266  	    border-collapse: collapse;
267  	    }
268  	}
269  	</style>
270  	
271  	<p>
272  	   <table class="nav" style="background-color:#ddd" width='100%'>
273  	    <tr>
274  	     <td>
275  	      <a href="regionSelect.php?m=<?=$matrixStr?>">
276  	       <?=$townsMin[$r]?>
277  	      </a>
278  	     </td><td>
279  	     <a href="#ex1" rel="modal:open">
280  	<?php
281  	    $total = 0;
282  	    foreach ($qArr as $w) {
283  	        if (in_array($w,$qArrChosen)) {
284  	            echo "<span style='background-color:yellow'>".$w."</span>&#160;(".$wCountArr[$w].")&#160;&#160;";
285  	            $total+=$wCountArr[$w];
286  	        } else {
287  	            echo "<span style='background-color:#ddd'>".$w."</span>&#160;(".$wCountArr[$w].")&#160;&#160;";
288  	        }
289  	    }
290  	    //echo "Всего:".$total."<br>";
291  	?>
292  	      </a>
293  	     </td><td>
294  	      <a href="date.php?r=<?=$r ?>">
295  	        Новые сайты
296  	      </a>
297  	     </td>
298  	    </tr>
299  	   </table>
300  	  </p>
301  	</p>
302  	<?php
303  	
304  	// Получаем массив данных
305  	$path = "cache/".$matrixStr."/".$r.".inc";
306  	
307  	//echo $path;
308  	
309  	include($path);
310  	/*
311  	$domTaskDate = array(
312  	    'changan..em.ru'=>13.8,
313  	    'changan-..rmada.ru'=>14.2,
314  	    'krd-changan..uto.ru'=>14.3,
315  	    'abakan-changan..uto.ru'=>14.6,
316  	    ...
317  	);
318  	*/
319  	
320  	//echo "<pre>";
321  	//print_r($domTaskDate);
322  	
323  	
324  	//----/Формируем выбор комбинации ключевых фраз
325  	
326  	include "cache/domen-regionStr.inc";
327  	
328  	
329  	/*
330  	$domenRegionsArr = array(
331  	    "keyauto-fo..on-gk.ru"=>"moscow,sankt-peterburg,kazan",
332  	    "irkutskaya-p..omo.ru"=>"moscow",
333  	    "temp..uto.su"=>"rostov-na-donu,krasnodar,moscow",
334  	    "sar-..uto.ru"=>"saratov,samara,togliatti",
335  	    ...
336  	);
337  	*/
338  	
339  	include "cache/keyWords.inc";
340  	/*
341  	$keyWordsCached = array(
342  	    "changan..em.ru"=>"0,4,",    // "0"=>"!changan !дилер","4"=>"!автомобиль !дилер"
343  	    "changan-..rmada.ru"=>"0,4,7",    // "0"=>"!changan !дилер","4"=>"!автомобиль !дилер","7"=>"((!авто_компоненты)|автокомпоненты) {r}",
344  	    ...
345  	);
346  	
347  	$qArrCached = array(
348  	    "0"=>"!changan !дилер",
349  	    "1"=>"!cherry !дилер",
350  	    "2"=>"!geely !дилер",
351  	    "3"=>"!haval !дилер",
352  	    "4"=>"!автомобиль !дилер",
353  	    "5"=>"(!lada_|!лада_|!ваз_|!vaz_)",
354  	    "6"=>"((!авто_запчасти)|автозапчасти) {r}",
355  	    "7"=>"((!авто_компоненты)|автокомпоненты) {r}",
356  	    "8"=>"авторемонт (t&c)",
357  	);
358  	*/
359  	
360  	
361  	
362  	$total = count($domTaskDate);
363  	
364  	echo "\$total=".$total."<br>\n";
365  	
366  	
367  	$start = $_GET['start'];
368  	
369  	$count = 0;
370  	$sodiCount = 0;
371  	?>
372  	<table border=1>
373  	<tr bgcolor="#ddd"><td>$count</td><td>$coord</td><td>$domen</td></tr>
374  	<?php
375  	foreach($domTaskDate as $domen=>$coord) {
376  	
377  	
378  	    if ($start<$count && ($start+20)>=$count) {
379  	
380  	
381  	    // Выясняем, каким ключевым фразам соответствует сайт
382  	    $str = $keyWordsCached[$domen];
383  	    $str = substr($str,0,-1);
384  	    //echo "\$str=".$str."<br>";
385  	    $keyNumsArr = explode(",", $str);
386  	    //print_r($keyNumsArr);
387  	    $keyWordsStr = "";
388  	    $keyWordsStr1 = "";
389  	    foreach($keyNumsArr as $num) {
390  	            $keyWordsStr .= "<span style='background-color:yellow'>".$qArrCached[$num]."</span>&#160;&#160;";
391  	    }
392  	    $keyWordsStr1 = $keyWordsStr;
393  	
394  	
395  	        $sodiCount++;
396  	        echo "<tr><td>".$count."</td><td>".$coord."</td><td>";
397  	        echo "<div style='background-color:white'>".$keyWordsStr1."</div>";
398  	
399  	    //echo " $domen=>$coord <br>";
400  	
401  	?>
402  	        <span id="status-<?=$sodiCount ?>"></span>
403  	        <div style="margin-left:40px;width:90%;min-height:150px;back1ground-color:#ccc" id="sodi-<?=$sodiCount ?>">
404  	        <script>
405  	            loadSODI<?=$sodiCount ?>("/view-demo.php?q=<?=urlencode($keyWordsStr) ?>&r=<?=$r ?>&ul=<?=$domen ?>&GroupBySite=no&site=news","sodi-<?=$sodiCount?>");
406  	        </script>
407  	<?php
408  	        echo "</td></tr>\n";
409  	    }
410  	
411  	    $count++;
412  	
413  	}
414  	?>
415  	</table>
416  	<?php
417  	
418  	
419  	for ($i=0;$i<(floor($total/20)+1);$i++) {
420  	
421  	    if ($start==($i*20)) {
422  	        echo "<span style='background-color:yellow'>".($i*20)."</span> ";
423  	    } else {
424  	        echo "<a href='?w=".$w."&r=".$r."&start=".($i*20)."'>".($i*20)."</a> ";
425  	    }
426  	
427  	}
428  	
429  	
430