<?php

session_start();

include "../config.php";
include "../header.php";
include "../style.php";
if( isset($_SESSION["alogin"]) ) {
$userid = $_POST['userid'];
    	?><table>
      	<tr>
        <td width="15%" valign=top><br>
        <? include("adminnavigation.php"); ?>
        </td>
        <td valign="top" align="center"><br><br> <?
    	echo "<font size=2 face='$fonttype' color='$fontcolour'><p><b><center>";
        echo "Commission Currently Owed.<br><br>When You Click Pay, It will clear the Members commission from the Site Only.<br>You Still Need to log in and pay your members by your choice of payment company.
        <br> (PayPal, Cash App etc.)";
           $query = "select * from members where commission>0.01 ORDER BY commission DESC";
		$result = mysql_query ($query)
	     	or die ("Query failed");
        $numrows = @ mysql_num_rows($result);
        if ($numrows == 0) {
        	echo "<p><center>No commission payments pending.</p></center>";

        }
        ?>
           <table width=70% border=0 cellpadding=2 cellspacing=2>
        	<tr>
	          <td bgcolor="<? echo $contrastcolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>">Userid</font></center></td>
              <? if ($pay_with['paypal']) { ?>
                <td bgcolor="<? echo $contrastcolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>">Paypal email</font></center></td>
              <? } ?>
              <? if ($pay_with['alertpay']) { ?>
                <td bgcolor="<? echo $contrastcolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>">Cash App</font></center></td>
              <? } ?>
              <? if ($pay_with['safepay']) { ?>
                <td bgcolor="<? echo $contrastcolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>">Zelle Pay</font></center></td>
              <? } ?>
              <? if ($pay_with['moneybookers']) { ?>
                <td bgcolor="<? echo $contrastcolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>">Wise</font></center></td>
              <? } ?>
	          <td bgcolor="<? echo $contrastcolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>">Amount</font></center></td>
              <td bgcolor="<? echo $contrastcolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>">Pay</font></center></td>
	        </tr>
        <?
    	while ($line = mysql_fetch_array($result)) {
			$id = $line["id"];
            $userid = dbget($line["userid"]);
            $commission = dbget($line["commission"]);
            $paypal_email = dbget($line["paypal_email"]);
            $alertpay_email = dbget($line["alertpay_email"]);
            $safepay_email = dbget($line["safepay_email"]);
            $moneybookers_email = dbget($line["moneybookers_email"]);

        ?><tr>
          <td bgcolor="<? echo $basecolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>"><? echo $userid; ?></font></center></td>
          <? if ($pay_with['paypal']) { ?>
          	  <td bgcolor="<? echo $basecolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>"><? echo $paypal_email; ?></font></center></td>
          <? } ?>
          <? if ($pay_with['alertpay']) { ?>
          	  <td bgcolor="<? echo $basecolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>"><? echo $alertpay_email; ?></font></center></td>
          <? } ?>
          <? if ($pay_with['safepay']) { ?>
          	  <td bgcolor="<? echo $basecolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>"><? echo $safepay_email; ?></font></center></td>
          <? } ?>
          <? if ($pay_with['moneybookers']) { ?>
          	  <td bgcolor="<? echo $basecolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>"><? echo $moneybookers_email; ?></font></center></td>
          <? } ?>
          <td bgcolor="<? echo $basecolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>"><? echo $commission; ?></font></center></td>
          <td bgcolor="<? echo $basecolour; ?>"><center><font size=2 face="<? echo $fonttype; ?>" color="<? echo $fontcolour; ?>"><center><br>
          <form method=POST action=payout.php>
          <input type="hidden" name="userid" value="<? echo $userid; ?>">
          <input type="hidden" name="id" value="<? echo $id; ?>">
          <input type="submit" value="Pay">
          </form> </center>
          </td></tr> <?
        }
        echo "</table></center>" ;
        echo "</td></tr></table>";

  }
else
	echo "Unauthorised Access!";

include "../footer.php";

?>