Файл: public_html/page/banner.php
Строк: 596
<?php
if (!defined('BASE_DIR')) { exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true)); }
$obEngine->addTitleHtml('Купить баннерное место');
if (isset($_GET['mode']) && $_GET['mode'] == 'preview')
{
switch ($_GET['mode'])
{
case 'preview':
if (isset($_GET['id']))
{
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$query = $mysqli->query("SELECT * FROM `".PREFIX."_blocks` WHERE `type` = '2' and `id` = '".$id."' LIMIT 1");
if ($query->num_rows)
{
$res = $query->fetch_assoc();
}
else
{
exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true));
}
if (isset($_POST['url']))
{
$size = explode('x', $res['size']);
$url = filter_var($_POST['url'], FILTER_VALIDATE_URL);
if (!$url)
{
exit(header('Location: /banner.php?id='.$id));
}
if (!empty($_FILES['file']['name']))
{
if($_FILES['file']['type']=='image/jpeg' || $_FILES['file']['type']=='image/png' || $_FILES['file']['type']=='image/gif')
{
if (is_uploaded_file($_FILES["file"]["tmp_name"]))
{
if ($_FILES["file"]["size"] < 150*1024)
{
$data_img = getimagesize($_FILES['file']['tmp_name']);
$type_img = array('1' => 'gif', '2' => 'jpg', '3' => 'png');
$name_file = md5($id.$_FILES['file']['name'].session_id().HASH_MD5).'.'.$type_img[$data_img[2]];
$new_image = BASE_DIR.'/uploads/'.md5($id.$_FILES['file']['name'].session_id().HASH_MD5).'.'.$type_img[$data_img[2]];
move_uploaded_file($_FILES["file"]["tmp_name"], $new_image);
}
else
{
exit(header('Location: /banner.php?id='.$id));
}
}
else
{
exit(header('Location: /banner.php?id='.$id));
}
}
else
{
exit(header('Location: /banner.php?id='.$id));
}
}
$img = isset($_POST['img']) ? $_POST['img'] : $name_file;
$data_img = getimagesize(BASE_DIR.'/uploads/'.$img);
$weeks = (int)$_POST['weeks'];
if ($weeks < 1 && $weeks > 4) { exit(header('Location: /banner.php?id='.$id)); }
$price = $weeks * $res['sum'];
$comm = sprintf("%.2f", ($price*$obEngine->getConfig('comm_pay'))/100);
$user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : session_id();
$data = array('ids' => $id.'_', 'url' => $url, 'img' => $img, 'weeks' => $weeks, 'size' => $size);
$data = serialize($data);
$query = $mysqli->query("SELECT `id` FROM `".PREFIX."_history_pay` WHERE `user_id` = '".$user_id."' and `status` = '0' and `type` = '3' LIMIT 1");
if ($query->num_rows)
{
$res_zakaz = $query->fetch_assoc();
$id_zakaz = $res_zakaz['id'];
$mysqli->query("UPDATE `".PREFIX."_history_pay` SET `time_add` = NOW(), `price` = '".$price."', `money` = '".($price+$comm)."', `data` = '".$data."' WHERE `user_id` = '".$user_id."' and `status` = '0' and `type` = '3' LIMIT 1");
}
else
{
$mysqli->query("INSERT INTO `".PREFIX."_history_pay`
(
`time_add`,
`user_id`,
`type`,
`payment`,
`price`,
`money`,
`wallet`,
`data`,
`status`
)
VALUES
(
NOW(),
'".$user_id."',
'3',
'',
'".$price."',
'".($price+$comm)."',
'',
'".$data."',
'0'
)");
$id_zakaz = $mysqli->insert_id();
}
$desc = base64_encode('Размещение баннера на сайте '.$res['url']);
$arHash = array(ID_SHOP_PAYEER, $id_zakaz, sprintf("%.2f", ($price+$comm)), 'RUB', $desc, SECRET_KEY_PAYEER);
$sign = strtoupper(hash('sha256', implode(':', $arHash)));
?>
<div class="wrapper">
<div class="main">
<div class="m_left">
<div class="m_title">Размещение баннера</div>
<?php
if ($data_img[0] != $size[0] && $data_img[1] != $size[1])
{
?>
<div class="mw-lin nocode" style="width: 620px;"><b>Внимание:</b> Размер загруженного баннера не соответствует размеру баннерного места!</div>
<?php
}
?>
<div class="m_l">Адрес ссылки: <b><?php echo $url; ?></b></div>
<div class="m_l">Файл баннера: <b>http://<?php echo $_SERVER['HTTP_HOST']; ?>/uploads/<?php echo $img; ?></b></div>
<div class="m_l">Результат:</div>
<div class="m_l"><a href="<?php echo $url; ?>"><img id="myimage" src="http://<?php echo $_SERVER['HTTP_HOST']; ?>/uploads/<?php echo $img; ?>" height="<?php echo $size[1]; ?>" width="<?php echo $size[0]; ?>"></a></div>
<div class="m_l">
<form method="post" action="?id=<?php echo $id; ?>">
<input type="hidden" name="id" value="<?php echo $id; ?>_">
<input type="hidden" name="url" value="<?php echo $url; ?>">
<input type="hidden" name="img" value="<?php echo $img; ?>">
<input type="hidden" name="weeks" value="<?php echo $weeks; ?>">
<button class="b1" type="submit">Редактировать</button>
</form>
</div>
<div class="m_l">Сумма к оплате: <b><?php echo $price; ?></b> руб.</div>
<div class="m_l">Выберите способ оплаты:</div>
<div class="pay_btn">
<form name="form2" method="post" action="https://merchant.webmoney.ru/lmi/payment.asp">
<input type="hidden" name="LMI_PAYMENT_AMOUNT" value="<?php echo ($price+$comm); ?>">
<input type="hidden" name="LMI_PAYMENT_DESC_BASE64" value="<?php echo $desc; ?>">
<input type="hidden" name="LMI_PAYEE_PURSE" value="<?php echo WMR; ?>">
<input type="hidden" name="LMI_PAYMENT_NO" value="<?php echo $id_zakaz; ?>" />
<input class="wmoney" type="submit" value="Webmoney"><span class="comment">(+<b><?php echo $comm; ?></b> руб. комиссия)</span>
</form>
</div>
<div class="pay_btn">
<form method="GET" action="https://payeer.com/merchant/">
<input type="hidden" name="m_shop" value="<?php echo ID_SHOP_PAYEER; ?>">
<input type="hidden" name="m_orderid" value="<?php echo $id_zakaz; ?>">
<input type="hidden" name="m_amount" value="<?php echo sprintf("%.2f", ($price+$comm)); ?>">
<input type="hidden" name="m_curr" value="RUB">
<input type="hidden" name="m_desc" value="<?php echo $desc; ?>">
<input type="hidden" name="m_sign" value="<?php echo $sign; ?>">
<input type="hidden" name="form[ps]" value="2609">
<input type="hidden" name="form[curr[2609]]" value="RUB">
<input type="submit" class="wmoney" name="m_process" value="Payeer" /><span class="comment">(+<b><?php echo $comm; ?></b> руб. комиссия)</span>
</form>
</div>
<?php
if (isset($_SESSION['user_id']) && $users_info['status'] == 1)
{
?>
<div class="pay_btn">
<form name="form4" method="post" action="result.php" onsubmit="return validate4();">
<?php $sign = md5('banner'.$id.'_'.$url.$img.$weeks.$_SESSION['user_id'].$price.'_'.HASH_MD5); ?>
<input type="hidden" name="sign" value="<?php echo $sign; ?>">
<input type="hidden" name="merchant" value="directpay">
<input type="hidden" name="service" value="banner">
<input type="hidden" name="id_zakaz" value="<?php echo $id_zakaz; ?>" />
<input type="hidden" name="id" value="<?php echo $res['id']; ?>_">
<input type="hidden" name="url" value="<?php echo $url; ?>">
<input type="hidden" name="img" value="<?php echo $img; ?>">
<input type="hidden" name="weeks" value="<?php echo $weeks; ?>">
<input type="hidden" name="buyer" value="<?php echo $_SESSION['user_id']; ?>">
<input type="hidden" name="price" value="<?php echo $price; ?>_">
<input type="hidden" name="auth" value="1">
<input type="hidden" name="sum" value="<?php echo $price; ?>">
<input type="hidden" name="sum_balance" value="<?php echo $users_info['money']; ?>">
<input class="bsistem" type="submit" value="Баланс системы"><span class="comment">(без комиссии)</span>
</form>
</div>
<?php
}
?>
</div>
<?php include 'module/user_menu.php'; ?>
</div>
</div>
<?php
}
else
{
exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true));
}
}
else
{
if (isset($_POST['ids']))
{
$post_id = explode("_", $_POST['ids']);
$specc = isset($_POST['specc']) && $_POST['specc'] == 1 ? 1 : 0;
$place = 0;
$price = 0;
$prices = '';
$ids = '';
$size = '';
$weeks = (int)$_POST['weeks'];
if ($weeks < 1 && $weeks > 4) { exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true)); }
foreach ($post_id as $key => $value)
{
$id = (int)$value;
$query = $mysqli->query("SELECT `sum`, `size`, `url` FROM `".PREFIX."_blocks` WHERE `type` = '2' and `id` = '".$id."' LIMIT 1");
if ($query->num_rows)
{
$res = $query->fetch_assoc();
$size = $res['size'];
$prices .= ($res['sum'] * $weeks).'_';
$price += ($res['sum'] * $weeks);
$place++;
$ids .= $id.'_';
}
}
$size = explode('x', $size);
$url = filter_var($_POST['url'], FILTER_VALIDATE_URL);
if (!$url)
{
exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true));
}
$img = isset($_POST['img']) ? $_POST['img'] : '';
$data_img = getimagesize(BASE_DIR.'/uploads/'.$img);
$comm = sprintf("%.2f", ($price*$obEngine->getConfig('comm_pay'))/100);
$user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : session_id();
$data = array('ids' => $ids, 'url' => $url, 'img' => $img, 'weeks' => $weeks, 'size' => $size);
$data = serialize($data);
$query = $mysqli->query("SELECT `id` FROM `".PREFIX."_history_pay` WHERE `user_id` = '".$user_id."' and `status` = '0' and `type` = '3' LIMIT 1");
if ($query->num_rows)
{
$res_zakaz = $query->fetch_assoc();
$id_zakaz = $res_zakaz['id'];
$mysqli->query("UPDATE `".PREFIX."_history_pay` SET `time_add` = NOW(), `price` = '".$price."', `money` = '".($price+$comm)."', `data` = '".$data."' WHERE `id` = '".$id_zakaz."' and `user_id` = '".$user_id."' and `status` = '0' and `type` = '3' LIMIT 1");
}
else
{
$mysqli->query("INSERT INTO `".PREFIX."_history_pay`
(
`time_add`,
`user_id`,
`type`,
`payment`,
`price`,
`money`,
`wallet`,
`data`,
`status`
)
VALUES
(
NOW(),
'".$user_id."',
'3',
'',
'".$price."',
'".($price+$comm)."',
'',
'".$data."',
'0'
)");
$id_zakaz = $mysqli->insert_id();
}
$desc = base64_encode('Размещение баннеров через сервис '.$_SERVER['HTTP_HOST']);
$arHash = array(ID_SHOP_PAYEER, $id_zakaz, sprintf("%.2f", ($price+$comm)), 'RUB', $desc, SECRET_KEY_PAYEER);
$sign = strtoupper(hash('sha256', implode(':', $arHash)));
?>
<div class="wrapper">
<div class="main">
<div class="m_left">
<div class="m_title">Размещение баннера</div>
<?php
if ($data_img[0] != $size[0] && $data_img[1] != $size[1])
{
?>
<div class="mw-lin nocode" style="width: 620px;"><b>Внимание:</b> Размер загруженного баннера не соответствует размеру баннерного места!</div>
<?php
}
?>
<div class="m_l">Адрес ссылки: <b><?php echo $url; ?></b></div>
<div class="m_l">Файл баннера: <b>http://<?php echo $_SERVER['HTTP_HOST']; ?>/uploads/<?php echo $img; ?></b></div>
<div class="m_l">Результат:</div>
<div class="m_l"><a href="<?php echo $_SERVER['HTTP_HOST']; ?>"><img id="myimage" src="http://<?php echo $_SERVER['HTTP_HOST']; ?>/uploads/<?php echo $img; ?>" height="60" width="468 "></a></div>
<div class="m_l">
<form action="advertise.php?mode=banners" method="post">
<input name="type" type="hidden" value="back">
<input name="url" type="hidden" value="<?php echo $url; ?>">
<input name="img" type="hidden" value="<?php echo $img; ?>">
<button type="submit">Вернуться к поиску</button>
</form>
</div>
<div class="m_l">Выбрано витрин: <b><?php echo $place; ?></b></div>
<div class="m_l">Сумма к оплате: <b><?php echo $price; ?></b> руб.</div>
<div class="m_l">Выберите способ оплаты:</div>
<div class="pay_btn">
<form name="form2" method="post" action="https://merchant.webmoney.ru/lmi/payment.asp">
<input type="hidden" name="LMI_PAYMENT_AMOUNT" value="<?php echo ($price+$comm); ?>">
<input type="hidden" name="LMI_PAYMENT_DESC_BASE64" value="<?php echo $desc; ?>">
<input type="hidden" name="LMI_PAYEE_PURSE" value="<?php echo WMR; ?>">
<input type="hidden" name="LMI_PAYMENT_NO" value="<?php echo $id_zakaz; ?>" />
<input class="wmoney" type="submit" value="Webmoney"><span class="comment">(+<b><?php echo $comm; ?></b> руб. комиссия)</span>
</form>
</div>
<div class="pay_btn">
<form method="GET" action="https://payeer.com/merchant/">
<input type="hidden" name="m_shop" value="<?php echo ID_SHOP_PAYEER; ?>">
<input type="hidden" name="m_orderid" value="<?php echo $id_zakaz; ?>">
<input type="hidden" name="m_amount" value="<?php echo sprintf("%.2f", ($price+$comm)); ?>">
<input type="hidden" name="m_curr" value="RUB">
<input type="hidden" name="m_desc" value="<?php echo $desc; ?>">
<input type="hidden" name="m_sign" value="<?php echo $sign; ?>">
<input type="hidden" name="form[ps]" value="2609">
<input type="hidden" name="form[curr[2609]]" value="RUB">
<input type="submit" class="wmoney" name="m_process" value="Payeer" /><span class="comment">(+<b><?php echo $comm; ?></b> руб. комиссия)</span>
</form>
</div>
<?php
if (isset($_SESSION['user_id']) && $users_info['status'] == 1)
{
?>
<div class="pay_btn">
<form name="form4" method="post" action="result.php" onsubmit="return validate4();">
<?php $sign = md5('banner'.$ids.$url.$img.$weeks.$_SESSION['user_id'].$prices.HASH_MD5); ?>
<input type="hidden" name="sign" value="<?php echo $sign; ?>">
<input type="hidden" name="merchant" value="directpay">
<input type="hidden" name="service" value="banner">
<input type="hidden" name="id_zakaz" value="<?php echo $id_zakaz; ?>" />
<input type="hidden" name="id" value="<?php echo $ids; ?>">
<input type="hidden" name="url" value="<?php echo $url; ?>">
<input type="hidden" name="img" value="<?php echo $img; ?>">
<input type="hidden" name="weeks" value="<?php echo $weeks; ?>">
<input type="hidden" name="buyer" value="<?php echo $_SESSION['user_id']; ?>">
<input type="hidden" name="price" value="<?php echo $prices; ?>">
<input type="hidden" name="auth" value="1">
<input type="hidden" name="sum" value="<?php echo $price; ?>">
<input type="hidden" name="sum_balance" value="<?php echo $users_info['money']; ?>">
<input class="bsistem" type="submit" value="Баланс системы"><span class="comment">(без комиссии)</span>
</form>
</div>
<?php
}
?>
</div>
<?php include 'module/user_menu.php'; ?>
</div>
</div>
<?php
}
else
{
exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true));
}
}
break;
case 'delete':
break;
default:
exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true));
break;
}
}
else
{
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$query = $mysqli->query("SELECT * FROM `".PREFIX."_blocks` WHERE `type` = '2' and `id` = '".$id."'");
if ($query->num_rows)
{
$res = $query->fetch_assoc();
$stats = json_decode($res['stats'], true);
$arr_topic = $obEngine->getConfig('topic');
}
else
{
exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true));
}
$query = $mysqli->query("SELECT `id` FROM `".PREFIX."_banners` WHERE `ident` = '".$id."' and `status` = '1'");
$buy_slots = $query->num_rows;
$buy_slots = $buy_slots < $res['slots'] ? ($res['slots'] - $buy_slots) : '<span style="color: red;">0</span>';
$n = 0;
$d = '';
while($d != date("Y-m-d", strtotime($res['time_add']) - (27*86400)))
{
$d = date("Y-m-d", TIME - ($n * 86400));
if (!isset($stats[$d]))
{
$stats[$d]['view'] = 0;
$stats[$d]['user'] = 0;
}
$n++;
}
?>
<div class="wrapper">
<script src="/js/highcharts.js"></script>
<div class="main">
<div class="m_left">
<div class="m_title">Размещение баннера</div>
<div class="m_img"><img style="border:1px solid #717171;" src="http://mini.s-shot.ru/1200x800/270/jpeg/z100/?<?php echo $res['url']; ?>" /></div>
<div class="m_r_info">
<table align="left" border="0" cellspacing="0" cellpadding="0" class="buy_table deal_table">
<tbody>
<tr><td class="deal_title" width="105">Адрес:</td><td colspan="3" class="deal_mid"><a href=<?php echo $res['url']; ?>><?php echo $res['url']; ?></a></td></tr>
<tr><td class="deal_title" width="105">Тематика:</td><td colspan="3" class="deal_mid"><?php echo $arr_topic[$res['topic']]; ?></td></tr>
<tr><td class="deal_title">Яндекс тИЦ:</td><td colspan="3" class="deal_mid"><?php echo $res['tic']; ?></td></tr>
<tr><td class="deal_title">Google PR:</td><td colspan="3" class="deal_mid"><?php echo $res['pr']; ?></td></tr>
<tr><td class="deal_title">Cвободно мест:</td><td colspan="3" class="deal_mid"><?php echo $buy_slots; ?> из <?php echo $res['slots']; ?></td></tr>
<tr><td class="deal_title" style="background: #5ca300; border: 1px solid #5ca300;">Цена:</td><td colspan="3" class="deal_mid"><?php echo $res['sum']; ?> <?php echo getWord($res['sum'], array('рубль', 'рубля', 'рублей')); ?> за неделю</td></tr>
</tbody>
</table>
</div>
<div class="m_text" style="text-align: justify; word-wrap: break-word;"><b>Описание сайта:</b><br><?php echo $res['text']; ?></div>
<div id="container" style="width: 644px; height: 200px; margin: 0 auto;float:left;padding: 18px 0 0 0;background:#fff;"></div>
<script>
$(function ()
{
$("#container").highcharts(
{
chart:
{
type: "areaspline"
},
title:
{
text: ""
},
legend:
{
layout: "vertical",
align: "left",
verticalAlign: "top",
x: 60,
y: 5,
floating: true,
borderWidth: 1,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || "#FFFFFF"
},
xAxis:
{
categories:
[
"<?php echo strftime("%b, %d", TIME - (27 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (26 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (25 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (24 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (23 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (22 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (21 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (20 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (19 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (18 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (17 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (16 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (15 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (14 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (13 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (12 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (11 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (10 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (9 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (8 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (7 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (6 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (5 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (4 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (3 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (2 * 86400)); ?>","<?php echo strftime("%b, %d", TIME - (1 * 86400)); ?>", "Сегодня"
],
plotBands:
[{
from: -0.5,
to: 10.5,
color: "rgba(64, 74, 86, .03)"
}]
},
yAxis:
{
title:
{
text: ""
}
},
tooltip:
{
shared: true,
},
credits:
{
enabled: false
},
plotOptions:
{
areaspline:
{
fillOpacity: 0.5
}
},
series:
[{
name: "Просмотры",
data: [<?php echo $stats[date("Y-m-d", TIME - (27*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (26*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (25*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (24*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (23*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (22*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (21*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (20*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (19*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (18*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (17*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (16*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (15*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (14*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (13*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (12*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (11*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (10*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (9*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (8*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (7*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (6*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (5*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (4*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (3*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (2*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (1*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME)]['view']; ?>], color: "#e2e1e5"
},
{
name: "Посетители",
data: [<?php echo $stats[date("Y-m-d", TIME - (27*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (26*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (25*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (24*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (23*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (22*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (21*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (20*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (19*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (18*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (17*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (16*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (15*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (14*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (13*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (12*86400))]['view']; ?>,<?php echo $stats[date("Y-m-d", TIME - (11*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (10*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (9*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (8*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (7*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (6*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (5*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (4*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (3*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (2*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME - (1*86400))]['user']; ?>,<?php echo $stats[date("Y-m-d", TIME)]['user']; ?>], color: "#0092a3"
}]
});
});
</script>
<?php
if ($buy_slots > 0)
{
?>
<div class="m_form">
<form name="form1" method="post" action="?mode=preview&id=<?php echo $res['id']; ?>" enctype="multipart/form-data" onsubmit="return validate1();">
<div class="m_l">
<div class="m_name">Адрес ссылки: </div>
<div class="m_pole"><input type="text" id="url" name="url" class="tt" placeholder="http://website.ru" value="<?php echo $url = isset($_POST['url']) ? filter_var($_POST['url'], FILTER_SANITIZE_STRING) : ''; ?>" maxlength="100"></div>
</div>
<div class="m_l">
<div class="m_name">Файл баннера: </div>
<div style="display: inline-block; position: relative; overflow: hidden; width: 514px; margin-left:10px;">
<div id="upload" style="width: 434px; height: 22px; border: 1px solid #a9a9a9; border-right:none; background:#fff; float: left;line-height:20px;text-align:center;">Выберите баннер с вашего компьютера (468 x 60 пикселей)</div>
<div class="submit" style="position: absolute;right:0; width:84px;text-align:center;">Обзор..</div>
<input style="position: absolute; top: 0px; right: 0px; width: 100%; height: 100%; opacity: 0; margin: 0px; padding:0px;cursor:pointer;" type="file" name="file" id="file" >
</div>
</div>
<div class="m_l">
<div class="m_name">Срок размещения:</div>
<div class="m_time">
<select name="weeks">
<option value="1" <?php echo $select = isset($_POST['weeks']) && $_POST['weeks'] == 1 ? 'selected' : ''; ?>>1 неделя</option>
<option value="2" <?php echo $select = isset($_POST['weeks']) && $_POST['weeks'] == 2 ? 'selected' : ''; ?>>2 недели</option>
<option value="3" <?php echo $select = isset($_POST['weeks']) && $_POST['weeks'] == 3 ? 'selected' : ''; ?>>3 недели</option>
<option value="4" <?php echo $select = isset($_POST['weeks']) && $_POST['weeks'] == 4 ? 'selected' : ''; ?>>4 недели</option>
</select>
</div>
</div>
<div class="m_l">
<div class="m_urr"><a href="info.php?mode=terms" target="_blank">Условия размещения рекламы</a></div>
<input type="hidden" name="slots" value="<?php echo $buy_slots; ?>">
<div class="m_btn"><button class="b1" style="float:right;width:86px;text-align:center;">Купить</button></div>
</div>
</form>
</div>
<?php
}
?>
</div>
<?php include 'module/user_menu.php'; ?>
</div>
</div>
<?php
}
?>
<script>
var upload = "";
/*
$("#url").blur(function ()
{
if (this.value=='') this.value='http://website.ru';
});
$("#url").focus(function ()
{
if (this.value=='http://website.ru') this.value='';
});
$("#img").blur(function ()
{
if (this.value=='') this.value='http://website.ru/banner.gif';
});
$("#img").focus(function ()
{
if (this.value=='http://website.ru/banner.gif') this.value='';
});
*/
function refresh1 ( )
{
$("#img").attr("src", document.form1.img.value)
}
function validate1 ( )
{
valid = true;
if ((document.form1.url.value == "") && (upload == false))
{
alert ('Не заполнено поле «Адрес ссылки» и не выбран файл баннера');
valid = false;
}
if ((document.form1.url.value == "") && (valid == true))
{
alert ('Не заполнено поле «Адрес ссылки»');
valid = false;
}
if ((document.form1.url.value == "http://website.ru") && (valid == true))
{
alert ('Следует указать адрес рекламируемого сайта вместо «website.ru»');
valid = false;
}
if ((document.form1.url.value.indexOf('http://') == -1) && (document.form1.url.value.indexOf('https://') == -1) && (valid == true))
{
alert ('Адрес ссылки должен начинаться с «http://» или «https://»');
valid = false;
}
if ((upload == false) && (valid == true))
{
alert ('Не выбран файл баннера');
valid = false;
}
if (valid == true)
{
$('#upload').text('Подождите, идет загрузка баннера');
$('#upload').addClass('progress');
}
return valid;
}
function validate2()
{
valid = true;
if ((document.form2.urle.value == "") && (valid == true))
{
alert ('Не заполенно поле «Адрес ссылки»');
valid = false;
}
if ((document.form2.urle.value == encodeURIComponent("http://website.ru")) && (valid == true))
{
alert ('Следует указать адрес рекламируемого сайта вместо «website.ru»');
valid = false;
}
if ((document.form2.urle.value.indexOf(encodeURIComponent('http://')) == -1) && (document.form2.urle.value.indexOf(encodeURIComponent('https://')) == -1) && (valid == true))
{
alert ('Адрес ссылки должен начинаться с «http://» или «https://»');
valid = false;
}
if ((document.form2.imge.value !== '') && (valid == true))
{
temp = $.ajax ({ url: "fetch.php", type: "POST", data: "mode=check_file&file=" + document.form2.imge.value, async: false }).responseText;
if (temp == 'false')
{
alert ('Данные устарели, обновите страницу');
valid = false;
}
}
return valid;
}
function validate3()
{
valid = true;
if ((document.form3.url.value == "") && (valid == true))
{
alert ('Не заполенно поле «Адрес ссылки»');
valid = false;
}
if ((document.form3.url.value == encodeURIComponent("http://website.ru")) && (valid == true))
{
alert ('Следует указать адрес рекламируемого сайта вместо «website.ru»');
valid = false;
}
if ((document.form3.url.value.indexOf(encodeURIComponent('http://')) == -1) && (document.form3.url.value.indexOf(encodeURIComponent('https://')) == -1) && (valid == true))
{
alert ('Адрес ссылки должен начинаться с «http://» или «https://»');
valid = false;
}
if ((document.form3.imge.value !== '') && (valid == true))
{
temp = $.ajax ({ url: "fetch.php", type: "POST", data: "mode=check_file&file=" + document.form3.imge.value, async: false }).responseText;
if (temp == 'false')
{
alert ('Данные устарели, обновите страницу');
valid = false;
}
}
return valid;
}
function validate4()
{
valid = true;
if ((document.form4.url.value == "") && (valid == true))
{
alert ('Не заполенно поле «Адрес ссылки»');
valid = false;
}
if ((document.form4.url.value == encodeURIComponent("http://website.ru")) && (valid == true))
{
alert ('Следует указать адрес рекламируемого сайта вместо «website.ru»');
valid = false;
}
if ((document.form4.url.value.indexOf('http://') == -1) && (document.form4.url.value.indexOf('https://') == -1) && (valid == true))
{
alert ('Адрес ссылки должен начинаться с «http://» или «https://»');
valid = false;
}
if ((document.form4.img.value !== '') && (valid == true))
{
temp = $.ajax ({ url: "fetch.php", type: "POST", data: "mode=check_file&file=" + document.form4.img.value, async: false }).responseText;
if (temp == 'extinct')
{
alert ('Данные устарели, обновите страницу');
valid = false;
}
}
if ((document.form4.auth.value == 0) && (valid == true))
{
alert ('Для оплаты с баланса необходимо авторизоваться');
valid = false;
}
if ((document.form4.sum.value * 100 > document.form4.sum_balance.value * 100) && (valid == true))
{
alert ('На балансе недостаточно средств');
valid = false;
}
return valid;
}
function validate5 ( )
{
valid = true;
if (document.form6.url.value == "")
{
alert ('Не заполнено поло «Адрес ссылки»');
valid = false;
}
if ((document.form6.url.value == "http://website.ru") && (valid == true))
{
alert ('Следует указать адрес рекламируемого сайта вместо «website.ru»');
valid = false;
}
if ((document.form6.url.value.indexOf('http://') == -1) && (document.form6.url.value.indexOf('https://') == -1) && (valid == true))
{
alert ('Адрес ссылки должен начинаться с «http://» или «https://»');
valid = false;
}
return valid;
}
function validate6 ( )
{
valid = true;
if (upload == false)
{
alert ('Не выбран файл баннера');
valid = false;
}
if (valid == true)
{
$('#upload').text('Подождите, идет загрузка баннера');
$('#upload').addClass('progress');
}
return valid;
}
function confirm1 ()
{
valid = true;
temp = prompt ("Удаление баннера рекламодателя без веских на то оснований, может послужить причиной блокировки счета. Если вы подтверждаете удаление, введите delete", "");
if (temp != "delete")
valid = false;
return valid;
}
function confirm2 ()
{
valid = true;
temp = prompt ("Редактирование баннера рекламодателя без веских на то оснований, может послужить причиной блокировки счета. Если вы подтверждаете редактирование, введите edit", "");
if (temp != "edit")
valid = false;
return valid;
}
function fill1 ()
{
$temp = $('.size option:selected').val();
$temp= 'http://<?php echo $_SERVER['HTTP_HOST']; ?>/promo/dummy/'+$temp+'.jpg';
$('.url_banner').val($temp);
}
var size = (150*1024);
//Предварительная проверка файлов
$('#file').bind(
{
change: function()
{
$.each(this.files, function(i, file)
{
// Отсеиваем не картинки
if (window.FileReader !== null)
{
if (!file.type.match(/image.*/))
{
alert ('Файл не является изображением');
upload = false;
exit;
}
if (file.size > size)
{
alert ('Максимальный размер изображения ' + (size/1024) +'кб');
upload = false;
exit;
}
}
$('#upload').text(file.name);
upload = true;
});
}
});
</script>