function parseXmlAndUpdateDB($xmlData, $user_id, $score_id)
{
    $clean_xml = str_ireplace(['SOAP-ENV:', 'SOAP:'], '', $xmlData);
    $xml = simplexml_load_string($clean_xml);
    //print_r($xml);
    //echo "<h1>List  Of Account</h1>";
    $CAIS_Account = $xml->CAIS_Account;
    // Fetch Main Object from XML
    foreach ($CAIS_Account->CAIS_Account_DETAILS as $Account_Details) {
        global $count;
        $count = $count + 1;
        $Account_Number = $Account_Details->Account_Number;
        $account_number = $Account_Number['0'];
        $Subscriber_Name = $Account_Details->Subscriber_Name;
        $subscriber_name = $Subscriber_Name['0'];
        // add additional details
        $Value_of_Collateral = $Account_Details->Value_of_Collateral;
        $value_of_collateral = $Value_of_Collateral['0'];
        $Type_of_Collateral = $Account_Details->Type_of_Collateral;
        $type_of_collateral = $Type_of_Collateral['0'];
        $Date_Reported = $Account_Details->Date_Reported;
        $date_reported = $Date_Reported['0'];
        $Current_Balance = $Account_Details->Current_Balance;
        $current_balance = $Current_Balance['0'];
        $Amount_Past_Due = $Account_Details->Amount_Past_Due;
        $amount_past_due = $Amount_Past_Due['0'];
        // end additionals details
        $sql_accounts = "update tbl_getaccounts set date_reported='{$date_reported}', \n       current_balance='{$current_balance}',amount_due='{$amount_past_due}', value_collateral='{$value_of_collateral}',\n       type_collateral='{$type_of_collateral}' where user_id='{$user_id}' and account_number='{$account_number}' and \n       subscriber_name='{$subscriber_name}';";
        $exe = mysql_query_with_throw($sql_accounts);
    }
    return True;
}
function exportMysqlToCsv($table, $filename = 'export.csv')
{
    $csv_terminated = "\n";
    $csv_separator = ",";
    $csv_enclosed = '"';
    $csv_escaped = "\\";
    $sql_query = "select * from {$table}";
    // Gets the data from the database
    $result = mysql_query_with_throw($sql_query);
    $fields_cnt = mysql_num_fields($result);
    $schema_insert = '';
    for ($i = 0; $i < $fields_cnt; $i++) {
        $l = $csv_enclosed . str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, stripslashes(mysql_field_name($result, $i))) . $csv_enclosed;
        $schema_insert .= $l;
        $schema_insert .= $csv_separator;
    }
    // end for
    $out = trim(substr($schema_insert, 0, -1));
    $out .= $csv_terminated;
    // Format the data
    while ($row = mysql_fetch_array($result)) {
        $schema_insert = '';
        for ($j = 0; $j < $fields_cnt; $j++) {
            if ($row[$j] == '0' || $row[$j] != '') {
                if ($csv_enclosed == '') {
                    $schema_insert .= $row[$j];
                } else {
                    $schema_insert .= $csv_enclosed . str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, $row[$j]) . $csv_enclosed;
                }
            } else {
                $schema_insert .= '';
            }
            if ($j < $fields_cnt - 1) {
                $schema_insert .= $csv_separator;
            }
        }
        // end for
        $out .= $schema_insert;
        $out .= $csv_terminated;
    }
    // end while
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Length: " . strlen($out));
    // Output to browser with appropriate mime type, you choose ;)
    header("Content-type: text/x-csv");
    //header("Content-type: text/csv");
    //header("Content-type: application/csv");
    header("Content-Disposition: attachment; filename={$filename}");
    echo $out;
    exit;
}
            $add_file_name1 = $_FILES['addfile1']['name'];
            $add_file_size1 = $_FILES['addfile1']['size'];
            $add_file_tmp1 = $_FILES['addfile1']['tmp_name'];
            $add_file_type1 = $_FILES['addfile1']['type'];
            $add_file_ext1 = strtolower(end(explode('.', $_FILES['addfile1']['name'])));
            $rand3 = rand(100000, 999999);
            $filePath3 = $target_dir . $rand3 . $user_id . "addproof1." . $add_file_ext1;
            $add_name1 = $rand3 . $user_id . "addproof1." . $add_file_ext1;
            $result = move_uploaded_file($add_file_tmp1, $filePath3);
            if (!$result) {
                $errors[] = "Error: File could not be uploaded: " . $add_file_name1;
            }
        }
        if (empty($errors)) {
            $send_kyc = sendmail_attachment($filePath1, $id_name, $filePath2, $add_name, $score_id, $filePath3, $add_name1);
            $experan_data = mysql_query_with_throw("INSERT INTO  `tbl_uploadkyc` ( `user_id` ,`status` ) \n             VALUES ('{$user_id}' ,1);");
            $text = TRUE;
        }
    }
    if (!empty($errors)) {
        //report the errors
        echo '<div id="gt-formfeedback"><b><font size="4">WHOOPS! Please review the following issues:</font></b><ul>';
        foreach ($errors as $msg) {
            //prints each error
            echo "<li>{$msg}</li>";
        }
        // end of foreach
        echo '</ul></div>';
    }
}
if ($text) {
   //Initialize error array
   if (empty($_POST['gtname'])) {
       $errors[] = "Name field can't be blank!";
   }
   if (empty($_POST['gtemailid'])) {
       $errors[] = "Email field can't be blank!";
   } else {
       if (!eregi('^[[:alnum:]][a-z0-9_\\.\\-]*@[a-z0-9\\.\\-]+\\.[a-z]{2,4}$', stripslashes(trim($_POST['gtemailid'])))) {
           $errors[] = 'Please provide a <strong>valid email address</strong>!';
       }
   }
   if (empty($errors)) {
       if (isUnique("email", $_POST['gtemailid'], "tbl_newsletter")) {
           // Insert data into database
           $gtregquery = "INSERT INTO `tbl_newsletter` (`id`, `name`, `email`, `status`, `add_date`) VALUES (NULL, '{$rwsfname}', '{$rwsuemailid}', '1', NOW())";
           $gtresult = mysql_query_with_throw($gtregquery);
           $subject = "Newsletter Registration on {$sitename} - by " . $rwsfname;
           $body = '<table width="634" border="0" align="left" cellpadding="0" cellspacing="0">
 <tr>
   <td height="52" bgcolor="#00798c"><font style="font-family:Arial, Helvetica, sans-serif; font-size:24px; font-weight:bold; color:#FFFFFF;">&nbsp;<span class="style1">' . $sitename . '  - </span></font><span style="color: #FFFFFF"><strong><font style="font-family:Arial, Helvetica, sans-serif; font-size:24px; color:#ffffff;"> Contact us details</font></strong></span></td>
 </tr>
 <tr>
   <td align="left" valign="middle"><table width="633" border="0" align="center" cellpadding="0" cellspacing="0">
     <tr>
       <td height="22" colspan="2" align="left" valign="middle"></td>
     </tr>
     <tr>
       <td width="227" height="30" align="left" valign="middle"><span style="color: #FFFFFF"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#333333"> Name:</font></span></td>
       <td width="406" height="30" align="left" valign="middle"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000;">' . stripslashes($rwsfname) . '</font></td>
     </tr>
     <tr>
     } elseif ($pagenum < $max_pages && $pagenum > 0) {
         $pageshow = $pagenum;
     } elseif ($pagenum <= 0) {
         $pageshow = '1';
     } else {
         $pageshow = '1';
     }
 } else {
     $pageshow = '1';
 }
 $begin = $pageshow - 1;
 $start = $begin * $per_page;
 if (!$start) {
     $start = 0;
 }
 $getquery = mysql_query_with_throw($constructs . " ORDER BY refresh_date DESC LIMIT {$start}, {$per_page}");
 while ($runrows = mysql_fetch_assoc($getquery)) {
     $JobID = $runrows['JobID'];
     $jobpostsubject = $runrows['jobpostsubject'];
     $jobpostlocationtowncity = $runrows['jobpostlocationtowncity'];
     $jobpostlocationcounty = $runrows['jobpostlocationcounty'];
     $jobpostpostcode = $runrows['jobpostpostcode'];
     $jobpostjobtype = $runrows['jobpostjobtype'];
     $jobpostsalary = $runrows['jobpostsalary'];
     $jobpostsectorindustry = $runrows['jobpostsectorindustry'];
     $jobpostdescription = $runrows['jobpostdescription'];
     $keywords = $runrows['keywords'];
     $jobpostrecruiteremployer = $runrows['jobpostrecruiteremployer'];
     $jobpostrecruitercontactperson = $runrows['jobpostrecruitercontactperson'];
     $jobpostcontactnumber = $runrows['jobpostcontactnumber'];
     $jobpostrecruiteremployeremail = $runrows['jobpostrecruiteremployeremail'];
<?php

include "../includes/config.php";
$acid = $_GET["id"];
$query = "SELECT t1.*,t2.id as ac_id,t2.account,t2.balance,t2.bank,t2.status,t2.alert,t2.account_no,t2.date_opened,t2.date_closed,t2.dateofbirth,t2.pancard,t2.notes,t2.principal, t2.interest, t2.other_charges, t2.last_payment_date, t2.last_payment_done, t2.product_type, t2.cibil_status, t2.unikdueid FROM `tbl_userdetails` as t1 INNER JOIN `tbl_accounts` as t2 ON t1.id=t2.userid WHERE t2.id=" . $_GET['id'];
$rs = mysql_query_with_throw($query);
$row = mysql_fetch_assoc($rs);
$userid = $row["id"];
$firstname = $row["firstname"];
$lastname = $row["lastname"];
$email = $row["email"];
$mobile = $row["mobile"];
$account_no = $row["account_no"];
$email = $row["email"];
?>
<script type="text/javascript" src="resources/scripts/jquery-1.3.2.min.js"></script>
<script  language="javascript" type="text/javascript">
function validatenewscommentform()
{
	flag=2;
	formObj1 = document.rwschangepass;
	
	if(formObj1.offeramt.value=="")
	{
		alert("Offer Amount field cannot be blank!");
		document.getElementById("offeramt").focus();
		return false;
	}
	if(isNaN(formObj1.offeramt.value))
	{
		alert("Offer Amount field contains only digits!");
	<div class="gt-label">&nbsp;</div>
    <div class="gt-formfields"><img id="captcha" src="<?php 
    echo $baseurl;
    ?>
securimage/securimage_show.php" alt="CAPTCHA Image" /><input type="text" name="captcha_code" size="10" maxlength="6"  id="gtcaptchcode"/><a href="#" onclick="document.getElementById('captcha').src = 'securimage/securimage_show.php?' + Math.random(); return false">[ Different Image ]</a></div>
</div>
Field Content Ends -->

<div class="gt-fields gt-buttoncentre"><input type="submit" name="button" id="button" value="Submit" class="rwsbutton" /></div>
<!-- Field Content Ends -->

</form>
<?php 
} else {
    $sql = 'SELECT * FROM `tbl_userdetails` WHERE id = "' . $_SESSION['GTUserID'] . '"';
    $rs = mysql_query_with_throw($sql);
    $row = mysql_fetch_assoc($rs);
    $_SESSION['myForm']['firstname'] = stripslashes($row['firstname']);
    $_SESSION['myForm']['middlename'] = stripslashes($row['middlename']);
    $_SESSION['myForm']['lastname'] = stripslashes($row['lastname']);
    $_SESSION['myForm']['email'] = stripslashes($row['email']);
    $_SESSION['myForm']['password'] = stripslashes($row['password']);
    $_SESSION['myForm']['mobile'] = stripslashes($row['mobile']);
    $_SESSION['myForm']['address1'] = stripslashes($row['address1']);
    $_SESSION['myForm']['address2'] = stripslashes($row['address2']);
    $_SESSION['myForm']['city'] = stripslashes($row['city']);
    $_SESSION['myForm']['state'] = stripslashes($row['state']);
    $_SESSION['myForm']['country'] = stripslashes($row['country']);
    $_SESSION['myForm']['pincode'] = stripslashes($row['pincode']);
    $_SESSION['myForm']['imgurl'] = stripslashes($row['imgurl']);
    $_SESSION['myForm']['id_proof'] = stripslashes($row['id_proof']);
    $bank = addslashes($_POST['bank']);
    $postid = $_POST["postid"];
    if ($postid != "") {
        $query = "UPDATE `tbl_bankperson` SET `name` = '{$title}', `email` = '{$email}', `password` = '{$password}', `mobile` = '{$mobile}', `bank` = '{$bank}' WHERE `id` = '{$postid}'";
    } else {
        $query = "INSERT INTO `tbl_bankperson` ( `id` , `name` , `email`, `password` , `mobile`, `bank` , `status` , `last_login` , `add_date`) VALUES (0, '{$title}', '{$email}', '{$password}', '{$mobile}', '{$bank}', '1', '', NOW())";
    }
    $result = mysql_query_with_throw($query);
    echo "<script>document.location.href='view_bankperson.php?page=person'</script>";
    /*$message = "Slideshow image has been added successfully.";
    	$class='successmsg';*/
}
$eid = $_GET["id"];
//code for addind news in the datbase ends here
$qedit = "SELECT * FROM `tbl_bankperson` WHERE `id` ='{$eid}'";
$redit = mysql_query_with_throw($qedit);
$row = mysql_fetch_assoc($redit);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ADMIN CONSOLE // <?php 
echo $sitename;
?>
 Website</title>
<link rel="stylesheet" href="resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/invalid.css" type="text/css" media="screen" />
<!-- Internet Explorer Fixes Stylesheet -->
<!--[if lte IE 7]>
function parseXmlAndUpdateDB($xmlData, $user_id, $score_id)
{
    $clean_xml = str_ireplace(['SOAP-ENV:', 'SOAP:'], '', $xmlData);
    $xml = simplexml_load_string($clean_xml);
    //print_r($xml);
    $created_date = date('Y-m-d H:i:s');
    //echo "<h1>Score Related  Details</h1>";
    $CreditProfileHeader = $xml->CreditProfileHeader;
    // Fetch Main Object from XML
    $Enquiry_Username = $CreditProfileHeader->Enquiry_Username;
    $enq_username = $Enquiry_Username['0'];
    $ReportDate = $CreditProfileHeader->ReportDate;
    $report_date = $ReportDate['0'];
    $ReportNumber = $CreditProfileHeader->ReportNumber;
    $report_number = $ReportNumber['0'];
    $Subscriber = $CreditProfileHeader->Subscriber;
    $subscriber = $Subscriber['0'];
    $Subscriber_Name = $CreditProfileHeader->Subscriber_Name;
    $subscriber_name = $Subscriber_Name['0'];
    $Current_Application_Details = $xml->Current_Application->Current_Application_Details;
    // Fetch Main Object from XML
    $Enquiry_Reason = $Current_Application_Details->Enquiry_Reason;
    $enquiry_reason = $Enquiry_Reason['0'];
    $Finance_Purpose = $Current_Application_Details->Finance_Purpose;
    $finance_purpose = $Finance_Purpose['0'];
    $Amount_Financed = $Current_Application_Details->Amount_Financed;
    $amount_financed = $Amount_Financed['0'];
    $Duration_Of_Agreement = $Current_Application_Details->Duration_Of_Agreement;
    $duration_agreement = $Duration_Of_Agreement['0'];
    //echo "<h1>SCORE</h1>";
    $SCORE = $xml->SCORE;
    // Fetch Main Object from XML
    $score = $SCORE->BureauScore;
    $score_level = $SCORE->BureauScoreConfidLevel;
    //echo "<h1>Current Applicant Details</h1>";
    //$Applicant_Details = $xml->Current_Application->Current_Application_Details->Current_Applicant_Details;		 // Fetch Main Object from XML
    //echo "<h1>Account Details</h1>";
    $Credit_Account = $xml->CAIS_Account->CAIS_Summary->Credit_Account;
    // Fetch Main Object from XML
    $CreditAccountTotal = $Credit_Account->CreditAccountTotal;
    $accounts_total = $CreditAccountTotal['0'];
    $CreditAccountActive = $Credit_Account->CreditAccountActive;
    $accounts_active = $CreditAccountActive['0'];
    $CreditAccountClosed = $Credit_Account->CreditAccountClosed;
    $accounts_closed = $CreditAccountClosed['0'];
    $CreditAccountDefault = $Credit_Account->CreditAccountDefault;
    $accounts_default = $CreditAccountDefault['0'];
    $Total_Outstanding_Balance = $xml->CAIS_Account->CAIS_Summary->Total_Outstanding_Balance;
    // Fetch Main Object from XML
    $Outstanding_Balance_Secured = $Total_Outstanding_Balance->Outstanding_Balance_Secured;
    $os_balance_secured = $Outstanding_Balance_Secured['0'];
    $Outstanding_Balance_UnSecured = $Total_Outstanding_Balance->Outstanding_Balance_UnSecured;
    $os_balance_unsecured = $Outstanding_Balance_UnSecured['0'];
    // Insert all data  into table tbl_getscore_details
    $sql_score_details = "INSERT INTO  `tbl_getscore_details` (  `user_id` ,  `score_id` ,  `score` ,\n`score_level` ,  `enq_username` ,  `report_date` ,  `report_number` , `subscriber` ,\n`subscriber_name` ,  `enquiry_reason` ,  `finance_purpose` ,  `amount_financed` ,  `duration_agreement` ,\n`accounts_total` , `accounts_active` ,  `accounts_closed` ,  `accounts_default` ,  `os_balance_secured` ,\n`os_balance_unsecured` ,  `created` )\nVALUES ('{$user_id}', '{$score_id}', '{$score}', '{$score_level}', '{$enq_username}', '{$report_date}',\n'{$report_number}', '{$subscriber}', '{$subscriber_name}', '{$enquiry_reason}', '{$finance_purpose}',\n'{$amount_financed}', '{$duration_agreement}', '{$accounts_total}', '{$accounts_active}',\n'{$accounts_closed}', '{$accounts_default}', '{$os_balance_secured}', '{$os_balance_unsecured}', '{$created_date}');";
    $exe = mysql_query_with_throw($sql_score_details);
    //echo "<h1>List  Of Account</h1>";
    $CAIS_Account = $xml->CAIS_Account;
    // Fetch Main Object from XML
    foreach ($CAIS_Account->CAIS_Account_DETAILS as $Account_Details) {
        $Identification_Number = $Account_Details->Identification_Number;
        $identification_number = $Identification_Number['0'];
        $Subscriber_Name = $Account_Details->Subscriber_Name;
        $subscriber_name = $Subscriber_Name['0'];
        $Account_Number = $Account_Details->Account_Number;
        $account_number = $Account_Number['0'];
        $Portfolio_Type = $Account_Details->Portfolio_Type;
        $portfolio_type = $Portfolio_Type['0'];
        $Account_Type = $Account_Details->Account_Type;
        $account_type = $Account_Type['0'];
        $Open_Date = $Account_Details->Open_Date;
        $date_open = $Open_Date['0'];
        $Highest_Credit_Loan_Amount = $Account_Details->Highest_Credit_or_Original_Loan_Amount;
        $highcredit_loanamount = $Highest_Credit_Loan_Amount = $Highest_Credit_Loan_Amount['0'];
        $Terms_Duration = $Account_Details->Terms_Duration;
        $terms_duration = $Terms_Duration['0'];
        $Account_Status = $Account_Details->Account_Status;
        $account_status = $Account_Status['0'];
        $Date_Closed = $Account_Details->Date_Closed;
        $date_closed = $Date_Closed['0'];
        // add additional details
        $Value_of_Collateral = $Account_Details->Value_of_Collateral;
        $value_of_collateral = $Value_of_Collateral['0'];
        $Type_of_Collateral = $Account_Details->Type_of_Collateral;
        $type_of_collateral = $Type_of_Collateral['0'];
        $Date_Reported = $Account_Details->Date_Reported;
        $date_reported = $Date_Reported['0'];
        $Current_Balance = $Account_Details->Current_Balance;
        $current_balance = $Current_Balance['0'];
        $Amount_Past_Due = $Account_Details->Amount_Past_Due;
        $amount_past_due = $Amount_Past_Due['0'];
        // end additionals details
        $Date_of_Last_Payment = $Account_Details->Date_of_Last_Payment;
        $date_last_payment = $Date_of_Last_Payment['0'];
        $AccountHoldertypeCode = $Account_Details->AccountHoldertypeCode;
        $acc_holder_type = $AccountHoldertypeCode['0'];
        $CurrencyCode = $Account_Details->CurrencyCode;
        $currency = $CurrencyCode['0'];
        $CAIS_Account_History_Due_date = $Account_Details->CAIS_Account_History->Days_Past_Due;
        $last_history_duedays = $CAIS_Account_History_Due_date['0'];
        $account_status1 = account_status_good_bad("{$account_status}", "{$last_history_duedays}");
        // Categorize account as Good/Bad or Closed
        $CAIS_Account_History_Year = $Account_Details->CAIS_Account_History->Year;
        $last_history_year = $CAIS_Account_History_Year['0'];
        $CAIS_Account_History_Month = $Account_Details->CAIS_Account_History->Month;
        $last_history_month = $CAIS_Account_History_Month['0'];
        $account_holder_lname = $Account_Details->CAIS_Holder_Details->Surname_Non_Normalized;
        $account_holder_fname = $Account_Details->CAIS_Holder_Details->First_Name_Non_Normalized;
        $full_name = $account_holder_fname['0'] . ' ' . $account_holder_lname['0'];
        $Gender_Code = $Account_Details->CAIS_Holder_Details->Gender_Code;
        $gender = $Gender_Code['0'];
        $Income_TAX_PAN = $Account_Details->CAIS_Holder_Details->Income_TAX_PAN;
        $pan = @$Income_TAX_PAN['0'];
        $Passport_Number = $Account_Details->CAIS_Holder_Details->Passport_Number;
        $passport = @$Passport_Number['0'];
        $Date_of_birth = $Account_Details->CAIS_Holder_Details->Date_of_birth;
        $dob = $Date_of_birth['0'];
        $First_Line_Of_Address_non_normalized = $Account_Details->CAIS_Holder_Address_Details->First_Line_Of_Address_non_normalized;
        $Second_Line_Of_Address_non_normalized = $Account_Details->CAIS_Holder_Address_Details->Second_Line_Of_Address_non_normalized;
        $Third_Line_Of_Address_non_normalized = $Account_Details->CAIS_Holder_Address_Details->Third_Line_Of_Address_non_normalized;
        $address = $First_Line_Of_Address_non_normalized['0'] . ' ' . $Second_Line_Of_Address_non_normalized['0'] . ' ' . $Third_Line_Of_Address_non_normalized['0'];
        $City_non_normalized = $Account_Details->CAIS_Holder_Address_Details->City_non_normalized;
        $city = $City_non_normalized['0'];
        $State_non_normalized = $Account_Details->CAIS_Holder_Address_Details->State_non_normalized;
        $state = $State_non_normalized['0'];
        $ZIP_Postal_Code_non_normalized = $Account_Details->CAIS_Holder_Address_Details->ZIP_Postal_Code_non_normalized;
        $zipcode = $ZIP_Postal_Code_non_normalized['0'];
        $Telephone_Number = $Account_Details->CAIS_Holder_Phone_Details->Telephone_Number;
        $telephone = $Telephone_Number['0'];
        $EMailId = $Account_Details->CAIS_Holder_Phone_Details->EMailId;
        $email_id = $EMailId['0'];
        $account_id = 0;
        if ($account_status1 == "Bad") {
            $query = "SELECT * FROM `tbl_banks` WHERE `bank` = '{$subscriber_name}' order by id DESC limit 1";
            $exe = mysql_query_with_throw($query);
            if (mysql_num_rows($exe) == 0) {
                $select_bank = mysql_query_with_throw("INSERT INTO `tbl_banks` ( `bank` , `logo` , `status` ,\n`add_date`) VALUES ('{$subscriber_name}', '', '0', NOW())");
                $bankidn = mysql_insert_id();
            } else {
                $user_code = mysql_fetch_assoc($exe);
                $bankidn = $user_code['id'];
            }
            $year = date("y");
            $month = date("m");
            $date = date("d");
            $rand2 = mt_rand(1000000, 9999999);
            $unikdueid = "DI-" . $date . $month . $year . '-' . $rand2;
            $product_type = get_account_type($account_type);
            // $dateofbirth = $_SESSION['myForm']['dob_yy'].'-'.$_SESSION['myForm']['dob_mm'].'-'.$_SESSION['myForm']['dob_dd'];
            $query = "INSERT INTO `tbl_accounts` ( `id` , `account` , `balance`, `bank` ,\n`product_type` , `account_no` , `date_opened` , `date_closed` , `dateofbirth` ,\n`pancard` , `otherbank` , `unikdueid` , `caption` , `notes` , `alert`, `status` ,\n`userid` , `payin` ,  `add_date`) VALUES (0, '{$full_name}', '{$balance}', '{$bankidn}',\n'{$product_type}', '{$account_number}', '{$date_opened}', '{$date_closed}', '{$dob}', '{$pan}',\n'{$otherbank}', '{$unikdueid}', '{$caption}', '{$notes}', '0', '', '" . $_SESSION['GTUserID'] . "',\n'{$rwspayfull}', NOW());";
            $result = mysql_query_with_throw($query);
            $account_id = mysql_insert_id();
        }
        $sql_accounts = "INSERT INTO `tbl_getaccounts` (`user_id`, `score_id`, `identification_number`,\n`subscriber_name`, `account_number`, `portfolio_type`, `account_type`, `account_status`,\n`account_status1`, `highcredit_loanamount`, `terms_duration`, `date_open`, `date_closed`,\n`date_last_payment`, `acc_holder_type`, `currency`, `last_history_year`, `last_history_month`,\n`last_history_duedays`, `full_name`, `gender`, `pan`, `passport`, `dob`, `address`, `city`, `state`,\n`zipcode`, `telephone`, `email_id`, `created`, `account_id`, `bank`, `date_reported`, `current_balance`, \n`amount_due`, `value_collateral`, `type_collateral` )\nVALUES ('{$user_id}', '{$score_id}', '{$identification_number}', '{$subscriber_name}',\n'{$account_number}', '{$portfolio_type}', '{$account_type}', '{$account_status}', '{$account_status1}',\n'{$highcredit_loanamount}', '{$terms_duration}', '{$date_open}', '{$date_closed}', '{$date_last_payment}',\n'{$acc_holder_type}', '{$currency}', '{$last_history_year}', '{$last_history_month}', '{$last_history_duedays}',\n'{$full_name}', '{$gender}', '{$pan}', '{$passport}', '{$dob}', '{$address}', '{$city}', '{$state}', '{$zipcode}', '{$telephone}',\n'{$email_id}', '{$created_date}', '{$account_id}', '{$bankidn}', '{$date_reported}', '{$current_balance}', '{$amount_past_due}',\n'{$value_of_collateral}', '{$type_of_collateral}' );";
        $exe = mysql_query_with_throw($sql_accounts);
    }
    //echo "<h1>List  Of Applications( CAPS)</h1>";
    $CAPS = $xml->CAPS;
    // Fetch Main Object from XML
    foreach ($CAPS->CAPS_Application_Details as $Apps_Details) {
        $Subscriber_code = $Apps_Details->Subscriber_code;
        $subscriber_code = $Subscriber_code['0'];
        $Subscriber_Name = $Apps_Details->Subscriber_Name;
        $subscriber = $Subscriber_Name['0'];
        $Date_of_Request = $Apps_Details->Date_of_Request;
        $request_date = $Date_of_Request['0'];
        $Product = $Apps_Details->Product;
        $product = $Product['0'];
        $ReportNumber = $Apps_Details->ReportNumber;
        $report_number = $ReportNumber['0'];
        $Enquiry_Reason = $Apps_Details->Enquiry_Reason;
        $enquiry_reason = $Enquiry_Reason['0'];
        $Finance_Purpose = $Apps_Details->Finance_Purpose;
        $finance_purpose = $Finance_Purpose['0'];
        $Amount_Financed = $Apps_Details->Amount_Financed;
        $amount_financed = $Amount_Financed['0'];
        $Duration_Of_Agreement = $Apps_Details->Duration_Of_Agreement;
        $duration_agreement = $Duration_Of_Agreement['0'];
        $First_Name = $Apps_Details->CAPS_Applicant_Details->First_Name;
        $Last_Name = $Apps_Details->CAPS_Applicant_Details->Last_Name;
        $full_name = $First_Name['0'] . ' ' . $Last_Name['0'];
        $Gender_Code = $Apps_Details->CAPS_Applicant_Details->Gender_Code;
        $gender = $Gender_Code['0'];
        $IncomeTaxPan = $Apps_Details->CAPS_Applicant_Details->IncomeTaxPan;
        $pan = $IncomeTaxPan['0'];
        $Date_Of_Birth_Applicant = $Apps_Details->CAPS_Applicant_Details->Date_Of_Birth_Applicant;
        $dob = $Date_Of_Birth_Applicant['0'];
        $Telephone_Number_Applicant_1st = $Apps_Details->CAPS_Applicant_Details->Telephone_Number_Applicant_1st;
        $telephone = $Telephone_Number_Applicant_1st['0'];
        $MobilePhoneNumber = $Apps_Details->CAPS_Applicant_Details->MobilePhoneNumber;
        $mobile = $MobilePhoneNumber['0'];
        $FlatNoPlotNoHouseNo = $Apps_Details->CAPS_Applicant_Address_Details->FlatNoPlotNoHouseNo;
        $BldgNoSocietyName = $Apps_Details->CAPS_Applicant_Address_Details->BldgNoSocietyName;
        $RoadNoNameAreaLocality = $Apps_Details->CAPS_Applicant_Address_Details->RoadNoNameAreaLocality;
        $address = $FlatNoPlotNoHouseNo['0'] . ' ' . $BldgNoSocietyName['0'] . ' ' . $RoadNoNameAreaLocality['0'];
        $City = $Apps_Details->CAPS_Applicant_Address_Details->City;
        $city = $City['0'];
        $State = $Apps_Details->CAPS_Applicant_Address_Details->State;
        $state = $State['0'];
        $PINCode = $Apps_Details->CAPS_Applicant_Address_Details->PINCode;
        $zipcode = $PINCode['0'];
        $non_credit_caps = '';
        $sql_applications = "INSERT INTO `tbl_getapplications` (`user_id`, `score_id`,\n`subscriber_code`, `subscriber`, `request_date`, `product`, `report_number`, `enquiry_reason`,\n`finance_purpose`, `amount_financed`, `duration_agreement`, `full_name`, `gender`, `pan`,\n`dob`, `telephone`, `mobile`, `address`, `city`, `state`, `zipcode`, `non_credit_caps`, `created`)\nVALUES ('{$user_id}', '{$score_id}', '{$subscriber_code}',\n'{$subscriber}', '{$request_date}', '{$product}', '{$report_number}',\n'{$enquiry_reason}', '{$finance_purpose}', '{$amount_financed}', '{$duration_agreement}',\n'{$full_name}', '{$gender}', '{$pan}', '{$dob}', '{$telephone}', '{$mobile}', '{$address}', '{$city}',\n'{$state}', '{$zipcode}', '{$non_credit_caps}', '{$created_date}') ;";
        $exe = mysql_query_with_throw($sql_applications);
    }
    //echo "<h1>List  Of Applications(Non Credit (NC) CAPS)</h1>";
    $NonCreditCAPS = $xml->NonCreditCAPS;
    // Fetch Main Object from XML
    foreach ($NonCreditCAPS->CAPS_Application_Details as $NC_Apps_Details) {
        $Subscriber_code = $Apps_Details->Subscriber_code;
        $subscriber_code = $Subscriber_code['0'];
        $Subscriber_Name = $Apps_Details->Subscriber_Name;
        $subscriber = $Subscriber_Name['0'];
        $Date_of_Request = $Apps_Details->Date_of_Request;
        $request_date = $Date_of_Request['0'];
        $Product = $Apps_Details->Product;
        $product = $Product['0'];
        $ReportNumber = $Apps_Details->ReportNumber;
        $report_number = $ReportNumber['0'];
        $Enquiry_Reason = $Apps_Details->Enquiry_Reason;
        $enquiry_reason = $Enquiry_Reason['0'];
        $Finance_Purpose = $Apps_Details->Finance_Purpose;
        $finance_purpose = $Finance_Purpose['0'];
        $Amount_Financed = $Apps_Details->Amount_Financed;
        $amount_financed = $Amount_Financed['0'];
        $Duration_Of_Agreement = $Apps_Details->Duration_Of_Agreement;
        $duration_agreement = $Duration_Of_Agreement['0'];
        $First_Name = $Apps_Details->CAPS_Applicant_Details->First_Name;
        $Last_Name = $Apps_Details->CAPS_Applicant_Details->Last_Name;
        $full_name = $First_Name['0'] . ' ' . $Last_Name['0'];
        $Gender_Code = $Apps_Details->CAPS_Applicant_Details->Gender_Code;
        $gender = $Gender_Code['0'];
        $IncomeTaxPan = $Apps_Details->CAPS_Applicant_Details->IncomeTaxPan;
        $pan = $IncomeTaxPan['0'];
        $Date_Of_Birth_Applicant = $Apps_Details->CAPS_Applicant_Details->Date_Of_Birth_Applicant;
        $dob = $Date_Of_Birth_Applicant['0'];
        $Telephone_Number_Applicant_1st = $Apps_Details->CAPS_Applicant_Details->Telephone_Number_Applicant_1st;
        $telephone = $Telephone_Number_Applicant_1st['0'];
        $MobilePhoneNumber = $Apps_Details->CAPS_Applicant_Details->MobilePhoneNumber;
        $mobile = $MobilePhoneNumber['0'];
        $FlatNoPlotNoHouseNo = $Apps_Details->CAPS_Applicant_Address_Details->FlatNoPlotNoHouseNo;
        $BldgNoSocietyName = $Apps_Details->CAPS_Applicant_Address_Details->BldgNoSocietyName;
        $RoadNoNameAreaLocality = $Apps_Details->CAPS_Applicant_Address_Details->RoadNoNameAreaLocality;
        $address = $FlatNoPlotNoHouseNo['0'] . ' ' . $BldgNoSocietyName['0'] . ' ' . $RoadNoNameAreaLocality['0'];
        $City = $Apps_Details->CAPS_Applicant_Address_Details->City;
        $city = $City['0'];
        $State = $Apps_Details->CAPS_Applicant_Address_Details->State;
        $state = $State['0'];
        $PINCode = $Apps_Details->CAPS_Applicant_Address_Details->PINCode;
        $zipcode = $PINCode['0'];
        $non_credit_caps = 'yes';
        $sql_applications_non_credit = "INSERT INTO `tbl_getapplications` (`user_id`, `score_id`, `subscriber_code`, `subscriber`, `request_date`, `product`, `report_number`, `enquiry_reason`, `finance_purpose`, `amount_financed`, `duration_agreement`, `full_name`, `gender`, `pan`, `dob`, `telephone`, `mobile`, `address`, `city`, `state`, `zipcode`, `non_credit_caps`, `created`)\nVALUES ('{$user_id}', '{$score_id}', '{$subscriber_code}', '{$subscriber}', '{$request_date}', '{$product}', '{$report_number}', '{$enquiry_reason}', '{$finance_purpose}', '{$amount_financed}', '{$duration_agreement}', '{$full_name}', '{$gender}', '{$pan}', '{$dob}', '{$telephone}', '{$mobile}', '{$address}', '{$city}', '{$state}', '{$zipcode}', '{$non_credit_caps}', '{$created_date}') ;";
        $exe = mysql_query_with_throw($sql_applications_non_credit);
    }
}
		}

    }
}
</script>
<form method="post" action="" name="form1" class="rws-viewapplicants" >
<?php 
// select records from database
$sql = 'SELECT * FROM `uk_job_applicants` WHERE jobid = "' . $_GET['jobid'] . '" ';
$rs = mysql_query_with_throw($sql);
$perpage = 20;
$currentpage = $_REQUEST['currentpage'] ? $_REQUEST['currentpage'] : '1';
$startrecord = ($currentpage - 1) * $perpage;
$totalrows = mysql_num_rows($rs);
$result = mysql_query_with_throw($sql . " order by add_date desc LIMIT {$startrecord}, {$perpage}") or die(mysql_error());
$header = '<div class="jobsdata"><div class="row header"><div class="checkboxdiv"><input name="chkSelectAll" type="checkbox" id="chkSelectAll" value="1" onClick="selectAllChk()"></div><div class="column">First Name</div><div class="column">Mobile</div><div class="column" style="width:200px;">Email ID</div><div class="column">Resume</div><div class="column">Posted on</div><div class="column">Operation</div></div>';
$repeat = '';
$j = 1;
while ($row = mysql_fetch_assoc($result)) {
    if ($row['jobstatus'] == '1') {
        $js = 'Active';
    } else {
        $js = 'Inactive';
    }
    $repeat .= '<div class="row"><div class="checkboxdiv"><input name="chkjobid[' . $j . ']" type="checkbox" value="' . $row['ApplicantID'] . '"></div><div class="column">' . $row['applicantfirstname'] . '</div><div class="column">' . $row['applicantmobile'] . '</div><div class="column" style="width:200px;">' . $row['applicantemail'] . '</div><div class="column"><a href="useruploads/' . togetpath($row["add_date"]) . $row['applicantcvattachment'] . '"  target="_blank">View Resume</a></div><div class="column">' . toshowformatdatetime($row["add_date"]) . '</div><div class="column"><a href="index.php?p=applicantdetails&aptid=' . $row['ApplicantID'] . '&jobid=' . $_GET['jobid'] . '">View Details</a></div></div>';
    $j++;
}
echo $header . $repeat . '</div>';
?>
<div class="clear"></div>
    ?>
