<?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( $_GET["aid"]) and $_GET["aid"]!= ""){
	$aid = $_GET["aid"];
}elseif(isset( $_POST["aid"]) && $_POST["aid"]!= ""){
	$aid = $_POST["aid"];
}elseif(isset($_SESSION["aid"]) && $_SESSION["aid"]!= ""){
    $aid = $_SESSION["aid"];
}

if($aid != ''){
    $_SESSION["aid"] = $aid;
}

if(isset( $_GET["action"]) and $_GET["action"]!= ""){
	$action = $_GET["action"];
}else{
	$action = $_POST["action"];
}

$chkexpusers =  getCheckoutExpiredUsers();
$chkexpusers  = explode(",",$chkexpusers );
for($i=0;$i<count($chkexpusers);$i++){
	adjustStock($chkexpusers[$i],"+" );
}

if (isset($_GET["action"]) and $_GET["action"] != "") {
    $action = $_GET["action"];
}else if (isset($_POST["action"]) and $_POST["action"] != "") {
    $action = $_POST["action"];
}


$registered = false;
if(isset($_POST["txtUserName"]))
{

    $txtUserName = $_POST["txtUserName"];
    $txtFirstName = $_POST["txtFirstName"];
    $txtLastName = $_POST["txtLastName"];
    $txtAddress1 = $_POST["txtAddress1"];
    $txtAddress2 = $_POST["txtAddress2"];
    $txtCity = $_POST["txtCity"];
    $txtState = $_POST["bill_state"];
    $ddlCountry = $_POST["bill_country"];
    $txtZIP = $_POST["txtZIP"];
    $txtEmail = $_POST["txtEmail"];
	$txtPhone = $_POST["txtPhone"];
	$txtFAX = $_POST["txtFAX"];
	$txtPassword = $_POST["txtPassword"];
        $txtCnfPassword = $_POST["txtCnfPassword"];
	$check_news = $_POST["check_news"];
	if($check_news==1)
	$check_news="Y";
	else
	$check_news="N";
	
    $message = "" ;
	
    if (!isNotNull($txtUserName)) {
        $message .= USERNAME_EMPTY_MSG."<br>";
    } else {
        $qry = "SELECT  LOWER(user_name) FROM  " .$tableprefix. "users WHERE user_name='" . strtolower(addslashes($txtUserName)) . "' ";
        if (mysql_num_rows(mysql_query($qry)) > 0) {
            $message .= USERNAME_EXISTS_MSG."<br>";
        }
    }

    /*if (!isValidUsername($txtUserName)) {
        $message .= INVALID_USER_MSG."<br>";
    }*/
    
    if (!isNotNull($txtPassword)) {
        $message .= PASSWORD_EMPTY_MSG." <br>";
    }
    if (!isNotNull($txtCnfPassword)) {
        $message .= PASSWORD_CONFIRM_EMPTY_MSG." <br>";
    }

    if($txtPassword!=$txtCnfPassword)
        {
            $message .= PASSWORD_MISSMATCH_MSG." <br>";
        }

	if(!isNotNull($txtFirstName))
	{
	$message .= FIRST_NAME_EMPTY_MSG." <br>";
	/* if(!preg_match("/^[a-zA-Z ]+$/", $txtFirstName))
	 { 
	   $message .= "* First name accepts alphabets only !! <br>";
	 }*/
	}
	if (!isNotNull($txtLastName)) {
        $message .= LAST_NAME_EMPTY_MSG." <br>";
    }
	/*if(isNotNull($txtLastName))
	{
	 if(!preg_match("/^[a-zA-Z ]+$/", $txtLastName))
	 { 
	   $message .= "* Last name accepts alphabets only !! <br>";
	 }
	}*/
	if(isNotNull($txtZIP))
	{ 
		if(strlen($txtZIP)!=5 && $ddlCountry=="US")
		{
		 $message .= INVALID_ZIP_CODE."<br>";
		}
	} 
	if(isNotNull($txtPhone))
	{ 
		if(!check_phone($txtPhone,$ddlCountry))
		{
		 $message .= INVALID_PHONE_NUMBER."<br>";
		}
	}
	
	if (!isNotNull($txtEmail)) {
        $message .= EMAIL_EMPTY_MSG." <br>";
    } else{
		if (!isValidEmail($txtEmail)) {
	        $message .= INVALID_EMAIL_MSG." <br>";
	    }
	}

    $qry2 = "select email from  " . $tableprefix . "users where email='" . addslashes($txtEmail) . "'";
    if (mysql_num_rows(mysql_query($qry2)) > 0) {
        $message .= EMAIL_ADDRESS_MSG." <br>";
    }
	
	
	/*custom fields null checking starts*/
	
		$select_custom_qry = "SELECT * FROM ".$tableprefix."custom_fields WHERE vcustom_display_field = 'Y' 
						  	  AND vcustom_delete_status !='Y' ORDER BY vcustom_sort_order";
		$result_custom_qry = mysql_query($select_custom_qry) or die(mysql_error());
					
		while($custom_qry_row = mysql_fetch_array($result_custom_qry))
		{
		
			$field_name = 'custom_field_'.$custom_qry_row['ncustom_id'];
		
			if($custom_qry_row['vrequired_custom_field'] == 'Y')
			{
			
				
				if (!isNotNull($_POST[$field_name]))
				{
					//$message .= ucfirst($custom_qry_row['vcustom_field_name']).CANNOT_BE_EMPTY_TEXT." <br>";
					$message .= CANNOT_BE_EMPTY_TEXT." <br>";
					$message  = str_replace("FIELD",ucfirst($custom_qry_row['vcustom_field_name']),$message);
				}
				
				
			
			}
			
			/*$insert_custom_fields = "INSERT INTO ".$tableprefix."custom_fields_value(ncustom_field_id,ncustom_table_id,vfield_name_value)
									VALUES(".$custom_qry_row['ncustom_id'].","
									.$userid.","
									.GetSQLValueString($_POST[$field_name],"text").")";
									
			mysql_query($insert_custom_fields) or die(mysql_error());*/									
		
		}
	
	
	/*custom fields null checking ends*/
		
	

    if ($message != "") { // error
        $message = "<br>".CORRECT_ERRORS_TEXT."<br>" . $message;
    } else { // no error so insert user details
		$sql = "INSERT INTO ".$tableprefix."users (
			user_name ,
			password,
			first_name,
			last_name,
			address1,
			address2,
			city,
			state,
			country,
			phone,
			fax,
			zip,
			email,
			affiliate_id,
			newsLetter,
			date_registered
			) VALUES (
			'".addslashes($txtUserName)."',
			'".addslashes(md5($txtPassword))."',
			'".addslashes($txtFirstName)."',
			'".addslashes($txtLastName)."',
			'".addslashes($txtAddress1)."',
			'".addslashes($txtAddress2)."',
			'".addslashes($txtCity)."',
			'".addslashes($txtState)."',
			'".addslashes($ddlCountry)."',
			'".addslashes($txtPhone)."',
			'".addslashes($txtFAX)."',
			'".addslashes($txtZIP)."',
			'".addslashes($txtEmail)."',
			'".addslashes($aid)."',
			'".addslashes($check_news)."',							
			now()
			)";
			
		mysql_query($sql);
		$userid = mysql_insert_id();
		
		$select_custom_insert = "SELECT * FROM ".$tableprefix."custom_fields WHERE vcustom_display_field = 'Y'
						  	 	   AND vcustom_delete_status !='Y'";
		$result_custom_insert = mysql_query($select_custom_insert) or die(mysql_error());
					
		while($custom_insert_row = mysql_fetch_array($result_custom_insert))
		{
		
			$field_name_insert = 'custom_field_'.$custom_insert_row['ncustom_id'];


				
			 $insert_custom_fields = "INSERT INTO ".$tableprefix."custom_fields_value(ncustom_field_id,ncustom_table_id,vfield_name_value)
									VALUES(".$custom_insert_row['ncustom_id'].","
									.$userid.",'".mysql_real_escape_string($_POST[$field_name_insert])."')";
									
			mysql_query($insert_custom_fields) or die(mysql_error());									
		
		}
		
		/*$jscript .= "}
					</script>";*/

		/*$sql = "SELECT * FROM ".$tableprefix."settings ";
		$result = mysql_query($sql);
		if(mysql_num_rows($result) != 0){
			$row = mysql_fetch_array($result);
			$txtReferralCharge = $row["referral_charge"];
		}
		if(isset($aid) && ($aid!="")){
			$sql = "INSERT INTO ".$tableprefix."affiliate_registrations (
			affiliate_id,
			user_id,
			user_name ,
			user_first_name,
			user_last_name,
			user_email,
			referral_charge,
			registration_date
			) VALUES (
			'".addslashes($aid)."',
			'".addslashes($userid)."',
			'".addslashes($txtUserName)."',
			'".addslashes($txtFirstName)."',
			'".addslashes($txtLastName)."',
			'".addslashes($txtEmail)."',
			'".addslashes($txtReferralCharge)."',
			now()
			)";
			mysql_query($sql);
			//echo $sql;
		}*/


/*------------Multicart 2.0 Upgradation------------*/

		//$userfullname = $txtFirstName;
		
	
		$_SESSION["sess_username"] = $txtUserName;
		$_SESSION["sess_userid"] = $userid;
		
		
		// Ending Session for Sellers, Affiliates		
			if(isset($_SESSION["sess_artistid"]) and $_SESSION["sess_artistid"]!= "")
			{ // Logging Out User  from same window
                            if(function_exists('session_unregister')) {
                                    session_unregister($_SESSION["sess_artistid"]);
                            }
                            else{
                                unset($_SESSION["sess_artistid"]);
                            }
					
			}
			if(isset($_SESSION["sess_affiliateid"]) and $_SESSION["sess_affiliateid"]!= "")
			{ // Logging OutSeller  from same window
                            if(function_exists('session_unregister')) {
                                    session_unregister($_SESSION["sess_artistid"]);
                            }
                            else{
                                    unset($_SESSION["sess_artistid"]);
                            }
					
			}
	// End check 		
		
		if($txtLastName != "")
		{
			$userfullname .= " ". $txtLastName;
		}
		
		$to = $txtEmail;
		
		$subject = "Your account information with ".SITE_NAME;
		
/*-------Email Template Reading Fuction Call--------*/				
				
		$mailcontent = readEmailTemplate('member_registration');
			
		
		$mailcontent = str_replace('[user_name]',$txtUserName,$mailcontent);					
		$mailcontent = str_replace('[password]',$txtPassword,$mailcontent);	
		
/*---------------User Login Url-------------------*/			
		
		
		$mailcontent .= "\r\n"."Click&nbsp;<a href=".SITE_URL."/login.php>Here</a> to Login\r\n\n";
				
/*---------------User Login Url-------------------*/							
		
		$from= "From: ".SITE_EMAIL."\n";
		$headers  = "MIME-Version: 1.0" . "\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
		$headers .= "From: ".SITE_EMAIL."<".SITE_EMAIL.">" . "\r\n";
		$headers .= "Reply-To: ".SITE_NAME."<".SITE_EMAIL.">" . "\r\n";
		$headers .= "Return-Path: ".SITE_NAME."<".SITE_EMAIL.">"."\r\n"; 
		$headers .= "Organization: ".SITE_NAME."\r\n";
		$mailcontent = nl2br($mailcontent);
		
		$mail_send_details = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Buyer Registration</title>
</head>
<body>

<table width="103%" cellspacing="10" cellpadding="0" bgcolor="#EAEAEA">
   <tr>
     <td align="center" valign="top">
         
         <table width="600" border="0" cellpadding="0" cellspacing="0" bordercolor="#EAEAEA" bgcolor="#FFFFFF" class="manage_table">
            <tr>
               <td align="right" >
              </td>
            </tr>
            <tr>
               <td valign="middle" align="left"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td  bgcolor="#EAEAEA" > <img src='.SITE_URL.'/banners/'.getSettingsValue('site_logo').' width="125" height="60"/></td>
                 </tr>
               </table></td>
            </tr>
            <tr>
              <td align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                <tr>
                  <td align="left"><p>'.$mailcontent.'</p>
                  </td>
                </tr>
              </table></td>
            </tr>
            <tr>
               <td align="center" bgcolor="#EAEAEA" class="footer">
                  <p>&nbsp;</p>
              </td>
            </tr>
       </table>

     </td>
   </tr>
</table>


</body>
</html>';
				
		//$mail_send_details = "<html><head><link href='".SITE_URL."/style/template1-admin.css' rel='stylesheet' type='text/css'></head><body><center><div align='left' id='layout'><div align='left' class='header'><div align='left' class='logo'><img src=".$logofolder."/".$logoimage." width='125' height='39'/></div></div><div>".$mailcontent."</div></div><div align='left' class='clear_float'><img src=".$imagefolder."/clear.gif width=1 height=1/></div></div></div></center></body></html>";
		
		$mailsent = mail($to, $subject, $mail_send_details, $headers);
		
		// **********************************************************************Send Mail To Administrator 
		
		
		$subject_admin = "New Member Registration  with ".SITE_NAME;
		
/*-------Email Template Reading Fuction Call--------*/				
				
		$mailcontent_admin = readEmailTemplate('member_registration_admin');
			
		
		$mailcontent_admin = str_replace('[user_name]',$txtUserName,$mailcontent_admin);					
		$mailcontent_admin = str_replace('[password]',$txtPassword,$mailcontent_admin);	
		
		$mailcontent_admin = str_replace('[first_name]',$txtFirstName,$mailcontent_admin);		
					
		$mailcontent_admin = str_replace('[last_name]',$txtLastName,$mailcontent_admin);	
		
/*---------------User Login Url-------------------*/			
		
		
		$mailcontent_admin .= "\r\n"."Click&nbsp;<a href=".SITE_URL."/admin/login.php>Here</a> to Login to view details of Member\r\n\n";
				
/*---------------User Login Url-------------------*/							
		
		$from= "From: ".SITE_EMAIL."\n";
		$headers  = "MIME-Version: 1.0" . "\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
		$headers .= "From: ".SITE_EMAIL."<".SITE_EMAIL.">" . "\r\n";
		$headers .= "Reply-To: ".SITE_NAME."<".SITE_EMAIL.">" . "\r\n";
		$headers .= "Return-Path: ".SITE_NAME."<".SITE_EMAIL.">"."\r\n"; 
		$headers .= "Organization: ".SITE_NAME."\r\n";
		
		$mailcontent_admin = nl2br($mailcontent_admin);
		$mail_send_details_admin = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Buyer Registration</title>
</head>
<body>

<table width="103%" cellspacing="10" cellpadding="0" bgcolor="#EAEAEA">
   <tr>
     <td align="center" valign="top">
         
         <table width="600" border="0" cellpadding="0" cellspacing="0" bordercolor="#EAEAEA" bgcolor="#FFFFFF" class="manage_table">
            <tr>
               <td align="right" >
              </td>
            </tr>
            <tr>
               <td valign="middle" align="left"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td  bgcolor="#EAEAEA" > <img src='.SITE_URL.'/banners/'.getSettingsValue('site_logo').' width="125" height="60"/></td>
                 </tr>
               </table></td>
            </tr>
            <tr>
              <td align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                <tr>
                  <td align="left"><p>'.$mailcontent_admin.'</p>
                  </td>
                </tr>
              </table></td>
            </tr>
            <tr>
               <td align="center" bgcolor="#EAEAEA" class="footer">
                  <p>&nbsp;</p>
              </td>
            </tr>
       </table>

     </td>
   </tr>
</table>


</body>
</html>';
				
		
		$adminemail	=getSettingsValue('site_email');
		
		
		$mailsent = mail($adminemail, $subject_admin, $mail_send_details_admin, $headers);
		
		// End 
		
		// Redirect User To View Cart Page
		
			if(isset($_POST['action']) && $_POST['action']=='checkout')
			{
				
					 $sql_up1	="SELECT cart_id  FROM  ".$tableprefix."cart where visitor_cart_id ='".session_id()."'  ";
					
					$rs_up1	= mysql_query($sql_up1) or die(mysql_error());
					
					if(mysql_num_rows($rs_up1)>0)
					{	 
						 $sql_up_cart	="UPDATE  ".$tableprefix."cart set user_id ='".$_SESSION["sess_userid"]."' where visitor_cart_id ='".session_id()."'  ";
						
						 $rs_up_cart	= mysql_query($sql_up_cart) or die(mysql_error());
						 
						 header("Location:checkout.php?reg=1");
						 exit;
					} 
					
					else
					{
					
						header("Location:index.php?reg=1");
						exit;
					}
					
					
			}
		
		else
		{
		// End 
		
			header("Location:index.php?reg=1");
                         exit;
		}	
		
		
		//$message = "Registration successfully completed! Please <a class=links href='login.php'><b>login here</b>.</a>";

/*----------Multicart2.0 Upgradation---------------*/				

		if($action!= ""){
			$_SESSION["sess_username"] = $txtUserName;
			$_SESSION["sess_userid"] = $userid;
			if(!isVisitorCartEmpty(session_id())){
				mergeVisitorCartToUserCart(session_id(),$userid);
			}

			if($action == "checkout"){
				header("Location:viewcart.php?reg=1");
				exit;
			}
		}

		$txtUserName = "";
	    $txtFirstName = "";
	    $txtLastName = "";
	    $txtAddress1 = "";
	    $txtAddress2 ="";
	    $txtCity = "";
	    $txtState = "";
	    $ddlCountry ="";
	    $txtZIP = "";
	    $txtEmail ="";
		$txtPhone = "";
		$txtFAX ="";
		$txtPassword = "";
		$registered= true;
    }
}

