<?php 
/*
##################################################################
#                       PHP 4&5 MySQL 4&5                        #
##################################################################
#           Copyright (c) 2004-2008 Armia Systems Inc            #
##################################################################
#               This file is part of Cybermatch site             #
##################################################################
#    Developed By: simi (simi@armia.com)                         #

##################################################################
#               Developed On:   03-04-2008                       #
##################################################################
#               Modified By:                                     #
##################################################################
#               Modified On:                                     #
##################################################################
# 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.                                         #
##################################################################
*/

require_once ("config.inc.php");
require_once ("includes/mysql.inc.php");
require_once ("includes/arrays.inc.php");
require_once ("classes/userside.class.php");
require_once ("classes/misc.class.php");

if (!isset($_SESSION['register_id']) OR $_SESSION['register_id'] == "") {
	header("Location: register.php");
	exit();
}
$freecode	= isset($_POST['freecode'])	?	stripslashes(trim($_POST['freecode']))	:	"";

$message	= "";
$script		= "";

if (!$objDB) {
	$message	= "Unable to Locate Database Server.";
} else {
	$objU		= new userside($objDB);
        $objM		= new misc($objDB);
	if (isset($_POST['FCO'])) {
		$message	= $objU->register_freecode(addslashes($freecode), $_SESSION['register_id']);
		if ($message == "") {
			header("Location: register_success.php?from=free");
			exit();
		}
	}
}
include_once ("title.inc.php");
include_once ("tophtml.inc.php");
?>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="72%" valign="top"><div class="search-rslts"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
          <tr>
            <td>              <table width="100%"  border="0" cellspacing="0" cellpadding="5">
              <tr>
                    <td width="100%" class="inenr-hd"><h2>Register with Free Code</h2></td>
              
              </tr>
            </table>
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
                <tr>
                  <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="headings2">Enter free code</td>
                    </tr>
                  </table>
                    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td><img src="images/spacer.gif" width="1" height="10"></td>
                      </tr>
                    </table>
					<form name="frmTells" method="post" action="<?php echo $_SERVER['PHP_SELF']?>" onSubmit="return validate();">
                    <table width="100%"  border="0" cellspacing="0" cellpadding="5">
					<?php if(isset($message) && trim($message)!='')
					      {
					?>
                    <tr align="center">
                      <td colspan="2" class="maintext1 warning"><?php echo $message;?></td>
                      </tr>
					<?php }//end if?>
                    <tr>
                      <td width="54%" class="maintext1">Free Code</td>
                      <td width="46%" class="maintext1"><input name="freecode" type="text" class="commononetextbox" size="35" maxlength="100"></td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td><input name="FCO" type="submit" class="signupbutton" value="Continue"></td>
                    </tr>
                  </table>
					</form>
                    </td>
                </tr>
              </table>
              <div id="hide"><?php echo $script?></div>
			</td>
          </tr>
        </table></div></td>
        <td width="28%" valign="top"><?php //include_once ("left.inc.php");?></td>
      </tr>
    </table>      
      </td>
  </tr>
</table>
<?php include_once('bottomhtml.inc.php');?>
