<?php
session_start();
//if (session_id() == "") session_start(); // Initialize Session data
require_once 'db.php';
include_once "ewcfg12.php";
include_once ((EW_USE_ADODB) ? "adodb5/adodb.inc.php" : "ewmysql12.php");
include_once "phpfn12.php";
include_once "class.user.php";

$user = new USER($DB_con);

if(!$user->is_loggedin())
{
   $user->redirect('login.php');
}

$militaryrank = trim(ew_RemoveXSS(ew_StripSlashes($_POST['MilitaryRank'])));

// $tst = "test";
 $query = "INSERT INTO TABLE1
           (
             ARMYNO
            ,VALUE1
           ) VALUES (
             :uid
            ,999
           )
          ";
 $stmt = $DB_con->prepare($query);
 $stmt->bindparam(":uid", $militaryrank);
 $stmt->execute();


if(isset($militaryrank)){
    $tmp_user_id   = trim(ew_RemoveXSS(ew_StripSlashes($_SESSION['user_session'])));
    $tmp_user_rank = $militaryrank;
    $_SESSION['CURRENTMILITARYRANK'] = $tmp_user_rank;
    $_SESSION['ARMYNOWITHRANK']      = str_pad($tmp_user_id.$tmp_user_rank, 8, '0', STR_PAD_LEFT);
}
//echo "test=".$_POST["MilitaryRank"];

?>