</td>
                </tr>

                 <tr>
                  <td height="30" align="left" class="blackbold">Current Offer Status</td>
                  <td align="left" class="head2"><?php 
    echo togetstatusofferlabel($admin->ac_id, $admin->id);
    ?>
</td>
                </tr>


        <?php 
    $queryfp = "SELECT * FROM `tbl_offeremi` WHERE `offerid` = " . $row["id"];
    $resultfp = mysql_query_with_throw($queryfp);
    $totalfp = mysql_num_rows($resultfp);
    if ($totalfp > 0) {
        ?>
                <tr>
                  <td align="left" class="blackbold" height="1" colspan="2"></td>
                </tr>
                <tr>
                  <td align="left" class="blackbold" style="padding:10px 0;" colspan="2">
                  	<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    	<tr>
                  <td align="left" class="blackbold" colspan="2"><h5>Current Offer EMI With Amount and Date</h5></td>
                </tr>
                          <tr>
                            <td style="padding:10px 0;" width="25%"><strong>Amount</strong></td>
                            <td style="padding:10px 0;"><strong>Date</strong></td>
$fetch_user = "******";
$result = mysql_query_with_throw($fetch_user);
$update_array = array();
while ($row = mysql_fetch_array($result)) {
    $user_id = $row['user_id'];
    $user_mobile = $row['mobile'];
    $user_email = $row['email'];
    $user_name = $row['name'];
    // send sms and email to user and others
    $usermessage = 'Dear ' . $user_name . ', Please log into www.clearmydues.com with OTP to get your free credit report.';
    $file_list = array(array("path" => $filePath1, "file_name" => $id_name));
    $to = array($user_email);
    $cc = array("");
    $bcc = array("");
    $subject = "Registration Validation Pending - Clearmydues";
    $body = '<p>
         Dear ' . $user_name . ',<br><br> Thanks for registering with clearmydues. Please login with OTP to get your free credit report.
         </p>';
    send_mail_through_queue($to, $cc, $bcc, $subject, $body, $file_list);
    $sendsmstouser = sendsms($user_mobile, $usermessage);
    // update status in job table
    $update_user = "******";
    $update_user_check = mysql_query_with_throw($update_user);
    $update_user_check_set = mysql_fetch_assoc($update_user_check);
    if (!$update_user_check_set['otp_status']) {
        // insert userid and status to 1
        creteLogs(__FILE__, __LINE__, "send email to user " . $user_id . "about otp 1 time");
        $insert_data = "insert into tbl_jobstatus (`user_id`, `otp_status`) \n                    values ({$user_id}, 1);";
        $insert_data_status = mysql_query_with_throw($insert_data);
    }
}
        if (strlen($_POST['password']) < 6) {
            $errors[] = 'Minimum password length is 6 characters!';
        }
    }
    if (empty($_POST["cpassword"])) {
        $errors[] = 'Confirm Password  field can\'t be blank!';
    }
    if ($_POST["cpassword"] != $_POST["password"]) {
        $errors[] = 'Passwords do not match!';
    }
    /*if (empty($_POST["captcha_code"]) ) {$errors[]='Security Code  field can\'t be blank!';}*/
    /*if (empty($_POST["recaptcha_response_field"])) {$errors[]='Security Code';}*/
    if (empty($errors)) {
        if (trim($_POST["password"]) != "") {
            $pass = md5($_POST["password"]);
            $qpu = mysql_query_with_throw("UPDATE `tbl_userdetails` SET `password` = '{$pass}' , `otpstatus` = '1' WHERE `id`=" . $_SESSION["GTUserID"]);
            $_SESSION["otpstatus"] = "1";
            echo "<script>document.location.href='index.php?p=myaccount'</script>";
        } else {
            $message_pass = '******';
        }
    }
} else {
    //report the errors
    if (!empty($errors)) {
        //report the errors
        echo '<div id="gt-formfeedback"><b><font size="4">WHOOPS! Please review the following issues:</font></b><ul>';
        foreach ($errors as $msg) {
            //prints each error
            echo "<li>{$msg}</li>";
        }
if (isset($_POST['button'])) {
    $email_verify = $_POST['email_verify'];
    $score_id = $_POST['score_id'];
    $errors = array();
    //Initialize error array
    if (empty($email_verify)) {
        $errors[] = "Verification code can not be blank!";
    }
    if (empty($errors)) {
        if ($email_verify) {
            $msg_register = '<div id="gt-formfeedback">Email Verified.......</div>';
            $user_details = mysql_query_with_throw('SELECT email_verify FROM `tbl_getscore` WHERE id = "' . $score_id . '"');
            $user_code = mysql_fetch_assoc($user_details);
            $code = $user_code['email_verify'];
            if ($code == $email_verify) {
                $user_details = mysql_query_with_throw("update `tbl_getscore` set  email_verify='Verified' where id='{$score_id}'");
                $msg_register = '<div id="gt-formfeedback">Email Verified....... Move to next step.</div>';
                header("location:index.php?p=experian-flow&verified=1&score_id={$score_id}");
            } else {
                $msg_register = '<div id="gt-formfeedback">Please Input correct code received on your email id.</div>';
            }
        }
    } else {
        //report the errors
        if (!empty($errors)) {
            //report the errors
            echo '<div id="gt-formfeedback"><b><font size="4">WHOOPS! Please review the following issues:</font></b><ul>';
            foreach ($errors as $msg) {
                //prints each error
                echo "<li>{$msg}</li>";
            }
<br />
If you are having trouble logging in, please call us immediately on ' . $adminphone . '.</div>';
                } elseif ($rowl["status"] == 0) {
                    $msg_login = '******' . $adminphone . '.</div>';
                } else {
                    $_SESSION['GTUserID'] = $rowl["id"];
                    $_SESSION['GTUserName'] = $rowl["name"];
                    $_SESSION['GTFullUserName'] = $rowl["firstname"] . ' ' . $rowl["middlename"] . ' ' . $rowl["lastname"];
                    $_SESSION['GTUserEmail'] = $rowl["email"];
                    $_SESSION['GTUserMobile'] = $rowl["mobile"];
                    //$taccount = togettotalaccount($_SESSION['GTUserID']);
                    checkMobileOrDesktop($_SESSION['GTUserID']);
                    #if($taccount>0){ $link = $baseurl.'index.php?p=view-account2&aid='.$taccount; } else {  $link = $baseurl.'index.php?p=add-account&edit=true&add=new'; }
                    /*$qvalup = "UPDATE `uk_full_access_account_members` SET `add_date` = NOW() WHERE `RecruiterID` =".$rowl["RecruiterID"];
                    		$result_valup = mysql_query_with_throw($qvalup);		*/
                    $checkreportquery = mysql_query_with_throw("SELECT `user_id` FROM `tbl_experian_data` WHERE `user_id`=" . $_SESSION['GTUserID']);
                    $rowl = mysql_fetch_assoc($checkreportquery);
                    if ($rowl["user_id"]) {
                        $link = $baseurl . 'index.php?p=my-score&type=bad';
                    } else {
                        $link = $baseurl . 'CMD.php';
                    }
                    $togetprofile = togetprofileitems($_SESSION['GTUserID'], 'mobile');
                    if ($togetprofile == "") {
                        echo "<script>document.location.href='index.php?p=edit-profile'</script>";
                    } else {
                        echo "<script>document.location.href='" . $link . "'</script>";
                    }
                }
            } else {
                $msg_login = '<div id="gt-formfeedback">Sorry! The given Username/Password combination does not match.<br />
    if (empty($errors)) {
        if (trim($_POST["rwsusername"]) != "" && trim($_POST["rwspassword"]) != "") {
            $rwsusername = mysql_real_escape_string($_POST['rwsusername']);
            $rwspassword = md5($_POST['rwspassword']);
            $query_login = mysql_query_with_throw("SELECT `id`,`firstname` as name,`email`, `middlename`, `lastname`,`validate`,`status` , `otpstatus` , `mobile` FROM `tbl_userdetails` WHERE `email`='{$rwsusername}' and `password`='{$rwspassword}' ");
            if (mysql_num_rows($query_login) > 0) {
                $rowupd = mysql_fetch_assoc($query_login);
                //echo "UPDATE  `tbl_userdetails` SET  `validate` =  '1', `mvalidate` =  '1' WHERE  `id` =".$rowupd["id"];
                if ($rowupd["otpstatus"] == 0) {
                    $updatevalidation = mysql_query_with_throw("UPDATE  `tbl_userdetails` SET  `validate` =  '1', `mvalidate` =  '1' WHERE  `id` =" . $rowupd["id"]);
                    $totalrowsnnnn = mysql_num_rows($updatevalidation);
                    $_SESSION["otpstatus"] = '0';
                } else {
                    $_SESSION["otpstatus"] = '1';
                }
                $queryloginfianal = mysql_query_with_throw("SELECT `id`,`firstname` as name,`email`, `middlename`, `lastname`,`validate`,`status`,`otpstatus`,`mobile` FROM `tbl_userdetails` WHERE `email`='{$rwsusername}' and `password`='{$rwspassword}'");
                $rowl = mysql_fetch_assoc($queryloginfianal);
                if ($rowl["validate"] == 0) {
                    $msg_login = '******' . $adminphone . '.</div>';
                } elseif ($rowl["status"] == 0) {
                    $msg_login = '******' . $adminphone . '.</div>';
                } else {
                    $_SESSION['GTUserID'] = $rowl["id"];
                    $_SESSION['GTUserName'] = $rowl["name"];
                    $_SESSION['GTFullUserName'] = $rowl["firstname"] . ' ' . $rowl["middlename"] . ' ' . $rowl["lastname"];
                    $_SESSION['GTUserEmail'] = $rowl["email"];
                    $_SESSION['GTUserMobile'] = $rowl["mobile"];
<?php

include "includes/config.php";
$sql_query = mysql_query_with_throw("SELECT id,file_name FROM tbl_experian_data;");
while ($row = mysql_fetch_array($sql_query)) {
    global $report_path;
    $path = $row['file_name'];
    $id = $row['id'];
    $keywords = split("/", $path);
    if ($keywords[0] == "htmlreport") {
        $path = $report_path . $keywords[1];
        $sql_query2 = mysql_query("UPDATE `tbl_experian_data` SET `file_name`='{$path}' WHERE `id`='{$id}';");
    }
}
               if (!empty($_FILES['applicantcvattachment']['name'])) {
                   $fileThumbnail = $_FILES['applicantcvattachment']['tmp_name'];
                   $arrayimage = $_FILES['applicantcvattachment']['name'];
                   $extensionq = pathinfo($arrayimage);
                   $imgtype1 = trim($extensionq['extension']);
                   $applicantcvattachment = $array_rand[$rand_keys[0]] . "_" . $rand2 . "_" . $array_rand[$rand_keys[1]] . "_" . $rand1 . "_" . $date . "." . $imgtype1;
                   $add_thumbnail = $uploadfolder . "/" . $applicantcvattachment;
                   if (is_uploaded_file($fileThumbnail)) {
                       move_uploaded_file($fileThumbnail, $add_thumbnail);
                   }
                   $_SESSION["UserUploads"] = $applicantcvattachment;
               }
               global $baseurl;
               $sql = "INSERT IGNORE INTO uk_job_applicants (applicanttitle, applicantfirstname, applicantlastname, applicantmobile, applicantemail, applicantcvattachment, applicantadditionalinformation, applicantukworkeligibility, applicanttermsread, applicantapplydate, jobid, status, add_date)\nVALUES ('{$applicanttitle}','{$applicantfirstname}','{$applicantlastname}','{$applicantmobile}','{$applicantemail}','" . $_SESSION["UserUploads"] . "','{$applicantadditionalinformation}','{$applicantukworkeligibility}','{$applicanttermsread}','{$applicantapplydate}','" . $_GET["jobid"] . "','1',NOW())";
               // Run SQL
               $resql = mysql_query_with_throw($sql);
               $apid = mysql_insert_id();
               $_SESSION["UserUploads"] = "";
               // Set it to saved
               $formsaved = true;
               $regid = base64_encode('EJOB-Network-' . $apid);
               $subject = "EJOB Network - " . $applicantfirstname . "  " . $applicantlastname . " Applied for job " . togetjobname($_GET["jobid"]) . ", " . togetjoblocation($_GET["jobid"]);
               $body = '<table width="634" border="0" align="left" cellpadding="0" cellspacing="0">
 <tr>
   <td height="52" bgcolor="#e64135"><font style="font-family:Arial, Helvetica, sans-serif; font-size:24px; font-weight:bold; color:#FFFFFF;">&nbsp;<span class="style1">EJOB Network  - </span></font><span style="color: #FFFFFF"><strong><font style="font-family:Arial, Helvetica, sans-serif; font-size:24px; color:#ffffff;"> Applicant Details</font></strong></span></td>
 </tr>
 <tr>
   <td align="left" valign="middle"><table width="633" border="0" align="center" cellpadding="0" cellspacing="0">
     <tr>
       <td height="22" colspan="2" align="left" valign="middle"></td>
       </tr>
       if (!eregi('^[[:alnum:]][a-z0-9_\\.\\-]*@[a-z0-9\\.\\-]+\\.[a-z]{2,4}$', stripslashes(trim($_POST['emailid'])))) {
           $errors[] = 'Please provide a valid email address!';
       }
       // if eregi
       // if empty email
   }
   if (empty($_POST["captcha_code"])) {
       $errors[] = "Captcha code field can't be blank!";
   }
   if (empty($errors)) {
       if ($securimage->check($_POST['captcha_code']) == false) {
           $message_pass = '******';
       } else {
           if (trim($_POST["emailid"])) {
               $emailid = trim($_POST["emailid"]);
               $query_pass = mysql_query_with_throw("SELECT `id`,`firstname` as name,`email`,`password`,`validate`,`status` FROM `tbl_userdetails` WHERE `email`='{$emailid}'");
               if (mysql_num_rows($query_pass) > 0) {
                   $rowp = mysql_fetch_assoc($query_pass);
                   $pass = $rowp["password"];
                   $firstname = $rowp["name"];
                   $registeremail = $rowp["email"];
                   $validateid = base64_encode("ClearMyDues-" . $rowp["id"]);
                   $activeurl = $baseurl . "index.php?p=validate&vid=" . $validateid;
                   $subject = "{$sitename} - Activate your Account";
                   $body = '<table width="634" border="0" align="left" cellpadding="0" cellspacing="0">
 <tr>
   <td height="52" bgcolor="#00798c"><font style="font-family:Arial, Helvetica, sans-serif; font-size:24px; font-weight:bold; color:#FFFFFF;">&nbsp;<span class="style1">' . $sitename . '  - </span></font><span style="color: #FFFFFF"><strong><font style="font-family:Arial, Helvetica, sans-serif; font-size:24px; color:#ffffff;">Activate your Account</font></strong></span></td>
 </tr>
 <tr>
   <td align="left" valign="middle"><table width="633" border="0" align="center" cellpadding="0" cellspacing="0">
     <tr>
     $errors[] = 'Confirm Password  field can\'t be blank!';
 }
 if ($_POST["cpassword"] != $_POST["password"]) {
     $errors[] = 'Passwords do not match!';
 }
 if (empty($_POST["captcha_code"])) {
     $errors[] = 'Security Code  field can\'t be blank!';
 }
 /*if (empty($_POST["recaptcha_response_field"])) {$errors[]='Security Code';}*/
 if (empty($errors)) {
     if ($securimage->check($_POST['captcha_code']) == false) {
         $message_pass = '******';
     } else {
         if (trim($_POST["password"]) != "") {
             $pass = md5($_POST["password"]);
             $qpu = mysql_query_with_throw("UPDATE `tbl_userdetails` SET `password` = '{$pass}' WHERE `id`='{$id}'");
             echo "<script>document.location.href='index.php?p=success'</script>";
         } else {
             $message_pass = '******';
         }
     }
 } else {
     //report the errors
     if (!empty($errors)) {
         //report the errors
         echo '<div id="gt-formfeedback"><b><font size="4">WHOOPS! Please review the following issues:</font></b><ul>';
         foreach ($errors as $msg) {
             //prints each error
             echo "<li>{$msg}</li>";
         }
         // end of foreach
        		case "Active":
        			$sql="UPDATE `uk_master_admin` SET `status`='1'  WHERE `id` in ($chkid)";
        			mysql_query_with_throw($sql);
        			$msg='Status has been updated successfully to ACTIVE!';
        			$class='successmsg';
        		break; */
        case "Delete":
            $sql = "delete from `uk_master_admin` where `id` in ({$chkid})";
            mysql_query_with_throw($sql);
            $msg = 'Records has been deleted successfully!';
            $class = 'successmsg';
            break;
    }
}
$query = "SELECT * FROM `uk_master_admin` where id!=1 order by id desc";
$admins = mysql_query_with_throw($query);
$totalrows = mysql_num_rows($rs);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ADMIN CONSOLE // <?php 
echo $sitename;
?>
 Website</title>
<link rel="stylesheet" href="resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/invalid.css" type="text/css" media="screen" />
<!-- Internet Explorer Fixes Stylesheet -->
<!--[if lte IE 7]>
<input name="delete" type="button" id="delete" value="Delete" onclick="javascript:del_rec();" />&nbsp;&nbsp;<input name="active" type="button" id="active" value="Active" onclick="javascript:enable_rec();" />&nbsp;&nbsp; <input name="inactive" type="button" id="inactive" value="Inactive" onclick="javascript:disable_rec();" />
<span style="float:right; clear:both; overflow:hidden; text-align:right; "><input type="text" name="search_txt" id="search_txt" value="" /> <input name="search" type="button" id="search" value="Search" onclick="javascript:SearchRecord();" /></span>
</div>
<?php 
        // select records from database
        $search_txt = $_POST["search_txt"];
        if ($search_txt != "") {
            $nquery = " AND (`jobpostsubject` LIKE '%{$search_txt}%' OR `jobpostlocationtowncity` LIKE '%{$search_txt}%' OR `jobpostdescription`  LIKE '%{$search_txt}%'  OR `keywords`  LIKE '%{$search_txt}%' ) ";
        }
        $sql = 'SELECT * FROM `uk_master_live_job_search` WHERE `jobstatus` = "' . $sid . '" AND jobpostrecruiteremployer = "' . $_SESSION['GTUserID'] . '" ' . $nquery;
        $rs = mysql_query_with_throw($sql);
        $perpage = 20;
        $currentpage = $_REQUEST['currentpage'] ? $_REQUEST['currentpage'] : '1';
        $startrecord = ($currentpage - 1) * $perpage;
        $totalrows = mysql_num_rows($rs);
        $result = mysql_query_with_throw($sql . " order by postjobdatetime DESC LIMIT {$startrecord}, {$perpage}") or die(mysql_error());
        if ($totalrows > 0) {
            $header = '<div class="jobsdata"><div class="row header"><div class="checkboxdiv"><input name="chkSelectAll" type="checkbox" id="chkSelectAll" value="1" onClick="selectAllChk()"></div><div class="column">Job Title</div><div class="column">Town/City</div><div class="column">Expiry Date</div><div class="column">Hits</div><div class="column">Status</div><div class="column">View Applicants</div><div class="column">Last Updated</div><div class="column">Add Date</div><div class="column">Posted by</div><div class="column">Respond Email</div><div class="column">Functions</div></div>';
            $repeat = '';
            $j = 1;
            while ($row = mysql_fetch_assoc($result)) {
                if ($row['jobstatus'] == '1') {
                    $js = '<span style="color:#009e1e; font-weight:bold;">Active</span>';
                } else {
                    $js = '<span style="color:#FF0000; font-weight:bold;">Inactive</span>';
                }
                if (in_array($row["JobID"], $chkididtest)) {
                    $checked = 'checked="checked"';
                } else {
                    $checked = '';
                }
<?php

include "../includes/config.php";
tocheckvaliddetails('JobID', 'uk_master_live_job_search', ' JobID= "' . $_GET['id'] . '" ', 'view_jobs.php?page=jobs');
$id = $_GET['id'];
$row = mysql_fetch_assoc(mysql_query_with_throw("SELECT * FROM `uk_master_live_job_search` WHERE `JobID`='{$id}'"));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ADMIN CONSOLE // Jobs Site</title>
<link rel="stylesheet" href="resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/invalid.css" type="text/css" media="screen" />
<!-- Internet Explorer Fixes Stylesheet -->
<!--[if lte IE 7]>
<link rel="stylesheet" href="resources/css/ie.css" type="text/css" media="screen" />
<![endif]-->
<script type="text/javascript" src="resources/scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="resources/scripts/simpla.jquery.configuration.js"></script>
<!--[if IE]><script type="text/javascript" src="resources/scripts/jquery.bgiframe.js"></script><![endif]-->
<!-- Internet Explorer .png-fix -->
<!--[if IE 6]>
<script type="text/javascript" src="resources/scripts/DD_belatedPNG_0.0.7a.js"></script>
<script type="text/javascript">
DD_belatedPNG.fix('.png_bg, img, li');
</script>
<![endif]-->
<style type="text/css">
table tr td{text-transform:capitalize;}
	  <tr>
        <td height="30" align="left" valign="middle"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#333333;"> Verify Code:</font></td>
        <td height="30" align="left" valign="middle"><font style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000; ">' . $rand_str . '</font></td>
      </tr> 	  
      <tr>
        <td height="1" colspan="2" align="left" valign="middle" bgcolor="#e5e5e5"></td>
      </tr>   
    </table></td>
  </tr>
</table>';
    $subject = "Email Verification by ClearMyDues..";
    sendmail($email, $subject, '*****@*****.**', 'Clear My Dues', $body, $path, $resumefilename);
    $_SESSION['email_verify'] = $email;
}
$user_details = 'SELECT * FROM `tbl_userdetails` WHERE id = "' . $user_id . '"';
$exe_user_details = mysql_query_with_throw($user_details);
$userdata = mysql_fetch_assoc($exe_user_details);
?>
<link href="<?php 
echo $baseurl;
?>
css/jquery-ui.css" rel="stylesheet"> 
<script type="text/javascript" src="<?php 
echo $baseurl;
?>
js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<?php 
echo $baseurl;
?>
js/jquery-ui.js"></script>
<script type="text/javascript" language="JavaScript">
<?php

checklogin();
tocheckvaliddetails('ApplicantID', 'uk_job_applicants', 'ApplicantID = "' . $_GET['aptid'] . '" AND jobid= "' . $_GET['jobid'] . '" ', 'index.php');
$id = $_GET['aptid'];
$row = mysql_fetch_assoc(mysql_query_with_throw("SELECT * FROM `uk_job_applicants` WHERE `ApplicantID`='{$id}'"));
?>
<h1 class="gt-heading">Applicants Details</h1>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                <td width="28%;">Applicant Title</td>
                <td><?php 
echo $row["applicanttitle"];
?>
</td>
              </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td>Name</td>
                <td><?php 
echo $row["applicantfirstname"] . ' ' . $row["applicantlastname"];
?>
</td>
              </tr>
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td>Mobile</td>
<?php

$vid = base64_decode($_GET["vid"]);
$validateid = str_replace('ClearMyDues-', '', $vid);
$query_val = "SELECT * FROM `tbl_userdetails` WHERE `id` =" . $validateid;
$result_val = mysql_query_with_throw($query_val);
$total_val = mysql_num_rows($result_val);
if ($total_val > 0) {
    $row = mysql_fetch_assoc($result_val);
    if ($row["validate"] == 1) {
        $error_message = '<div id="gt-formsuccess">Your account has already been validated. Please log in!</div>';
    } else {
        $qvalup = "UPDATE `tbl_userdetails` SET `validate` = '1' WHERE `id` =" . $validateid;
        $result_valup = mysql_query_with_throw($qvalup);
        $error_message = '<div id="gt-formsuccess">Your account has been validated successfully. Please login to access our member\'s access area.</div>';
    }
} else {
    $error_message = '<div id="gt-formfeedback">Your email varification code is wrong. Please use the correct link that is in email.<div>';
}
?>
<div class="gt-heading"><p class="sub-heading-label" >Account Validation</p></div>

<p>Welcome to <?php 
echo $sitename;
?>
 registration verification.</p>

<p  class="rwserror"><?php 
echo $error_message;
?>
</p>
<?php

include "../includes/config.php";
if ($_SESSION['aid'] == '') {
    header("location:index.php");
}
$userid = $_GET["uid"];
$aid = $_GET["id"];
$query = "SELECT t1.*,t2.id as ac_id,t2.account,t2.balance,t2.bank,t2.status as ac_status,t2.alert,t2.account_no,t2.date_opened,t2.date_closed,t2.dateofbirth,t2.pancard,t2.notes, t2.product_type, t2.principal, t2.interest, t2.caption, t2.unikdueid, t2.other_charges, t2.last_payment_date, t2.last_payment_done, t2.payin FROM `tbl_userdetails` as t1 INNER JOIN `tbl_accounts` as t2 ON t1.id=t2.userid WHERE t1.id = {$userid} AND t2.id={$aid}";
$result = mysql_query_with_throw($query);
$row = mysql_fetch_assoc($result);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ADMIN CONSOLE // <?php 
echo $sitename;
?>
 Website</title>
<link rel="stylesheet" href="resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/invalid.css" type="text/css" media="screen" />
<!-- Internet Explorer Fixes Stylesheet -->
<!--[if lte IE 7]>
<link rel="stylesheet" href="resources/css/ie.css" type="text/css" media="screen" />
<![endif]-->
<script type="text/javascript" src="resources/scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="resources/scripts/simpla.jquery.configuration.js"></script>
<script language="javascript" type="text/javascript" src="tiny_mce/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript" src="tiny_mce/tiny_mce_set.js"></script>
    $apwd = mysql_real_escape_string($_POST['password']);
    $admres = mysql_query_with_throw("select id,last_login,email,name,bank from tbl_bankperson where `email`='{$email}' and `password`='{$apwd}'");
    if (mysql_num_rows($admres) > 0) {
        $adm = mysql_fetch_assoc($admres);
        if (!in_array($_SESSION['bid'], $array_bankuser)) {
            $loc = "view_users_offer.php?page=offers";
        } else {
            $loc = "view_users.php?page=users";
        }
        $_SESSION['bid'] = $adm["id"];
        $_SESSION['bname'] = $adm["name"];
        $_SESSION['bemail'] = $adm["email"];
        $_SESSION['banid'] = $adm["bank"];
        $_SESSION['blastlogin'] = $adm["last_login"];
        $sql2 = "UPDATE `tbl_bankperson` SET `last_login` = NOW() WHERE `id` = " . $_SESSION['bid'];
        $rs2 = mysql_query_with_throw($sql2) or die(mysql_error());
        header("location:{$loc}");
    } else {
        $msg = "Login Fail ! Please try again!";
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>HELLO ADMIN // Please Sign In</title>
<link rel="stylesheet" href="resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/style.css" type="text/css" media="screen" />
<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
<link rel="stylesheet" href="resources/css/invalid.css" type="text/css" media="screen" />
          <td><strong>Operations</strong></td>
        </tr>
        <?php 
$search_txt = $_POST["search_txt"];
if ($search_txt != "") {
    $nquery = " AND (`jobpostsubject` LIKE '%{$search_txt}%' OR `jobpostlocationtowncity` LIKE '%{$search_txt}%' OR `jobpostdescription`  LIKE '%{$search_txt}%'  OR `keywords`  LIKE '%{$search_txt}%' ) ";
}
$j = 1;
$rid = $_GET["rid"];
$query = "SELECT * FROM `uk_master_live_job_search` WHERE `jobpostrecruiteremployer` = '{$rid}'  " . $nquery;
$rs = mysql_query_with_throw($query);
$perpage = 20;
$currentpage = $_REQUEST['currentpage'] ? $_REQUEST['currentpage'] : '1';
$startrecord = ($currentpage - 1) * $perpage;
$totalrows = mysql_num_rows($rs);
$result = mysql_query_with_throw($query . " ORDER BY `JobID` DESC LIMIT {$startrecord}, {$perpage}") or die(mysql_error());
?>
	
        <?php 
while ($row = mysql_fetch_assoc($result)) {
    ?>
        <tr align="center" class="normal">
        <td width="5%"><?php 
    echo $j;
    ?>
</td>
			<td width="5%"><input name="chkid[<?php 
    echo $j;
    ?>
]" type="checkbox" id="chkid[<?php 
    echo $j;
function process_form()
{
    // Read POST request params into global vars
    // FILL IN YOUR EMAIL
    //$to = "*****@*****.**";
    $to = "*****@*****.**";
    $from = "Notification from Ejobs Network<*****@*****.**>";
    $subject = trim($_POST['subject']);
    $jobpostsubject = trim($_POST['jobpostsubject']);
    $jobpostlocationtowncity = trim($_POST['jobpostlocationtowncity']);
    $jobpostlocationcounty = trim($_POST['jobpostlocationcounty']);
    $jobpostpostcode = trim($_POST['jobpostpostcode']);
    $jobpostjobtype = trim($_POST['jobpostjobtype']);
    $jobpostsalary = trim($_POST['jobpostsalary']);
    $jobpostsectorindustry = trim($_POST['jobpostsectorindustry']);
    $jobpostdescription = trim($_POST['jobpostdescription']);
    $jobpostrecruiteremployer = trim($_POST['jobpostrecruiteremployer']);
    $jobpostrecruitercontactperson = trim($_POST['jobpostrecruitercontactperson']);
    $jobpostrecruiteremployeremail = trim($_POST['jobpostrecruiteremployeremail']);
    $jobpostcontactnumber = trim($_POST['jobpostcontactnumber']);
    $jobposthdyhau = trim($_POST['jobposthdyhau']);
    $jobposttermsagree = trim($_POST['jobposttermsagree']);
    $jobpostdate = trim($_POST['jobpostdate']);
    $jobpostrefreshdate = trim($_POST['jobpostrefreshdate']);
    $jobstatus = $_POST['jobstatus'];
    $startdate = date('Y-m-d');
    $dateadded = strtotime("+28 day");
    $enddate = date('Y-m-d', $dateadded);
    // Allowed file types. add file extensions WITHOUT the dot.
    $allowtypes = array("txt", "rtf", "doc", "docx", "pdf");
    // Require a file to be attached: false = Do not allow attachments true = allow only 1 file to be attached
    $requirefile = "false";
    // Maximum file size for attachments in KB NOT Bytes for simplicity. MAKE SURE your php.ini can handel it,
    // post_max_size, upload_max_filesize, file_uploads, max_execution_time!
    // 2048kb = 2MB,       200kb = 1MB,     512kb = 1/2MB etc..
    $max_file_size = "200";
    // Thank you message
    $thanksmessage = "";
    $errors = array();
    //Initialize error array
    //jobpostsubject
    if (empty($_POST['jobpostsubject'])) {
        $errors[] = 'jobpostsubject';
    }
    //jobpostlocationtowncity
    if (empty($_POST['jobpostlocationtowncity'])) {
        $errors[] = 'jobpostlocationtowncity';
    }
    //jobpostlocationcounty
    if (empty($_POST['jobpostlocationcounty'])) {
        $errors[] = 'jobpostlocationcounty';
    }
    //jobpostpostcode
    if (empty($_POST['jobpostpostcode'])) {
        $errors[] = 'jobpostpostcode';
    }
    //jobpostjobtype
    if (empty($_POST['jobpostjobtype'])) {
        $errors[] = 'jobpostjobtype';
    }
    //jobpostsalary
    if (empty($_POST['jobpostsalary'])) {
        $errors[] = 'jobpostsalary';
    }
    //jobpostsectorindustry
    if (empty($_POST['jobpostsectorindustry'])) {
        $errors[] = 'jobpostsectorindustry';
    }
    //jobpostdescription
    if (empty($_POST['jobpostdescription'])) {
        $errors[] = 'jobpostdescription';
    }
    //jobpostrecruiteremployer
    if (empty($_POST['jobpostrecruiteremployer'])) {
        $errors[] = 'jobpostrecruiteremployer';
    }
    //jobpostrecruitercontactperson
    if (empty($_POST['jobpostrecruitercontactperson'])) {
        $errors[] = 'jobpostrecruitercontactperson';
    }
    //jobpostcontactnumber
    if (empty($_POST['jobpostcontactnumber'])) {
        $errors[] = 'jobpostcontactnumber';
    }
    //jobpostrecruiteremployeremail
    if (empty($_POST['jobpostrecruiteremployeremail'])) {
        $errors[] = 'jobpostrecruiteremployeremail';
    } else {
        if (!eregi('^[[:alnum:]][a-z0-9_\\.\\-]*@[a-z0-9\\.\\-]+\\.[a-z]{2,4}$', stripslashes(trim($_POST['jobpostrecruiteremployeremail'])))) {
            $errors[] = 'Please provide a valid email address!';
        }
        // if eregi
        // if empty email
    }
    //jobposthdyhau
    if (empty($_POST['jobposthdyhau'])) {
        $errors[] = 'jobposthdyhau';
    }
    //jobposttermsagree
    if (empty($_POST['jobposttermsagree'])) {
        $errors[] = 'jobposttermsagree';
    }
    //jobpostdate
    if (empty($_POST['jobpostdate'])) {
        $errors[] = 'jobpostdate';
    }
    //jobpostrefreshdate
    if (empty($_POST['jobpostrefreshdate'])) {
        $errors[] = 'jobpostrefreshdate';
    }
    // checks for required file
    if ($requirefile == "false") {
        if ($_FILES['attachment']['error'] == 4) {
            $errors[] = 'You forgot to attach your CV';
        }
    }
    //checks attachment file
    // checks that we have a file
    if (!empty($_FILES["attachment"]) && $_FILES['attachment']['error'] == 0) {
        // basename -- Returns filename component of path
        $filename = basename($_FILES['attachment']['name']);
        $ext = substr($filename, strrpos($filename, '.') + 1);
        $filesize = $_FILES['attachment']['size'];
        $max_bytes = $max_file_size * 200;
        //Check if the file type uploaded is a valid file type.
        if (!in_array($ext, $allowtypes)) {
            $errors[] = "File <strong>" . $filename . "</strong> has been rejected! Only the following CV formats are allowed: .doc, .docx, .txt, .rtf, and .pdf.";
            // check the size of each file
        } elseif ($filesize > $max_bytes) {
            $errors[] = "Your file: <strong>" . $filename . "</strong> is to big. Max file size is " . $max_file_size . "kb.";
        }
    }
    // if !empty FILES
    if (empty($errors)) {
        //If everything is OK
        // send an email
        // Obtain file upload vars
        $fileatt = $_FILES['attachment']['tmp_name'];
        $fileatt_type = $_FILES['attachment']['type'];
        $fileatt_name = $_FILES['attachment']['name'];
        // Headers
        $headers = "From: {$from}";
        // create a boundary string. It must be unique
        $semi_rand = md5(time());
        $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
        // Add the headers for a file attachment
        $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
        // Add a multipart boundary above the plain message
        $message = "This is a multi-part message in MIME format.\n\n";
        $message .= "--{$mime_boundary}\n";
        $message .= "Content-Type: text/html; charset=\"UTF-8\"\n";
        $message .= "Content-Transfer-Encoding: 7bit\n\n";
        $message .= "JOB TITLE: " . $jobpostsubject . " <br>\n";
        $message .= "TOWN CITY: " . $jobpostlocationtowncity . " <br>\n";
        $message .= "COUNTY: " . $jobpostlocationcounty . " <br>\n";
        $message .= "POST CODE: " . $jobpostpostcode . " <br>\n";
        $message .= "JOB TYPE: " . $jobpostjobtype . " <br>\n";
        $message .= "SALARY: " . $jobpostsalary . " <br>\n";
        $message .= "SECTOR/INDUSTRY: " . $jobpostsectorindustry . " <br>\n";
        $message .= "JOB DESCRIPTION : " . $jobpostdescription . " <br>\n";
        $message .= "RECRUITER/EMPLOYER: " . $jobpostrecruiteremployer . " <br>\n";
        $message .= "CONTACT PERSON: " . $jobpostrecruitercontactperson . " <br>\n";
        $message .= "CONTACT NUMBER: " . $jobpostcontactnumber . " <br>\n";
        $message .= "EMAIL: " . $jobpostrecruiteremployeremail . " <br>\n";
        $message .= "HOW DID YOU HEAR ABOUT US?: " . $jobposthdyhau . " <br>\n";
        $message .= ": " . $jobposttermsagree . " <br>\n";
        $message .= ": " . $jobpostdate . " <br>\n";
        $message .= ": " . $jobpostrefreshdate . " <br>\n\n";
        if (is_uploaded_file($fileatt)) {
            // Read the file to be attached ('rb' = read binary)
            $file = fopen($fileatt, 'rb');
            $data = fread($file, filesize($fileatt));
            fclose($file);
            // Base64 encode the file data
            $data = chunk_split(base64_encode($data));
            // Add file attachment to the message
            $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n";
        }
        $sql = "INSERT INTO `uk_master_live_job_search` (`JobID`, `jobpostsubject`, `jobpostlocationtowncity`, `jobpostlocationcounty`, `jobpostpostcode`, `jobpostjobtype`, `jobpostsalary`, `jobpostsectorindustry`, `jobpostdescription`, `keywords`, `jobpostrecruiteremployer`, `jobpostrecruitercontactperson`, `jobpostcontactnumber`, `jobpostrecruiteremployeremail`, `jobposthdyhau`, `jobposttermsagree`, `jobpostdate`, `jobpostrefreshdate`,`postjobdatetime`,`startdate`,`enddate`,`jobstatus`,`hits`,`refresh_date`,`last_edit`) VALUES ('0', '{$jobpostsubject}', '{$jobpostlocationtowncity}', '{$jobpostlocationcounty}', '{$jobpostpostcode}', '{$jobpostjobtype}', '{$jobpostsalary}', '{$jobpostsectorindustry}', '{$jobpostdescription}', '{$keywords}', '{$jobpostrecruiteremployer}', '{$jobpostrecruitercontactperson}', '{$jobpostcontactnumber}', '{$jobpostrecruiteremployeremail}', '{$jobposthdyhau}', '{$jobposttermsagree}', '{$jobpostdate}', '{$jobpostrefreshdate}',NOW(),'{$startdate}','{$enddate}','{$jobstatus}','0', NOW(), NOW())";
        $rs = mysql_query_with_throw($sql);
        // Send the completed message
        $envs = array("HTTP_USER_AGENT", "REMOTE_ADDR", "REMOTE_HOST");
        foreach ($envs as $env) {
            $message .= "{$env}: {$_SERVER[$env]}\n";
        }
        echo '<div id="formfeedbacktrue"><p>This job has been added to Our Network!</p></div>';
        unset($_SESSION['myForm']);
        print_form();
        // end of if !mail
    } else {
        //report the errors
        echo '<div id="formfeedback"><b><font size="4">WHOOPS! PLEASE REVIEW THE FOLLOWING ISSUES:</font></b>';
        foreach ($errors as $msg) {
            //prints each error
            echo "<ul><li>{$msg}</li></ul>\n";
        }
        // end of foreach
        echo '</div>';
        print_form();
    }
    //end of if(empty($errors))
}