<?php
//error_reportin(1);
session_start();
$username="";
if(isset($_SESSION['SESS_LOGGEDIN']) == TRUE) {
    header("Location: " . $config_basedir."trade.php");
}
require ("config.php");
require ("db.php");
?>
<?php
$error ="";
if(isset($_POST['submit'])){

    echo $username;
        // Captcha verification is Correct. Final Code Execute here!		
        $username = mysqli_real_escape_string($db,$_POST['userBox']);

        
        $password = mysqli_real_escape_string($db,$_POST['passBox']);
        $loginsql = "SELECT * FROM logins WHERE username = '$username' AND password = '$password'";
        $loginres = mysqli_query($db,$loginsql);
        $numrows = mysqli_num_rows($loginres);
        if($numrows == 1)
        {
            $loginrow = mysqli_fetch_assoc($loginres);

            $_SESSION['SESS_LOGGEDIN'] = 1;
            $_SESSION['SESS_USERNAME'] = $loginrow['username'];
			 $_SESSION['firstname'] = $firstname;
			  $_SESSION['profile'] = $profile;
             $_SESSION['lastname'] = $lastname;
			 $_SESSION['walletid'] = $walletid;
             $_SESSION['member_no'] = $member_no;
			  $_SESSION['profit'] = $member_no;
			  $_SESSION['interest_rate'] = $profit;
			  $_SESSION['max_period'] = $max_period;
			   $_SESSION['max_invest'] = $max_invest;
			  $_SESSION['invest_period'] = $invest_period;
			  $_SESSION['invest_amt'] = $invest_amt;
			  $_SESSION['investors_no'] = $investors_no;
			   $_SESSION['cashout_no'] = $cashout_no;
			    $_SESSION['active_no'] = $active_no; 
			    $_SESSION['id'] = $user_id;           //added
			    $_SESSION['verifyuser'] = $verifyuser;
                $_SESSION['acc_verified'] = $acc_verified;

                $_SESSION['verified_badge'] = $verified_badge;
				
				$_SESSION['ver_badge'] = $ver_b;



                $_SESSION['city'] = $city;
                $_SESSION['state'] = $state;
                $_SESSION['country'] = $country;
				
				$_SESSION['user_image'] = $userImage;




            $_SESSION['SESS_USERID'] = $loginrow['id'];
            header("Location: trade.php");

        }
        else
        {
            $error= "Incorrect username/password!";

        }		
    }

else
{
}
?>