<TITLE>Member administration</TITLE>
<BODY BGcolor=BLACK TEXT=WHITE ALINK=WHITE VLINK=WHITE LINK=WHITE>

<CENTER>
<FONT SIZE=3>Member Administration:</FONT><BR>
(change user credit)<BR>
<P></P>

<!
$color1="NAVY";
$color2="BLUE";
$color3="#99CCCC";
$color5="#2020FF";
$color4="RED";

$font1="WHITE";

$meseci="Tony Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec";
$mesec=split($meseci, " ");

$ffont1="<FONT FACE=\"Arial, Helvetica\" COLOR=\"GOLD\"><B>";
$ffont2="<FONT FACE=\"Arial, Helvetica\">&nbsp";
$fend="</FONT>";

$sock=msqlConnect();
if ($sock<0) {
   echo("<CENTER><TABLE WIDTH=500 BORDER=2 BGCOLOR=\"$color4\">\n");
   echo("<TR><TD>\n<BR><CENTER>$ERRMSG</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }

if (msqlSelectDB($sock, "MEMBERS")<0) {
   echo("<CENTER><TABLE WIDTH=400 BORDER=2 BGCOLOR=\"$color4\">\n");
   echo("<TR><TD>\n<BR><CENTER>$ERRMSG</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }

$id_us=(int)$id_us;

if ($id_us==0) {
   echo("<CENTER><TABLE WIDTH=500 BORDER=2 BGCOLOR=\"$color4\">\n"); 
   echo("<TR><TD>\n<BR><CENTER>Error occourred. Previous program did not supply ID_US variable.</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }

if (msqlQuery($sock, "SELECT * FROM user_data WHERE id_us=$id_us")<0) {
   echo("<CENTER><TABLE WIDTH=500 BORDER=2 BGCOLOR=\"$color4\">\n");
   echo("<TR><TD>\n<BR><CENTER>$ERRMSG</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }
$fd=msqlStoreResult();
$user_data=msqlFetchRow($fd);
msqlFreeResult($fd);

if (msqlQuery($sock, "SELECT * FROM credits WHERE id_us=$id_us")<0) {
   echo("<CENTER><TABLE WIDTH=500 BORDER=2 BGCOLOR=\"$color4\">\n");
   echo("<TR><TD>\n<BR><CENTER>CREDITS: $ERRMSG</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }
$fd=msqlStoreResult();
$credits=msqlFetchRow($fd);

if (#$credits==0) {
   $credits[1]=$user_data[1];
   $credits[2]="(not authorized)";
   }
if ((int)$credits[2]<0) {
   $credits[2]="REVOKED";
   }
msqlFreeResult($fd);

if (msqlQuery($sock, "SELECT * FROM billing WHERE id_us=$id_us ORDER BY id_bill ASC")<0) {
   echo("<CENTER><TABLE WIDTH=500 BORDER=2 BGCOLOR=\"$color4\">\n");
   echo("<TR><TD>\n<BR><CENTER>$ERRMSG</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }
$fd=msqlStoreResult();
$billing=msqlFetchRow($fd);

if (#$user_data==0) {
   echo("<CENTER><TABLE WIDTH=400 BORDER=2 BGCOLOR=\"$color3\">\n");
   echo("<TR><TD>\n<BR><CENTER>Error occoured.<BR>Can not find any data in BILLING table about this user.</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }

echo("<P>\n<CENTER>\n<BR>\n<P>\n<TABLE WIDTH=530>\n");

echo("<TR><TD WIDTH=100 BGCOLOR=\"$color1\">$ffont1 Username: $fend</TD><TD WIDTH=200 BGCOLOR=\"$color2\">$ffont2<A HREF=\"userinfo.msql?id_us=$id_us\">$user_data[1]</A>$fend</TD>\n");
echo("<TD WIDTH=200 BGCOLOR=\"$color1\">$ffont1 Password:</TD><TD WIDTH=200 BGCOLOR=\"$color2\" COLSPAN=2>$ffont2 $user_data[2] $fend</TD>\n");
echo("<TR><TD BGCOLOR=\"$color1\">$ffont1 Real Name: $fend</TD><TD COLSPAN=4 BGCOLOR=\"$color2\">$ffont2<FONT COLOR=\"$font1\">$user_data[4], $user_data[3] $fend</TD></TR>\n");

while(#$billing>0) {
   echo("<TD><TD></TD></TR>\n");
   echo("<TR><TD BGCOLOR=\"$color1\">$ffont1 Street: $fend</TD><TD COLSPAN=4 BGCOLOR=\"$color2\">$ffont2 $billing[2] $fend</TD></TR>\n");
   echo("<TR><TD BGCOLOR=\"$color1\">$ffont1 Zip, Country: $fend</TD><TD COLSPAN=4 BGCOLOR=\"$color2\">$ffont2 $billing[4], $billing[3] $fend</TD></TR>\n");
   echo("<TR><TD BGCOLOR=\"$color1\">$ffont1 Country: $fend</TD><TD COLSPAN=4 BGCOLOR=\"$color2\">$ffont2 $billing[5] $fend</TD></TR>\n");

   echo("<TR><TD BGCOLOR=\"$color1\">$ffont1 Card type: $fend</TD><TD COLSPAN=2 BGCOLOR=\"$color2\">$ffont2 $billing[6] $fend</TD><TD BGCOLOR=\"$color1\">$ffont1 Card expire:</TD><TD BGCOLOR=\"$color2\">$ffont2 $billing[8] $fend</TD></TR>\n");
   echo("<TR><TD BGCOLOR=\"$color1\">$ffont1 Card No: $fend</TD><TD COLSPAN=2 BGCOLOR=\"$color2\">$ffont2 $billing[7] $fend</TD>\n");
   echo("<TD BGCOLOR=\"$color1\">$ffont1 Amount: $fend</TD><TD BGCOLOR=\"$color2\">$ffont2 $billing[9]\$ $fend</TD></TR>\n");

if (msqlQuery($sock, "SELECT * FROM transaction WHERE id_bill=$billing[0]")<0) {
   echo("<CENTER><TABLE WIDTH=500 BORDER=2 BGCOLOR=\"$color4\">\n");
   echo("<TR><TD>\n<BR><CENTER>CREDITS: $ERRMSG</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }
$fad=msqlStoreResult();
$transaction=msqlFetchRow($fad);

$etb=0;
if (#$transaction==0) {
   echo("<TR><TD COLSPAN=5><CENTER>There is no transactions for this credit card.</CENTER></TD></TR>\n");
   }
else {
   echo("<TR><TD COLSPAN=5><CENTER>Transaction data:<BR><HR WIDTH=50%>\n");
   echo("<TABLE WIDTH=50%>\n");
   $etb=1;
   }

while(#$transaction>0) {
   $god=strseg($transaction[2], 0, 3);
   $mes=strseg($transaction[2], 4, 5);
   $dan=strseg($transaction[2], 6, 7);
   $dat=$dan + " " + $mesec[(int)$mes] + ". " + $god;
   echo("<TR><TD>$dat</TD><TD>$transaction[3]</TD><TD>$transaction[4]\$</TD></TR>\n");
   $transaction=msqlFetchRow($fad);   
   }

if ($etb>0) {
   echo("</TABLE>\n");
   }
echo("</TD></TR>\n");

msqlFreeResult($fad);

$billing=msqlFetchRow($fd);
}
msqlFreeResult($fd);

	$time=time();                      
	$year=(int)strftime("%y", $time);  
	$month=unixtime2month($time);  
	$now=strftime("%Y%m%d", $time);
	$ltime=$credits[3];
	$tdif=(int)$ltime - (int)$now;


echo("<TR><TD COLSPAN=2 BGCOLOR=\"$color1\">Last Visit:&nbsp $credits[3] &nbsp days:&nbsp");
	echo("<strong><font color=\"$color4\">$tdif</font></strong></TD>\n");
echo("<TD BGCOLOR=\"$color1\">Credits:</TD><TD COLSPAN=2 BGCOLOR=\"$color2\">&nbsp $credits[2]</TD></TR>\n");

if ($tdif>= -1) {
	echo("<TD COLSPAN=3 BGCOLOR=\"$color4\">Inactive:</TD></TR>\n");
	}

echo("</TABLE>\n");



msqlClose($sock);
>