//echo $jscript;

$countrylist = makeCountryList();

/*display the active template*/

$active_template = displayTemplate();


include "includes/htmltop.php";

/* Top File Name */

include_once ("includes/".$active_template[0]);
?>

<script language="javascript" src="includes/function.js"></script>
<script src="./js/registration_ajax.js"></script>
<script src="./js/javascript_check_userside.js"></script>
<script>
function checkUserRegisterForm()
{

  var form_name = new Array('txtUserName','txtPassword','txtCnfPassword','txtFirstName','txtLastName','txtEmail');
  var display_name = new Array('<?php echo USER_NAME_TEXT;?>','<?php echo PASSWORD_TEXT;?>','<?php echo PASSWORD_CONFIRM_TEXT?>','<?php echo FIRST_NAME_TEXT;?>','<?php echo LAST_NAME_TEXT;?>','<?php echo EMAIL_LABEL;?>');
  var count = 6;
  var email           = document.frmRegister.txtEmail.value;
  if(check_fieldsUser('frmRegister',form_name,display_name,count))	
  {

        if(email != '')
        {
            if(!echeck(email))
            {
                return false;
            }
        }
        showListUserRegistration(document.frmRegister.txtUserName.value,document.frmRegister.txtEmail.value);
   
  }
  else
  {
  
  		return false;
  
  }
  
}
</script>

