<?php
    if(empty($_GET['id'])) { echo 'Params error, please input the tearpage banner id.'; exit; };

    require_once('global_nosession.php');

    $rs = $GLOBALS['db']->Query('select * from `wd_pa_banners` where `bannerid`="'.$_GET['id'].'"');
    if(!$rs || $rs->EOF) {
        echo 'Banner does not exist!';
        exit;
    }
    $url = 'tearpage.php?surl='.$rs->fields['description'].'&burl='.$rs->fields['sourceurl'].'&desturl='.urlencode($rs->fields['destinationurl']).'&scriptsurl=';
?>
<html>
<head>
    <title>Test Tearpage</title>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<script type="text/javascript" src="<?php echo $url; ?>"></script>
</body>
</html>