echo "<fieldset>
<legend> ONLINE TO CREDITS EXCHANGER </legend>
<table align=\"center\" border=\"0\" width=\"500\"><tr><td align=\"center\">";
if(!isset($_SESSION['user_auth_id'])) { die("You need to be logged in."); }
$hour = $core_db2->Execute("Select OnlineHours from MEMB_STAT where memb___id=?",array($_SESSION['user_auth_id']));
$hours = $hour->fields[0];
if(!isset($_POST['agree']))
{
echo "<form action=\"\" method=\"post\" name=\"module\">
<table style=\"padding-left: 10px;\" border=\"0\" cellpadding=\"0\" cellspacing=\"4\" width=\"100%\">
<tbody><tr>
<td align=\"left\">Your Online Hours : <b><font color=\"#2e9e1b\">";
echo ($hours == "") ? $hours = "0" : $hours;
echo "</font></b></td>
</tr>
<tr>
<td align=\"left\">You Will Get : <b><em>";
$k = $hours*10;
echo $k;
echo "<font color=\"red\">Credits</font></em></b></td>
</tr>
<tr>
<td align=\"left\"><div align=\"right\"><strong>
<input name=\"agree\" type=\"submit\" id=\"agree\" value=\"Exchange\">
</strong></div></td>
</tr>
</tbody></table>
</form>";
}
else
{
$hr = $core_db2->Execute("Select OnlineHours from MEMB_STAT where memb___id=?",array($_SESSION['user_auth_id']));
$hh = $hr->fields[0];
$mm = $core_db2->Execute("Select connectstat from MEMB_STAT where Memb___id=?",array($_SESSION['user_auth_id']));
if($mm->fields[0] == "1")
{
die("<strong>You need to be <font color=red>OFFLINE</font> before you trade your hours.</strong>");
}
$credit = $core_db2->Execute("Select Credits from MEMB_CREDITS where memb___id=?",array($_SESSION['user_auth_id']));
$k = $hh * 10 + $credit->fields[0];
$core_db->Execute("Update MEMB_CREDITS set Credits=? where memb___id=?",array($k,$_SESSION['user_auth_id']));
$core_db2->Execute("Delete from MEMB_STAT where memb___id=?",array($_SESSION['user_auth_id']));
$hrr = $core_db2->Execute("Select OnlineHours from MEMB_STAT where memb___id=?",array($_SESSION['user_auth_id']));
$hhh = $hrr->fields[0];
echo "<strong>You have now <font color=\"red>\"".$k." Credits</font> and <font color=\"red\">0</font> Online Hours</strong>";
}
echo "</td></tr></table></fieldset>";