<?php

session_start();
include "config.php";

$days=$linkgood;   //modify value when required
$secs=86400*$days;
$time=time();

if (empty($seed)) {
 $top = "hpclicks2.php?message=".urlencode("Invalid click link .");
}
if (empty($userid)) {
 $top = "hpclicks2.php?message=".urlencode("Invalid click link ..");
}
if (empty($id)) {
 $top = "hpclicks2.php?message=".urlencode("Invalid click link ...");
}
$query = "select * from hplinks where adid=".$id." and number=".$seed;
$result = mysql_query ($query)
             or die ("Invalid Click Link");
$numrows = @ mysql_num_rows($result);
if ($numrows == 1) {
    
   $expire=mysql_fetch_row(mysql_query("SELECT datesent from hpsolos where id='".$id."' LIMIT 1"));
   $expiread=$expire[0]+$secs;
   if($time>$expiread)
 {
 $top = "hpclicks2.php?message=".urlencode("Link Expired");
    }
 else{
 $url = mysql_result(mysql_query("select url from hpsolos where id='".$id."' AND datesent>'$expires' LIMIT 1"), 0, 'url');
    $query1 = "select * from hpclicks where userid='".$userid."' and number=".$seed;
    $result1 = mysql_query ($query1)
              or die ("Query failed");
 $numrows1 = @ mysql_num_rows($result1);
    if ($numrows1 == 1) {
      $top = "hpclicks2.php?message=".urlencode("You have already received credit for this link")."&url=".urlencode($url);
    }  //end if ($numrows1 ==1)
    else {
 
     $query3 = "select * from members where userid='".$userid."'";
  $result3 = mysql_query ($query3)
              or die ("Query failed");
        $line3 = mysql_fetch_array($result3);
  $memtype = $line3["memtype"];
  
        if ($memtype == "PRO") {
   $top = "hpclicks2.php?credit=".$prohpclickearn."&seed=".$seed."&adid=".$id."&userid=".$userid."&url=".urlencode($url);
        }
        elseif ($memtype == "JV Member") {
            $top = "hpclicks2.php?credit=".$jvhpclickearn."&seed=".$seed."&adid=".$id."&userid=".$userid."&url=".urlencode($url);
        }  elseif ($memtype == "SUPER JV") {
            $top = "hpclicks2.php?credit=".$superjvhpclickearn."&seed=".$seed."&adid=".$id."&userid=".$userid."&url=".urlencode($url);
        }
        //set this for single window
        if(!isset($_SESSION['adclickid']) || $_SESSION['adclickid'] == 'done' || time() - $_SESSION['adclickidtime'] >10){
        	$_SESSION['adclickid'] = 'hpclicks'.$id;
        	$_SESSION['adclickidtime'] = time();
        }
  
    }
} 
}//end if ($numrows == 1)
else {
 $top = "hpclicks2.php?message=".urlencode("Invalid click link ....");
}

if(empty($url)) $url = $domain;
mysql_close($dblink);
?>
<html>
<head>
  <title><? echo $sitename; ?> - HP Solo Ads</title>
	<style  TYPE="text/css">
    <!--
    BODY {

        background-color: #CC9966;
        margin-top: 0px;
		margin-bottom: 0px;
		}
	-->
    </style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta NAME="keywords" CONTENT="ad exchange, ad exchanges, free ad exchange, free ad exchanges, text exchange, free text exchange, text exchanges, free text exchanges, advertise, advertise free, advertising, free advertising, market, marketing, promote, promote free, market free, free marketing, free promotion, traffic, guaranteed traffic, free guaranteed traffic, free traffic, free hits, safelist, safelists, free safelist, free safelists, network marketing, free network marketing, affiliate marketing, free affiliate marketing, affiliate, affiliates, free affiliate program, free affiliate programs, affiliate program, affiliate programs, list builder, list builders, free list builder, free list builders, leads, free leads, free business leads, business leads, viral marketing, referrals, free referrals, referral builder, referral builders, free referral builder, free referral builders, banner advertising, post free ads, submit free ads">
<META NAME="Description" Content="Drive quality traffic to your site and boost your sales! Free advertising solutions.">
<link rel="shortcut icon" href="/favicon.ico">

</head>
  <frameset ROWS="145,*" BORDER=0 FRAMEBORDER=1 FRAMESPACING=0>
  <frame name="header" scrolling="no" noresize marginheight="1" marginwidth="1" target="main" src="<? echo $top; ?>">
  <frame name="main" src="<? echo $url; ?>">
  </frameset>
</html>