Files
Testing/include/analytics/bw_adstats.php

110 lines
3.4 KiB
PHP
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
<?php
include_once($_SERVER["DOCUMENT_ROOT"] . '/include/dbinclude.php');
function dbconnect()
{}
$em="";
$conda="";
$searchterm="";
$conda="";
$condb="";
$condc="";
$thefromdate="";
$thetodate="";
if(isset($_POST["search"]))
{
$conda=" AND `bw_ads`.`ad_title` like '%".$_POST["search"]."%' ";
$searchterm=$_POST["search"];
}
$sql="SELECT
`bw_ads`.`ad_id`,
`bw_ads`.`ad_active`,
`bw_ads`.`ad_title`,
`bw_ads`.`ad_category`,
`bw_ads`.`ad_tag`,
`bw_ads`.`ad_views`,
`bw_ads`.`ad_clicks`
FROM
`bw_ads`
WHERE 1 > 0 ".$conda;
$result= $database->database_query($sql) or $em=$em.$database->database_error();
?>
<!doctype html>
<html lang="en-US" class="no-js">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow, noarchive">
<title>Ad Stats</title>
<link rel='stylesheet' id='myers-reset' href='http://bateworld.com/include/analytics/adrotation/css/reset.css?ver=2.0' type='text/css' media='all' />
<script src="/include/analytics/adrotation/js/modernizr.js"></script>
<style>
table {border-collapse:collapse; table-layout:fixed;width:100%;}
table td {border:solid 1px #fab;}
</style>
</head>
<body>
<div style="padding:10px;">
<header>
<h1 style="font-weight:bold;font-size:150%;">Ad Stats</h1>
<div style="margin-bottom:10px;">
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post" name="frmsearch" id="frmsearch" enctype="application/x-www-form-urlencoded">
<label for="Search">Search </label> <input type="search" id="search" name="search" value="<?php echo $searchterm;?>" style="width:300px;" placeholder="Search" pattern="^(?!(?:[a-zA-Z\d]*[_. -]){4})[a-zA-Z\d][\w. -]{2,22}[a-zA-Z\d]$" />
<input type="submit" id="frmsub" name="frmsub" value="GO" />
</form
></div>
</header>
<main>
<section>
<div>
<table>
<thead>
<tr>
<th style="white-space: nowrap;20px;padding:0 2px 0 2px;" align="left" width="50">ID</th>
<th style="word-wrap:break-word;white-space: normal;padding:0 3px 0 3px;" align="left">Title</th>
<th style="word-wrap:break-word;white-space: normal;padding:0 3px 0 3px;" align="left">Tag</th>
<th style="white-space: nowrap;padding:0 2px 0 2px;">Views</th>
<th style="white-space: nowrap;padding:0 2px 0 2px;">Clicks</th>
<th style="white-space: nowrap;padding:0 2px 0 2px;" width="60">CTR</th>
</tr>
</thead>
<tbody>
<?php
$rownum=0;
while ($row = $database->database_fetch_assoc($result)) {
$rownum=$rownum+1;
$adctp="";
if($row["ad_clicks"] > 0 && $row["ad_views"] >0)
{
$adctp=($row["ad_clicks"] / $row["ad_views"]) * 100;
$adctp=number_format((float)$adctp, 2, '.', '');
$adctp=$adctp."%";
}
if($rownum % 2 != 0){$rc="#ffff99";} else{$rc="#fff";}
echo '<tr valign="top" style="background:'.$rc.'" onmouseover="this.style.background=\'#ccffcc\'" onmouseout="this.style.background=\''.$rc.'\'">
<td style="padding:0 2px 0 2px;">'.$row["ad_id"].'</td>
<td style="white-space: normal;padding:0 2px 0 2px;">'.$row["ad_title"].'</td>
<td style="white-space: normal;padding:0 2px 0 2px;">'.$row["ad_tag"].'</td>
<td align="right" style="white-space: normal;padding:0 2px 0 2px;">'.$row["ad_views"].'</td>
<td align="right" style="white-space:normal;padding:0 2px 0 2px;">'.$row["ad_clicks"].'</td>
<td align="right" style="white-space:normal;padding:0 2px 0 2px;" width="60">'.$adctp.'</td>
</tr>';
}
if($rownum==0){echo '<td><p style="text-align:center;font-weight:800;">No Records Returned</div></td>';}
?>
</tbody>
</table>
</div>
</section>
</main>
<footer>
</footer>
</div>
</body>
</html>