<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com � 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "../includes/config.php";
include "../includes/session.php";
include "../includes/functions.php";

if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE); 
} 

if(isset( $_SESSION["sess_affiliateid"]) and $_SESSION["sess_affiliateid"]!= ""){
	$affiliateid = $_SESSION["sess_affiliateid"];
}else{
	header("Location:login.php");
	exit;
}
if (isset($_GET["rid"]) and $_GET["rid"] != "") {
    $rid = $_GET["rid"];
} else if (isset($_POST["rid"]) and $_POST["rid"] != "") {
    $rid = $_POST["rid"];
} 
$sql=" SELECT ar.*,ap.payment_date,ap.payment_method FROM ".$tableprefix."affiliate_registrations ar LEFT JOIN  ".$tableprefix."affiliate_payments ap ON ar.affiliate_payment_id = ap.affiliate_payment_id
		WHERE ar.affiliate_id = '".addslashes($affiliateid)."' AND ar.registration_id = '".addslashes($rid)."'
	";
	
//echo $sql;
$rs = mysql_query($sql);
if(mysql_num_rows($rs)!= 0){
	$row = mysql_fetch_array($rs);
	$txtUserName= $row["user_name"];
	$txtRegistrationDate = (isNotNull($row["registration_date"] and ($row["registration_date"]!= "0000-00-00")) ? dateFormat($row["registration_date"],"Y-m-d","m/d/Y") : "");
	$txtUserFullName = $row["user_first_name"];
	$txtUserFullName.= $row["user_last_name"]!=""? " ".$row["user_last_name"]:"";
	$txtReferralCharge = $row["referral_charge"];
	$txtUserEmail  = $row["user_email"];
	$txtPaid = $row["affiliate_payment_id"]!=""? "Yes":"No";
	$txtPaymentDate = (isNotNull($row["payment_date"] and ($row["payment_date"]!= "0000-00-00")) ? dateFormat($row["payment_date"],"Y-m-d","m/d/Y") : "Administrator Not yet settled payment");
	$txtPaymentMathod =$row["payment_method"]; 
}else{
	header("Location:registrations.php");
	exit;
}
include "../includes/htmltop.php";
?>


<body>
		
		<center>
		
		<div align="left" id="layout">
		
		
				
				
				<!--header area start -->
<?php

	include_once("../includes/topheader_affiliate.php")

?>
				
				<!--header area end -->
				
				
				
				
				<div align="left" class="main_body">
				<!--main body start -->
				
				
				
<?php
		include_once("../includes/afftopmenu.php")
?>		
																					
								
					<div align="left" class="content_area">
					
					<!--content area start -->
							
					<div align="left" class="page_title"><?php echo TEXT_REG_DTLS;?></div>
					<div align="center" class="text_information grey_tr"><?php echo $message?></div>
            		<br>
											
					<div align="left">		
		
					<form name="frmProfile" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
					<input type="hidden" name="userid" value="<?php echo htmlentities($affiliateid);?>">
						<table cellpadding="0" cellspacing="0" width="100%" class="manage_table">
							<tr><td colspan="3" class="message" align="left"><?php echo $message;?></td></tr>
							<tr><td width="20%" align="left" ><?php echo TEXT_USER_NAME;?></td>
							<td width="3%">:</td>
							<td width="77%" align="left" class="innertextCopy2"><?php echo htmlentities($txtUserName);?></td></tr>
							<tr><td align="left" ><?php echo TEXT_USR_FULNAME;?></td><td width="3%">:</td>
							<td align="left" class="innertextCopy2"><?php echo htmlentities($txtUserFullName);?></td></tr>
							<tr><td align="left" ><?php echo TEXT_USR_EMAIL;?></td><td width="3%">:</td>
							<td align="left" class="innertextCopy2"><?php echo htmlentities($txtUserEmail);?></td></tr>
							<tr><td align="left" ><?php echo TEXT_REF_CHARG;?></td><td width="3%">:</td>
							<td align="left" class="innertextCopy2"><?php echo number_format($txtReferralCharge, 2, '.', ''); ?></td></tr>
							<tr><td align="left" ><?php echo TEXT_PAID;?></td><td width="3%">:</td>
							<td align="left" class="innertextCopy2"><?php echo htmlentities($txtPaid);?></td></tr>
<?php
	if($txtPaid == "Yes")
	{
?>
<tr>
  <td align="left" ><?php echo TEXT_PAYMNT_DT;?></td>
  <td width="3%">:</td>
<td align="left" class="innertextCopy2"><?php echo htmlentities($txtPaymentDate);?></td></tr>
<?php if($txtPaymentMathod!='') { ?>
<tr>
  <td align="left" ><?php echo TEXT_PAYMNT_METHOD;?></td>
  <td width="3%">:</td>
<td align="left" class="innertextCopy2"><?php echo htmlentities($txtPaymentMathod);?></td></tr>
<?php
 }
}
?>
							<tr><td colspan="3">&nbsp;</td></tr>
							<tr><td colspan="3" align="center"><input type="button" class="button" value="<?php echo BTN_BACK;?>" name="btnBack" onClick="history.go(-1);" ></td></tr>
						</table>
					</form>
					
					</div>
						
						
				<!--content area end-->
								
				</div>
				
								
					<div align="left" class="clear_float"><img src="<?php echo $imagefolder;?>/clear.gif" alt="" width="1" height="1" /></div>
				<!--main body end -->
				</div>
				
				
<?php
	include "../includes/footer.php";
?>