<?php
session_start();

header( 'Content-type: text/html; charset=windows-1251' );

if (!isset($_SESSION["username"]) && !isset($_SESSION["password"])) {
	exit();
}

include_once '../sfb.php';

if ($user_status != 'admin') {
    exit();
}

/*if ($_SERVER["HTTP_X_REQUESTED_WITH"] != "XMLHttpRequest") {
    exit();
}*/
/*if ($_SESSION['dyn'] == 'dyn') {
    exit();
}*/

if ($_GET['func'] == 'dyn') {
    $dynid = intval($_GET['id']);
    $er = mysql_fetch_array( mysql_query( "SELECT timer, url FROM tb_ads WHERE id = '$dynid' and modered = 0" ) );
    
    if($er['timer'] == 0) {$er['timer'] = 20;}
    if($er['timer'] == 1) {$er['timer'] = 30;}
    if($er['timer'] == 2) {$er['timer'] = 40;}
    if($er['timer'] == 3) {$er['timer'] = 50;}
    if($er['timer'] == 4) {$er['timer'] = 60;}
    
    ?>
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
    <meta name="keywords" content="реклама,продвижение,раскрутка,оптимизация,сео,серфинг,тесты,опросы,задания" />
    <meta name="title" content="Webid" />
    <meta name="copyright" content="Webid" />
    <title>Webid - система раскрутки сайтов</title>
    <script type="text/javascript" src="../theme/js/jquery.min.js"></script>
    </head>
    <body  onload="start_time();">
    <style type="text/css">
    body {
        padding: 0px;
        margin: 0px;
        font-family: Tahoma;
        height: 100%;
        overflow: hidden;
        font-size: 11px;
    }
    #timer {
        color: #8D950B;
        font-size: 14px;
    }
    .dynview {
        font-size: 11px;
        height: 60px;
    }
    .big_btn {
        display: inline-block;
        background: url(../theme/images/big_btn.png) 0 -54px;
        padding: 4px 7px;
        color: #212121;
        text-decoration: none;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        -khtml-border-radius: 3px;
        border-radius: 3px;
        border: 0;
        border-top: 1px solid #f6f6f6;
        border-bottom: 1px solid #bfbfbf;
        -moz-box-shadow: 0 0 2px rgba(0,0,0,0.2);
    	-webkit-box-shadow: 0 0 2px rgba(0,0,0,0.2);
        -khtml-box-shadow: 0 0 2px rgba(0,0,0,0.2);
        box-shadow: 0 0 2px rgba(0,0,0,0.2);
        text-shadow: 0 1px 0 #fafafa;
        font-size: 11px;
    }
    .big_btn:hover {
        background: url(../theme/images/big_btn.png) 0 -27px;
    }
    .frame {
        font-size: 11px;
    }
    .imgcap {
        border: 1px solid #808080;
        -moz-box-shadow: 0 0 2px rgba(0,0,0,0.5);
    	-webkit-box-shadow: 0 0 2px rgba(0,0,0,0.5);
        -khtml-box-shadow: 0 0 2px rgba(0,0,0,0.5);
        box-shadow: 0 0 2px rgba(0,0,0,0.5);
    }
    </style>
    <script type="text/javascript">
    var tm;
    var t = <?=$er['timer']?>;
    clearInterval(tm);
    function refr_time() {
        if (t > 0) {
            t--;
            $('#timer').html('<span style="font-size:11px; color:#212121">Пожалуйста подождите</span> '+t+' <span style="font-size:11px; color:#212121">сек</span>');
        } else
        if (t == 0) {
            clearInterval(tm);
            $('#timer').remove();
        }
    }
    function start_time() {
        tm = setInterval('refr_time();',1000);
    }
    
    $(document).ready(function(){
        function getClientHeight() {
            return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
        }

        $('#framesite').css({height: getClientHeight()-80});
    })
    </script>
    <div style="background: url(theme/images/bg.jpg); padding: 10px 5px; border-bottom: 1px solid #212121; height: 60px;">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="dynview">
        <tr>
            <td width="30"></td>
            <td><div id="timer">Дождитесь загрузки сайта</div><div id="code" style="display: none;"><table width="250" border="0" class="frame"><tr><td style="padding-top: 4px;"><img src="image.php?<?=$res; ?>" class="imgcap" /></td><td><input class="big_btn" name="code" value="1" type="submit" /><input class="big_btn" name="code" value="2" type="submit" /><input class="big_btn" name="code" value="3" type="submit" /><input class="big_btn" name="code" value="4" type="submit" /><br /><input class="big_btn" name="code" value="5" type="submit" /><input class="big_btn" name="code" value="6" type="submit" /><input class="big_btn" name="code" value="7" type="submit" /><input class="big_btn" name="code" value="8" type="submit" /></td></tr></table></div></td>
        </tr>
    </table>
    </div>
    <iframe src="<?=$er['url']?>" width="100%" id="framesite" frameborder="0" scrolling="yes"></iframe>
    </body>
    </html>
    <?
}
if ($_GET['func'] == 'pmails') {
    $pmid = intval($_GET['id']);
    $er = mysql_fetch_array( mysql_query( "SELECT timer, url, many FROM seo_paymails WHERE id = '$pmid' and modered = 0" ) );
    ?>
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
    <meta name="keywords" content="реклама,продвижение,раскрутка,оптимизация,сео,серфинг,тесты,опросы,задания" />
    <meta name="title" content="Webid" />
    <meta name="copyright" content="Webid" />
    <title>Webid - система раскрутки сайтов</title>
    <script type="text/javascript" src="../theme/js/jquery.min.js"></script>
    </head>
    <body  onload="start_time();">
    <style type="text/css">
    body {
        padding: 0px;
        margin: 0px;
        font-family: Tahoma;
        height: 100%;
        overflow: hidden;
        font-size: 11px;
    }
    #timer {
        color: #8D950B;
        font-size: 14px;
    }
    .dynview {
        font-size: 11px;
        height: 60px;
    }
    .big_btn {
        display: inline-block;
        background: url(../theme/images/big_btn.png) 0 -54px;
        padding: 4px 7px;
        color: #212121;
        text-decoration: none;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        -khtml-border-radius: 3px;
        border-radius: 3px;
        border: 0;
        border-top: 1px solid #f6f6f6;
        border-bottom: 1px solid #bfbfbf;
        -moz-box-shadow: 0 0 2px rgba(0,0,0,0.2);
    	-webkit-box-shadow: 0 0 2px rgba(0,0,0,0.2);
        -khtml-box-shadow: 0 0 2px rgba(0,0,0,0.2);
        box-shadow: 0 0 2px rgba(0,0,0,0.2);
        text-shadow: 0 1px 0 #fafafa;
        font-size: 11px;
    }
    .big_btn:hover {
        background: url(../theme/images/big_btn.png) 0 -27px;
    }
    .frame {
        font-size: 11px;
    }
    .imgcap {
        border: 1px solid #808080;
        -moz-box-shadow: 0 0 2px rgba(0,0,0,0.5);
    	-webkit-box-shadow: 0 0 2px rgba(0,0,0,0.5);
        -khtml-box-shadow: 0 0 2px rgba(0,0,0,0.5);
        box-shadow: 0 0 2px rgba(0,0,0,0.5);
    }
    </style>
    <script type="text/javascript">
    var tm;
    var t = <?=$er['timer']?>;
    clearInterval(tm);
    function refr_time() {
        if (t > 0) {
            t--;
            $('#timer').html('<span style="font-size:11px; color:#212121">Пожалуйста подождите</span> '+t+' <span style="font-size:11px; color:#212121">сек</span>');
        } else
        if (t == 0) {
            clearInterval(tm);
            $('#timer').remove();
        }
    }
    function start_time() {
        tm = setInterval('refr_time();',1000);
    }
    
    $(document).ready(function(){
        function getClientHeight() {
            return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
        }

        $('#framesite').css({height: getClientHeight()-80});
    })
    </script>
    <div style="background: url(theme/images/bg.jpg); padding: 10px 5px; border-bottom: 1px solid #212121; height: 60px;">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="dynview">
        <tr>
            <td width="30"></td>
            <td><div id="timer">Дождитесь загрузки сайта</div><div id="code" style="display: none;"><table width="250" border="0" class="frame"><tr><td style="padding-top: 4px;"><img src="image.php?<?=$res; ?>" class="imgcap" /></td><td><input class="big_btn" name="code" value="1" type="submit" /><input class="big_btn" name="code" value="2" type="submit" /><input class="big_btn" name="code" value="3" type="submit" /><input class="big_btn" name="code" value="4" type="submit" /><br /><input class="big_btn" name="code" value="5" type="submit" /><input class="big_btn" name="code" value="6" type="submit" /><input class="big_btn" name="code" value="7" type="submit" /><input class="big_btn" name="code" value="8" type="submit" /></td></tr></table></div></td>
        </tr>
    </table>
    </div>
    <iframe src="<?=$er['url']?>" width="100%" id="framesite" frameborder="0" scrolling="yes"></iframe>
    </body>
    </html>
    <?
}
?>