<?php


include "../inc/session.php";
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
include "../config.php";
include "../inc/memberfunctions.php";
include "../inc/functions.php";
include "../header.php";
include "navigation.php";
include "../banners2.php";
include "../style.php";
expandable();
echo "<font size=5 face='$fonttype' color='$fontcolour'><p><center>";
echo "<H4 align=center><b>Unread Credit Emails</b></H4></font>";
echo "<align=center><b>Earn Credits for Clicking Credit Mails</b><br><br><br>";
?>



<table align=center width=90% bgcolor=#000000 border=0 cellpadding=2 cellspacing=1>
<tr>
<td colspan=3 bgcolor="<? echo $nav_bg; ?>"> 
<div style="text-align:left;width:75%;font-size:18px;float:left;font-weight: bold;">View Credit Mails  [<a title="show/hide" id="mcredit_link" href="javascript: void(0);" onclick="toggle(this, 'mcredit');"  style="text-decoration: strong; color: #000000; ">-</a>]</div>
</td>
</tr>
</table>
<?php echo openchart("mcredit"); ?>
<table align=center width=95% bgcolor=#000000 border=0 cellpadding=1 cellspacing=1>
<tr>
<td bgcolor="#CCCCCC">
<?php
echo "<div id=\"displaymcredit\">";
$mcreditresult = mcreditquery($userid);
$mcredit_row_count = mysql_num_rows($mcreditresult);


$mcreditearn=adearn(22,$userid,$memtype,"");
if($mcredit_row_count) {
echo "<H2 align=\"center\">You have unread credit mails to view</H2>";
echo "<table width=100% border=0 cellpadding=2 cellspacing=0>";

while ($mcreditrow = mysql_fetch_array($mcreditresult)) {
$mcid = $mcreditrow["id"];
}
$mcreditprocessresult = mcreditprocess($mcid);
while($mcreditline = mysql_fetch_array($mcreditprocessresult)) {
$id = $mcreditline["id"];
$subject = $mcreditline["subject"];
$subject2 = truncat($subject, 60);
$message = $mcreditline["message"];
$url = $mcreditline["url"];
$num = $mcreditline["num"]; 
$name = trim($name);
$firstname = substr($name , 0, strpos($name, " "));
$soloadbody = str_replace("~userid~",$userid,str_replace("~fname~", $name, $mcreditline["message"]));
$solosubject = truncat($mcreditline["subject"], 60);
$solosubject2 = str_replace("~userid~",$userid,str_replace("~fname~",$name,$solosubject));
?>
<tr>
<td bgcolor="#000000"><font size=3 face="<?php echo $fonttype; ?>" color="#FFFFFF"><b><?php echo $solosubject2; ?></b></font></td>
</tr>
<tr>
<td bgcolor="#E6E8FA"><font size=2 face="<?php echo $fonttype; ?>" color="<?php echo $fontcolour; ?>"><div style="width: 550px; height: 200px; padding: 4px; overflow:auto; border-style: solid; border-size: 1px; border-color: #000000; background: #ffffff;"><?php echo stripslashes($soloadbody); ?></div></font></td>
</tr>
<?php
echo "<tr><td bgcolor=\"#E6E8FA\">";
echo "<a href=/earn.php?t=22&u=$uid&adid=$id&num=$num target=NEW>";
echo "<center><b>^^Click here to view this website for ".$mcreditearn." credits^^</b></center></a>";
echo "</td></tr>";
echo "<tr><td bgcolor=\"#E6E8FA\"><br><br><br></td></tr>";
}

echo "</table></center>" ;
} else echo "<p><center>No credit mails to view.</p></center>";
echo "</font></td></tr></table><div align=center><br /><button type=\"button\" onclick=\"showmcredit(this.value)\" value=\"mcredit\">Load New Ads</button></div></div></div>";
echo chartclose("mcredit");
echo "<br><br></font>";




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

$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
#echo 'Page generated in '.$total_time.' seconds.'; 

include "../footer.php";
?>