<table align="middle" width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-top: 45px; margin-bottom: 15px;">
<tr>
<td><h4><?php print $lng['ground']; ?> «Media YouTube» - редактировать</h4></td>
</tr>
</table>
<?php
$id = intval($_GET['id']);
if($_GET['act'] == 'save') {
$url = addslashes(htmlspecialchars($_POST['url'], ENT_QUOTES));
$clx = intval($_POST['clx']);
$video = addslashes(htmlspecialchars($_POST['video'], ENT_QUOTES));
$tubelink = intval($_POST['tubelink']);
$stopor = intval($_POST['stopor']);
$adult = intval($_POST[adult]);
$start_time = intval($_POST['start_time']);
$end_time = intval($_POST['end_time']);
$sql = 'SELECT * FROM advert_media WHERE user_id = '.$user_id.' AND id = '.intval($_GET[id]).' LIMIT 1';
$rs = mysql_fetch_array(mysql_query($sql));
$result = mysql_query("SELECT * FROM parametrs WHERE path = 'media' AND geo = '".$rs[geo]."' LIMIT 1");
$row = mysql_fetch_array($result);
if($row) {
$money = $clx * $row[price];
$urls = substr($url, 0, 4);
if($urls != "http") {
$url = "http://".$url;
}
$url = str_replace("www.","", $url);
$durl = parse_url($url);
$www = $durl[host];
if(!$url || $url == "http://") {
print "<p class=\"er\">".$lng['er_enter_url']."!</p>";
} elseif (mysql_num_rows(mysql_query("SELECT * FROM blacklist WHERE lower(url) like lower('%$www%')"))) {
print "<p class=\"er\">".$lng['er_url_bl']."!</p>";
} elseif(!$video || $video == "http://") {
print "<p class=\"er\">".$lng['er_all_input']."! <a href=\"?adv=0\">« ".$lng['back']."</a></p>";
} elseif (mysql_num_rows(mysql_query("SELECT * FROM advert_media WHERE lower(url) like lower('%$url%') AND status = 3"))) {
print "<p class=\"er\">".$lng['er_url_bl']."!</p>";
} elseif ($clx < 0) {
print "<p class=\"er\">".$lng['er_enter_count_clx']."!</p>";
} elseif ($money > $balance) {
print "<p class=\"er\">".$lng['er_no_money']."!</p>";
} elseif($clx < 0) {
print "<p class=\"er\">Количество добавляемых кликов должно быть больше нуля! <a href=\"?adv=0\">« ".$lng['back']."</a></p>";
} else {
$sql = 'SELECT url, status FROM advert_media WHERE user_id = '.$user_id.' AND id = '.$id.' LIMIT 1';
$rs = mysql_query($sql);
$a = mysql_fetch_array($rs);
if($a[url] == $url && $a[status] == 0 && $a[video] == $video) {
$s = 0;
} elseif($status == 1) {
$s = 0;
} elseif($a[status] == 3) {
$s = 3;
} else {
$s = 1;
}
$sql = 'UPDATE advert_media SET url = "'.$url.'", name = "'.$name.'", video = "'.$video.'", tubelink = "'.$tubelink.'", clx = clx + '.$clx.', status = '.$s.', stopor = '.$stopor.', adult = '.$adult.', start_time = '.$start_time.', end_time = '.$end_time.' WHERE user_id = '.$user_id.' AND id = '.$id.' LIMIT 1';
if(mysql_query($sql)) {
print "<p class=\"erok\">".$lng['er_ok']."!</p>";
mysql_query('UPDATE users SET balance = balance - '.$money.', adconcurs = adconcurs + '.$money.' WHERE id = '.$user_id.' LIMIT 1');
?><script type="text/javascript">
location.replace("http://<?php print $cfgURL; ?>/advertise/?adv=0");
</script><?php
} else {
print "<p class=\"er\">".$lng['er_bd']."!</p>";
}
}
}
}
$sql = 'SELECT * FROM advert_media WHERE user_id = '.$user_id.' AND id = '.intval($_GET[id]).' LIMIT 1';
$rs = mysql_query($sql);
if(mysql_num_rows($rs)) {
$a = mysql_fetch_array($rs);
?>
<div style="width:300px; height:274px;margin-bottom:20px;">
<table height="254" cellspacing="0" cellpadding="0" border="0" width="300"><tr style="background: url(/images/adv_top_bg.png) repeat-x !important;"><td><a target="_blank" class="popmedia1" href="http://<?php print $cfgURL; ?>" title="Рекламная сеть <?php print $cfgURL; ?>"><?php print $cfgURL; ?></a></td><td align="right"><a class="close" title="Закрыть баннер"></a></td></tr><tr><td valign="top" colspan="2">
<div>
<div class="flash-container"><div class="flash-container"><embed class="banner" width="300" height="254" style="background-color:#000000 !important;" type="application/x-shockwave-flash" src="http://www.youtube.com/v/<?php print $a['video']; ?>?version=3&feature=player_embedded&autoplay=1&loop=1&end=28&showinfo=0&controls=1" wmode="transparent"></embed><div class="flash-fon" id="click-field"><div class="polosa"><?php print $a['url']; ?></div></div><?php if( $a['tubelink']==1) { ?><div class="rightpolosa"></div><?php } ?></div></div>
</div>
</td></tr></table></div>
<span id="foot">Ролик длится максимум 28 секунд, затем, автоматически, повторяется</br>
При клике сайт открывается в новом окне</span></br>
<form action='?action=edit&add=media&id=<?php print $id; ?>&act=save' method='post' class="front-signup">
<table align="left" width="480" border="0" cellpadding="2" cellspacing="0" style="border-collapse: separate;">
<tr >
<td></font> URL: </td>
<td align="left"><input type='text' name='url' value='<?php print $a['url']; ?>' size='40' maxlength="100" style="width: 200px;" /></td>
</tr>
<tr>
<td colspan="2" height="30"><hr/>
</td>
</tr>
<tr >
<td>Код видео из YouTube</td>
<td align="left"><input name="video" value='<?php print $a['video']; ?>' type="text" size="33" style="width: 200px;"></td>
</tr>
<tr>
<td colspan="2" height="30"><hr/>
</td>
</tr>
<tr>
<td>Убрать ссылку на сайт Youtube</td>
<td align="left"><input type="checkbox" name="tubelink" value="1" <?php if($a[tubelink]) { print "checked"; } ?> /></td>
</tr>
<tr>
<td colspan="2" height="30"><hr/>
</td>
</tr>
<tr >
<td></font> <?php print $lng['dobuy_clx']; ?>: </td>
<td align="left"><input type='text' name='clx' value='1000' size='40' style="width: 200px;" /></td>
</tr>
<tr>
<td colspan="2" height="30"><hr/>
</td>
</tr>
<tr >
<td></font> <?php print $lng['clx_day']; ?> *: </td>
<td align="left"><input type='text' name='stopor' value='<?php print $a['stopor']; ?>' size='40' style="width: 200px;" /></td>
</tr>
<tr>
<td colspan="2" height="30"><hr/>
</td>
</tr>
<tr >
<td> <?php print $lng['time_view']; ?>: </td>
<td align="left">
<select name="start_time" style="width: 120px;">
<option value="0">00:00</option>
<option value="1"<?php if($a[start_time] == 1) { print " selected"; } ?>>01:00</option>
<option value="2"<?php if($a[start_time] == 2) { print " selected"; } ?>>02:00</option>
<option value="3"<?php if($a[start_time] == 3) { print " selected"; } ?>>03:00</option>
<option value="4"<?php if($a[start_time] == 4) { print " selected"; } ?>>04:00</option>
<option value="5"<?php if($a[start_time] == 5) { print " selected"; } ?>>05:00</option>
<option value="6"<?php if($a[start_time] == 6) { print " selected"; } ?>>06:00</option>
<option value="7"<?php if($a[start_time] == 7) { print " selected"; } ?>>07:00</option>
<option value="8"<?php if($a[start_time] == 8) { print " selected"; } ?>>08:00</option>
<option value="9"<?php if($a[start_time] == 9) { print " selected"; } ?>>09:00</option>
<option value="10"<?php if($a[start_time] == 10) { print " selected"; } ?>>10:00</option>
<option value="11"<?php if($a[start_time] == 11) { print " selected"; } ?>>11:00</option>
<option value="12"<?php if($a[start_time] == 12) { print " selected"; } ?>>12:00</option>
<option value="13"<?php if($a[start_time] == 13) { print " selected"; } ?>>13:00</option>
<option value="14"<?php if($a[start_time] == 14) { print " selected"; } ?>>14:00</option>
<option value="15"<?php if($a[start_time] == 15) { print " selected"; } ?>>15:00</option>
<option value="16"<?php if($a[start_time] == 16) { print " selected"; } ?>>16:00</option>
<option value="17"<?php if($a[start_time] == 17) { print " selected"; } ?>>17:00</option>
<option value="18"<?php if($a[start_time] == 18) { print " selected"; } ?>>18:00</option>
<option value="19"<?php if($a[start_time] == 19) { print " selected"; } ?>>19:00</option>
<option value="20"<?php if($a[start_time] == 20) { print " selected"; } ?>>20:00</option>
<option value="21"<?php if($a[start_time] == 21) { print " selected"; } ?>>21:00</option>
<option value="22"<?php if($a[start_time] == 22) { print " selected"; } ?>>22:00</option>
<option value="23"<?php if($a[start_time] == 23) { print " selected"; } ?>>23:00</option>
</select> - <select name="end_time" style="width: 120px;">
<option value="24">00:00</option>
<option value="1"<?php if($a[end_time] == 1) { print " selected"; } ?>>01:00</option>
<option value="2"<?php if($a[end_time] == 2) { print " selected"; } ?>>02:00</option>
<option value="3"<?php if($a[end_time] == 3) { print " selected"; } ?>>03:00</option>
<option value="4"<?php if($a[end_time] == 4) { print " selected"; } ?>>04:00</option>
<option value="5"<?php if($a[end_time] == 5) { print " selected"; } ?>>05:00</option>
<option value="6"<?php if($a[end_time] == 6) { print " selected"; } ?>>06:00</option>
<option value="7"<?php if($a[end_time] == 7) { print " selected"; } ?>>07:00</option>
<option value="8"<?php if($a[end_time] == 8) { print " selected"; } ?>>08:00</option>
<option value="9"<?php if($a[end_time] == 9) { print " selected"; } ?>>09:00</option>
<option value="10"<?php if($a[end_time] == 10) { print " selected"; } ?>>10:00</option>
<option value="11"<?php if($a[end_time] == 11) { print " selected"; } ?>>11:00</option>
<option value="12"<?php if($a[end_time] == 12) { print " selected"; } ?>>12:00</option>
<option value="13"<?php if($a[end_time] == 13) { print " selected"; } ?>>13:00</option>
<option value="14"<?php if($a[end_time] == 14) { print " selected"; } ?>>14:00</option>
<option value="15"<?php if($a[end_time] == 15) { print " selected"; } ?>>15:00</option>
<option value="16"<?php if($a[end_time] == 16) { print " selected"; } ?>>16:00</option>
<option value="17"<?php if($a[end_time] == 17) { print " selected"; } ?>>17:00</option>
<option value="18"<?php if($a[end_time] == 18) { print " selected"; } ?>>18:00</option>
<option value="19"<?php if($a[end_time] == 19) { print " selected"; } ?>>19:00</option>
<option value="20"<?php if($a[end_time] == 20) { print " selected"; } ?>>20:00</option>
<option value="21"<?php if($a[end_time] == 21) { print " selected"; } ?>>21:00</option>
<option value="22"<?php if($a[end_time] == 22) { print " selected"; } ?>>22:00</option>
<option value="23"<?php if($a[end_time] == 23) { print " selected"; } ?>>23:00</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" height="30"><hr/>
</td>
</tr>
<tr >
<td colspan="2" align="center"><input type="checkbox" name="adult" value="1" <?php if($a[adult]) { print "checked"; } ?> /> <?php print $lng['adultadv']; ?></td>
</tr>
<tr>
<td colspan="2" height="30">
</td>
</tr>
</table>
<div style="padding: 15px 0 15px 200px; text-align: left;"><input id="prb-distanse" class="prb-mbut" type='submit' name='submit' value='<?php print $lng['save']; ?>' /></div>
</form>
<?php
} else {
print "<p class=\"er\">".$lng['er_no_auth']."!</p>";
}
?>
<script language="javascript" type="text/javascript">
var setEvent=(function(){
if (window.addEventListener!=null){
return function(obj,eventName,handler){
obj.addEventListener(eventName,handler,false);
}
}else{
return function(obj,eventName,handler){
obj.attachEvent("on"+eventName,handler);
}
}
}());
setEvent(window,"load",function(){
var clickField=document.getElementById("click-field");
setEvent(clickField,"click",function(){
location.href="<?php print $a['url']; ?>";
});
});
</script>