php if defined _SAPE_USER define _SAPE_USER 08fbaf0518cf9d0132d2 21f5a

  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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
<?php
if (!defined('_SAPE_USER')){
define('_SAPE_USER', '08fbaf0518cf9d0132d221f5a0337409');
}
require_once($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php');
$o['host'] = 'karman.ru';
$sape = new SAPE_client($o);
unset($o);
$start_time = microtime();
$start_array = explode(" ",$start_time);
$start_time = $start_array[1] + $start_array[0];
defined('BASE_DIR') or define('BASE_DIR',$_SERVER['DOCUMENT_ROOT'] . '/');
include_once(BASE_DIR . 'config/config.php');
include_once(BASE_DIR . 'config/dbconn.php');
include_once(BASE_DIR . 'modules/lib.php');
include_once(BASE_DIR . 'modules/cache.php');
include_once(BASE_DIR . 'templates/default/menu.php');
/*$start_time = microtime();
$start_array = explode(" ",$start_time);
$start_time = $start_array[1] + $start_array[0];*/
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
$_HTML = Array();
$_META = Array();
$_METATAGS = Array();
$gam;
function search()
{
return include 'include/search.php';
}
function getsearch()
{
return include 'include/getsearch.php';
}
function getContent2($p1,$p2,$name)
{
include 'include/getContent2.php';
}
function getModelImg($category,$brand,$model,$index="1")
{
return include 'include/getModelImg.php';
}
function getBrandImg($brand)
{
return include 'include/getBrandImg.php';
}
function getModel1($category,$brand,$model,$class="b")
{
return include 'include/getModel1.php';
}
function getModels($category,$brand)
{
return include 'include/getModels.php';
}
function getCategory($category)
{
return include 'include/getCategory.php';
}
function getModel2($category,$brand,$model)
{
return include 'include/getModel2.php';
}
function getbrandlist($category)
{
return include 'include/getbrandlist.php';
}
function getmodellist($category,$brand)
{
return include 'include/getmodellist.php';
}
function getmodels_rnd($category)
{
return include 'include/getmodels_rnd.php';
}
function getModel_rnd($category,$model)
{
return include 'include/getModel_rnd.php';
}
function getnewsbrief()
{
return include 'include/getnewsbrief.php';
}
function getContent($pageid,$category,$brand,$model)
{
return include 'include/getContent.php';
}
/******************************picture******************************/
function replace_getPict($curr)
{
return include 'include/replace_getPict.php';
}
function return_getPict($pos)
{
return include 'include/return_getPict.php';
}
function getPict($category,$pages)
{
include 'include/getPict.php';
}
/*___________________________________________end of pict___________________________*/
/******************************theme********************************/
function replace_getTheme($curr)
{
return include 'include/replace_getTheme.php';;
}
function return_getTheme($pos)
{
return include 'include/return_getTheme.php';
}
function getTheme($category,$pages)
{
include 'include/getTheme.php';
}
function getGames($category,$pages)
{
include 'include/getGames.php';
}
function replace_getGames($curr)
{
return include 'include/replace_getGames.php';;
}
function return_getGames($pos)
{
return include 'include/return_getGames.php';
}
/*___________________________________________end of theme___________________________*/
function getAbout() {
include 'include/getAbout.php';
}
function getConnect() {
global $_HTML, $_META;
session_start();
if (isset($_POST['submit']))
{
$confirm_id = (eregi('^[a-z0-9]{32}$', $_POST['confirm_id'])) ? $_POST['confirm_id'] : '';
$result = mysql_query("SELECT * FROM captcha WHERE confirm_id = '$confirm_id' LIMIT 1");
$row = mysql_fetch_assoc($result);
if (!$row || $_POST['confirm'] !== $row['code'] || $_POST['nameF']==='' || $_POST['textF']===''|| $_POST['emailF']==='' )
{
$_HTML['content'] .='<p style=color:red>Заполните все поля, либо проверьте на правильность:</p>';
}
else
{
$session_id = (eregi("^[a-z0-9]{32}$", session_id())) ? session_id() : '';
mysql_query("DELETE FROM captcha WHERE session_id = '$session_id'");
session_destroy();
$head = "Content-type: text/html; charset=utf-8";
if (mail("softvsofte@gmail.com", $_POST['nameF'], $_POST['textF'], "From: ".$_POST['mailF']." \r\n", $head)) {
$_HTML['content'] .='<p style=color:red>Спасибо за связь</p>';
} else {
$_HTML['content'] .= "some error happen";
}
$_HTML['content'] .='';
}
//echo $_POST['confirm'] . '|' . $row['code'] . '<br />';
}
$confirm_id = md5(uniqid($_SERVER['REMOTE_ADDR']));
$_HTML['content'] .='&nbsp;
<strong>Обратная связь</strong>
<form method="post">
<input type="text" name="nameF" size="30" value='.$_POST['nameF'].'>Имя<br>
<input type="text" name="mailF" size="30" value='.$_POST['mailF'].'>E:mail<br>
<textarea name="textF" style="width: 342px; height: 184px">'.$_POST['textF'].'</textarea><br>
<img src="include/captcha.php?id='.$confirm_id.'">
<input type="text" name="confirm" size="30">
<input type="hidden" name="confirm_id" value="'.$confirm_id.'">
<br>
<input type="submit" name="submit" value="Отправить">
</form>';
}
function meta($pageid,$cat,$what)
{
global $_HTML, $_META, $_GET;
/*$cat = ($pageid > 0) ? $_GET['p2'] : 0;*/
if ($what=='title') {$_HTML['title'] = from_cache('1_'.$pageid.'_'.$cat.'_'.$what);
} else {
$_META[$what] = from_cache('1_'.$pageid.'_'.$cat.'_'.$what);}
}
header('Content-type: text/html; charset="utf-8"', true);
$template = file_get_contents(BASE_DIR . 'templates/default/index.php');
$p1 = _param('p1');
$p2 = _param('p2');
$p3 = _param('p3');
$_HTML['title'] = "";
$_HTML['descr'] = "";
$_HTML['head'] = "";
$_META['description'] = "";
$_HTML['body'] = "";
$_META['keywords'] = "";
$_HTML['content'] = '';
$_HTML['in_main'] .= "";
//*MAIN PART - define $_HTML['title'], $_HTML['body'], $_META['keywords'], $_META['description']
$_HTML['title'] = '';
$_HTML['body'] = '';
$_META['keywords'] = '';
$_META['description'] = '';
$main = false;
$catalog = false;
$category = '';
$brand = '';
$model = '';
if ($p1 == "" || $p1 == "index") {
$main = true;
} elseif ($p1 == "articles"){
getContent2($p1,$p2,'Статьи');
} elseif ($p1 == "review"){
getContent2($p1,$p2,'Обзоры');
} elseif ($p1 == "news"){
getContent2($p1,$p2,'Новости');
} elseif ($p1 == "games"){
getGames($p2,$p3);
} elseif ($p1 == "theme"){
getTheme($p2,$p3);
} elseif ($p1 == "pict"){
getPict($p2,$p3);
} elseif ($p1 == "about"){
getAbout();
} elseif ($p1 == "connect"){
getConnect();
} else {
$catalog = true;
$category = $p1;
$brand = $p2;
$model = $p3;
/*echo $category;
echo $brand;
echo $model;*/
}
if ($main) {
include 'include/main.php';
}
include 'include/indx.php';
$cat = 0;
$pageid=0;
if ($main || $catalog) {
if ($category!="")$pageid=1;
if ($brand!="")$pageid=2;
if ($model!="")$pageid=3;
if ($main) {$cat==0;} else {
$q=mysql_query("SELECT * FROM `karman_categories` WHERE `uri`=\"$p1\"");
$f = mysql_fetch_array($q);
$cat = $f['id'];
}
meta($pageid,$cat,'title');
meta($pageid,$cat,'description');
meta($pageid,$cat,'keywords');
}
$_HTML['body']=$pageid;
if($category=="cart") {
$_HTML['content'] = "<div class=\"main\">".getCart()."</div>";
}
elseif($category=="search") {
$_HTML['content'] = "<div class=\"main\">".search()."</div>";
}
elseif ($catalog) {
$_HTML['content'] = "<div class=\"main\">".getContent($pageid,$category,$brand,$model)."</div>";
}
/************/
$q_categories = mysql_query("SELECT `name`,`uri` FROM `karman_categories`");
$_HTML['categorytags'] = '';
for ($i=0;$i<mysql_num_rows($q_categories);$i++)
{
$f_categories = mysql_fetch_array($q_categories);
$_HTML['categorytags'] .= "<a href=\"/$f_categories[uri]/\">$f_categories[name]</a>";
}
$_HTML['head'] = '';
foreach ($_META as $km=>$m) {
foreach ($_METATAGS as $km=>$v) {
$m = str_replace("@@_".$k."_@@",$v,$m);
}
}
foreach ($_META as $k=>$v) {
$_HTML['head'] .= '<meta name="'.$k.'" content="'.$v.'" />';
}
/* $_HTML['body'] = 'Some text';
$_HTML['title'] = 'Untitled';*/
/*Release*/
//while (strrpos($template,"@@_")!==false)
$k=@array_keys($t[all]);
$cart_col=0;
$sum=0;
for ($i=0; $i<count($k); $i++) {
$id=$k[$i];
if($t[$id][kol]) {$cart_col+=$t[$id][kol]; $sum+=$t[$id][kol]*$t[$id][price];}
else $cart_col+=1;
}
$_SESSION['t']=$t;
//$_HTML['kol'] = $t[1][kol];
$_HTML['kol'] = $cart_col;
$_HTML['sum'] = $sum;
if($cart_col>0) $_HTML['oform'] = "<div id=t5><a href=\"/cart/\">Оформить заказ</a></div>";
else $_HTML['oform'] = "<div id=t5></div>";
if($p1 == "theme" || $p1 == "games" || $p1 == "pict"){
$qq = mysql_query("SELECT * FROM `karman_d` WHERE name='".$p1."' ");
for ($i=0;$i<mysql_num_rows($qq);$i++)
{
$ff = mysql_fetch_array($qq);
}
$template=str_replace('@@_title_@@',$ff['title'],$template);
$template=str_replace('@@_head_@@','<meta name="description" content="'.$ff['desk'].'" /><meta name="keywords" content="'.$ff['keyword'].'" />',$template);
$template=str_replace('@@_descr_@@',$ff['mini'],$template);
$template=str_replace('@@_name_games_@@',$gam,$template);
}
foreach ($_HTML as $k=>$v) {
$template = str_replace("@@_".$k."_@@",$v,$template);
}
$template=str_replace('&lt;img src="http://web.mobiguru.ru/web/minus.gif"&gt;',htmlspecialchars_decode('&#8211'),$template);
$template=str_replace('##getPic##','
<li>» <a href="/pict/">Картинки</a></li>
<li>» <a href="/theme/">Темы</a></li>
<li>» <a href="/games/">Игры</a></li>
',$template);
//Cache : start
$template=str_replace("@@_sape_@@",'<p style="font-size:8px; text-align:center">'.mb_convert_encoding($sape->return_links($n), "UTF-8", "CP1251").'</p>',$template);
echo $template;
$end_time = microtime();$end_array = explode(" ",$end_time);
$end_time = $end_array[1] + $end_array[0];
$time = $end_time - $start_time;
printf("<p align=center>Страница сгенерирована за %f секунд<p>",$time);
//Cache : end
//echo $sape->return_links($n);