/* $Id: config.inc.php3,v 1.17 2000/04/24 14:36:22 tobias Exp $ */
// MySQL hostname
$phpAds_hostname = "217.115.112.112";
// MySQL username
$phpAds_mysqluser = "sharewatch";
// MySQL password
$phpAds_mysqlpassword = "euro12munster34";
// The database phpAds lives in
$phpAds_db = "phpadserver";
// phpAds' database tables
$phpAds_tbl_adclicks = "adclicks";
$phpAds_tbl_adviews = "adviews";
$phpAds_tbl_banners = "banners";
$phpAds_tbl_clients = "clients";
$phpAds_tbl_session = "session";
$phpAds_tbl_acls = "acls";
// The URL to your phpAds-installation
$phpAds_url_prefix = "http://www.sharewatch.com/cgi-bin/phpAds";
// Use INSERT DELAYED in logging functions?
$phpAds_insert_delayed = false;
// Your language file
$phpAds_language = "english";
// Enabled logging of adviews?
$phpAds_log_adviews = true;
// Enabled logging of adclicks?
$phpAds_log_adclicks = true;
// Admins's username
$phpAds_admin = "sharewatch";
// Admin's password
$phpAds_admin_pw = "siranto";
// Admin's full name (used when sending stats via email)
$phpAds_admin_fullname = "advert admin";
// Admin's email address (used to set the FROM-address when sending email)
$phpAds_admin_email = "ger@sharewatch.com";
//Mail Headers for the reflection of the sender of the daily ad reports
$phpAds_admin_email_headers = "From: $phpAds_admin_email \n";
// The name of this application
$phpAds_name = "phpAds";
// Hosts to ignore (don't count adviews coming from them)
$phpAds_ignore_hosts = array(); // Example: array("slashdot.org", "microsoft.com");
// Reverse DNS lookup remotes hosts?
$phpAds_reverse_lookup = true;
// Disable magic_quotes_runtime - don't change
set_magic_quotes_runtime(0);
?>
/* $Id: view.inc.php3,v 1.22 2000/04/24 14:58:37 tobias Exp $ */
// Get a banner
function get_banner($what, $clientID, $context=0)
{
global $phpAds_db, $REMOTE_HOST, $phpAds_tbl_banners, $REMOTE_ADDR, $HTTP_USER_AGENT;
$where = "";
if($context == 0)
{
$context = array();
}
for($i=0; $i";
if($withtext && !empty($row["bannertext"]))
{
echo "
\n".$row["bannertext"]."";
}
}
}
log_adview($row["bannerID"]);
return($row["bannerID"]);
}
function view_t($what, $target = "")
{
view ($what, $target, 1);
}
?>
function acl_check($request, $row) {
global $phpAds_tbl_acls;
global $phpAds_db;
$bannerID = $row['bannerID'];
if (($res = mysql_db_query($phpAds_db, "SELECT * FROM $phpAds_tbl_acls
WHERE bannerID = $bannerID ORDER by acl_order ")) == 0){
return(0);
}
while ($aclrow = mysql_fetch_array($res)) {
switch ($aclrow['acl_type']) {
case 'clientip':
$result = acl_check_clientip($request, $aclrow);
break;
case 'useragent':
$result = acl_check_useragent($request,
$aclrow);
break;
case 'weekday':
$result = acl_check_weekday($request,
$aclrow);
break;
default:
return(0);
}
if ($result != -1) {
return($result);
}
}
return(1);
}
function acl_check_weekday($request, $aclrow) {
$data = $aclrow['acl_data'];
$day = $request['weekday'];
if ($day == $data) {
switch ($aclrow['acl_ad']) {
case 'allow':
return(1);
case 'deny';
return(0);
default:
return(-1);
}
}
return(-1);
}
function acl_check_useragent($request, $aclrow) {
$data = $aclrow['acl_data'];
$agent = $request['user_agent'];
if (eregi($data, $agent)) {
switch ($aclrow['acl_ad']) {
case 'allow':
return(1);
case 'deny';
return(0);
default:
return(-1);
}
}
return(-1);
}
function acl_check_clientip($request, $aclrow) {
$data = $aclrow['acl_data'];
$host = $request['remote_host'];
list ($net, $mask) = explode('/', $data);
$net = explode('.', $net);
$pnet = pack('C4', $net[0], $net[1], $net[2], $net[3]);
$mask = explode('.', $mask);
$pmask = pack('C4', $mask[0], $mask[1], $mask[2], $mask[3]);
$host = explode('.', $host);
$phost = pack('C4', $host[0], $host[1], $host[2], $host[3]);
if (($phost & $pmask) == $pnet) {
switch ($aclrow['acl_ad']) {
case 'allow':
return(1);
case 'deny';
return(0);
default:
return(-1);
}
}
return(-1);
}
?>
$db=mysql_connect("localhost", "sharewatch" , "euro12munster34"); ?>