<?php
 if($_POST['bill_state']!='')
{
	$bill_state = $_POST['bill_state'];
}
?>
			<div align="left" class="main_body">
			<!--mainbody area start -->

		<form name="frmRegister" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST" onSubmit="">
			<input type="hidden" name="action" value="<?php echo htmlentities($action);?>">
			<!-- The id of the country field(s).  If more than one, seperate with spaces -->
			<input type="hidden" value="billCountrySelect" name="cs_config_country_field" id="cs_config_country_field">
			<input type="hidden" value="billStateSelect" name="cs_config_state_field"   id="cs_config_state_field">
			
			
			<!-- The id of the the fields holding the default values.  If more than one, seperate with spaces -->
			<input type="hidden" value="billCountryDefault" name="cs_config_country_default" id="cs_config_country_default">
			<input type="hidden" value="billStateDefault"   name="cs_config_state_default"   id="cs_config_state_default">
			<!-- The actual default values -->
			<input type="hidden" value="US" name="billCountryDefault" id="billCountryDefault">
			<input type="hidden" value="<?php echo $bill_state;?>"   name="billStateDefault"   id="billStateDefault">
		<SCRIPT type="text/javascript" SRC="js/country-state.js"></SCRIPT>
		<div align="left" id="item_details">
		<!--items display area start -->
		
		<div class="text_information" align="center"><?php echo $message?></div>
		<div>
		<?php if(!$registered)
		{
		?>
			<input type="hidden" name="aid" value="<?php echo htmlentities($aid);?>">
			<!--registrstion new design-->
		<div class="reg_wrapper">
			<div class="reg_wrapper_header">
			<h2><?php echo USER_REGISTRATION_TEXT;?></h2>
			</div>
			<div class="reg_container">
				<div class="register_leftcolumn">
				<div class="field_wrapper_required">
				<label><?php echo USER_NAME_TEXT;?>&nbsp;</label>
				<input class="text_field" type="text" value="<?php echo ($txtUserName);?>" name="txtUserName" size="55" maxlength="100">
				</div>
				<div class="field_wrapper_required">
				<label><?php echo PASSWORD_TEXT;?>&nbsp;</label>
				<input class="text_field" type="password" value="" name="txtPassword" size="55" maxlength="30" >
				</div>
                                <div class="field_wrapper_required">
				<label><?php echo PASSWORD_CONFIRM_TEXT;?>&nbsp;</label>
				<input class="text_field" type="password" value="" name="txtCnfPassword" size="55" maxlength="30" >
				</div>
				<div class="field_wrapper_required">
				<label><?php echo FIRST_NAME_TEXT;?>&nbsp;</label>
				<input  class="text_field" type="text" value="<?php echo ($txtFirstName);?>" name="txtFirstName" size="55" maxlength="100">
				</div>
				<div class="field_wrapper_required">
				<label><?php echo LAST_NAME_TEXT;?>&nbsp;</label>
				<input  class="text_field" type="text" value="<?php echo ($txtLastName);?>" name="txtLastName" size="55" maxlength="100">
				</div>
				<div class="field_wrapper_required">
				<label><?php echo EMAIL_TEXT;?>&nbsp;</label>
				<input type="text" value="<?php echo htmlentities($txtEmail);?>"  class="text_field" name="txtEmail" size="55" maxlength="100">
				</div>
<?php
	//$j for avoiding error only 	
	//echo $select_custom_fields = "SELECT * FROM ".$tableprefix."custom_fields WHERE vcustom_display_field = 'Y' AND vcustom_field_form_id ='".$j."' ORDER BY vcustom_sort_order ";
			$select_custom_fields = "SELECT * FROM ".$tableprefix."custom_fields WHERE vcustom_display_field = 'Y' 
									 AND vcustom_delete_status != 'Y' ORDER BY vcustom_sort_order";
			$result_custom_fields = mysql_query($select_custom_fields) or die(mysql_error());
			
			while($custom_field_row = mysql_fetch_array($result_custom_fields))
			{
			
				if($custom_field_row['vrequired_custom_field'] == 'Y')
				{
				
					$required_class = "field_wrapper_required";
				
				}
				else
				{
				
					$required_class = "field_wrapper";
				
				}
			
				$field_name = 'custom_field_'.$custom_field_row['ncustom_id'];
			
?>		
				
				<div class="<?php echo $required_class;?>">
				<label><?php echo ucfirst($custom_field_row['vcustom_field_name'])?></label>
					
<?php
		
				if($custom_field_row['vcustom_field_type'] == "text_box")
				{
		
?>				
																																		
					<input class="text_field" type="text" value="<?php echo $_POST[$field_name]?>" name="<?php echo $field_name?>" size="55" maxlength="30">
					
<?php
		
				}
				else
				{
?>
		
					
					<textarea name="<?php echo $field_name?>" rows="5" cols="15" class="text_field"><?php echo $_POST[$field_name]?></textarea>
		
<?php
		
				}	
		
?>																													
					</div>
					
				
<?php		
				
			
			
			}
		
?>	





				<div class="clear"></div>
				</div>
				<div class="register_rightcolumn">
				<h3><?php echo SECURE_RELIABLE_TEXT;?></h3>
				<p><?php echo SECURE_RELIABLE_MSG;?>
                                </p>
				</div>
				<div class="clear"></div>
			</div>
			<div class="regiterbtn_container">
				<div class="nwsletter">
				<input type="checkbox" name="check_news" value="1" checked align="absmiddle">
				
				<label class="small_txt"><?php echo NOTIFY_UPDATES_TEXT;?></label>
				</div>
				<input type="button" value="" name="btnRegister"  class="regiterbtn" onClick="return checkUserRegisterForm();">
				<div class="clear"></div>
				</div>
			<div class="clear"></div>
		</div>
		<div class="clear"></div>
		</div>
<?php
}
else
{
?>
<?php
 }
 ?>
		</div>	
		<div align="left" class="float_clear1"></div>
		 <!--items display area end -->
		  </div>
			</form>
		<!--center content area end-->	
		<div align="left" class="clear"></div>		
		<!--mainbody area end -->
        </div>
		<div align="left" class="clear"></div>
<?php
include "includes/".$active_template[2];	/* Bottom File Name */
?>