<?php
session_start();
include "../header.php";
include "../config.php";
include "../style.php";

$adid = dbput($_GET['adid']);
$seed = dbput($_GET['seed']);

if( isset($_SESSION["ulogin"]) )
{  // members only stuff!

include("navigation.php");
include("../banners2.php");



$viewed=array();
if ( strcasecmp($_REQUEST['submit'],"View All Active")!= 0 )
{
$sql  = "SELECT adid\n";
$sql .= "FROM   clicks\n";
$sql .= "WHERE  userid = '" . $userid . "'\n";
$res  = mysql_query($sql) or die("Query 1 failed");

while ( $row = mysql_fetch_assoc($res) )
{
$adid = $row['adid'];
$viewed[$adid] = 1;
}

//echo "<!-- $userid has viewed " . count($viewed) . " solos ads -->\n";
}




$query3 = "select * from solos where approved=1 and sent=1 ORDER by datesent DESC LIMIT 10";

$result3 = mysql_query ($query3)
or die ("Query failed");
$numrows3 = @ mysql_num_rows($result3);

if ($numrows3 == 0) {
echo "<br><br><p><center><H2><img src='images/readmemberssoloads.png'><br>No Solo Ads to view.</H2></p></center><br><br><br><br><br>";

//echo "<p><center><img src='images/readmemberssoloads.png'></p></center>";
}
else {
echo "<br><p><center><H2><img src='images/readmemberssoloads.png'></H2></p>";
?>

<table width=500 border=0 cellpadding=2 cellspacing=0>


<?
while ($line3 = mysql_fetch_array($result3)) {
$id = $line3["id"];
$subject = dbget($line3["subject"]);
$adbody = dbget($line3["adbody"]);
$url = dbget($line3["url"]);

$name = trim($name);
$firstname = substr($name , 0, strpos($name, " "));

$adbody = str_replace("~fname~", $firstname, $line3["adbody"]);
$adbody = str_replace("~userid~",$userid,$adbody);
$subject = str_replace("~userid~",$userid,$subject);
$subject = str_replace("~fname~",$firstname,$subject);



?>



<tr>


<td bgcolor="#8b4512" width=450><font size=2 face="<? echo $fonttype; ?>" color="#FFFFFF"><b><? echo $subject; ?></b></font></td>
</tr>



<tr>
<td bgcolor="#f5deb3" width=450><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>"><? echo $adbody; ?></font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" width=450><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>">



<?



$result = mysql_query("SELECT * FROM links where adid=".$id." LIMIT 1");

echo "<table align=center border='0'>
";while($row = mysql_fetch_array($result))
{
echo "<tr><td>";
echo "<a href=$domain/clicks.php?userid=$_SESSION[uname]&seed=";
echo "" . $row['number'] . "";
echo "&id=$id target=NEW>";
if ($memtype == "PRO") {
echo "<b>Click here to receive ".$proclickearn." credits</b>";
} elseif($memtype == "JV Member") {
echo "<b>Click here to receive ".$jvclickearn." credits</b>";
} 

else {
echo "<b>Click here to receive ".$superjvclickearn." credits</b>";
}
echo "</a>";
echo "</td></tr>";
}
echo "</table>";


?>




</td>
</tr>

<tr><td><center><br><br>=============================================================<br><br><br></center></td></tr>

<?
}	


echo "</table></center>" ;

}


?>



<?
//include("../banners2.php");
?>





<?

echo "</td></tr></table>";

}

else
{ ?>

<p>You must be logged in to access this site. Please <a href="../memberlogin.php">click here</a> to login.</p>

<? }

include "../footer.php";
mysql_close($dblink);
?>