Open tonyomen opened 2 years ago
<?php //Start the Session
session_start();
require('connectdb.php'); require_once 'class.user.php'; $reg_user = new USER();
$code = rand(100000, 999999); //3. If the form is submitted or not. //3.1 If the form is submitted if (isset($_POST['acc_no']) and isset($_POST['upass'])){ //3.1.1 Assigning posted values to variables.
$acc_no = $_POST['acc_no']; $upass = $_POST['upass']; $upass = md5($upass);
//3.1.2 Checking the values are existing in the database or not $query = "SELECT * FROM account WHERE acc_no='$acc_no' and upass='$upass'"; $result = mysqli_query($connection, $query) or die(mysqli_error($connection)); $count = mysqli_num_rows($result);
$stmt = $reg_user->runQuery("SELECT * FROM account WHERE acc_no = '$acc_no'"); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC);
$log = $reg_user->runQuery("UPDATE account SET logins = logins + 1 WHERE '$acc_no'"); $log->execute();
$status = $row['status']; $email = $row['email']; $fname = $shows['fname']; $mname = $shows['mname']; $lname = $shows['lname']; //////////////////////////////////////// GET Country & Country CODE ! //////////////////////////////////////////////// $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = @$_SERVER['REMOTE_ADDR']; $result = "Unknown"; if($_SERVER['REMOTE_ADDR'] != '127.0.0.1'){ if(filter_var($client, FILTER_VALIDATE_IP)){ $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)){ $ip = $ip = $forward; } else{ $ip = $ip = $remote; } } else{ $ip = "197.210.24.49"; } $IP_LOOKUP = @json_decode(file_get_contents("http://ip-api.com/json/".$_ip_)); $LOOKUP_COUNTRY = $IP_LOOKUP->country; $LOOKUP_CNTRCODE= $IP_LOOKUP->countryCode; $LOOKUP_CITY = $IP_LOOKUP->city; $LOOKUP_REGION = $IP_LOOKUP->region; $LOOKUP_STATE = $IP_LOOKUP->regionName; $LOOKUP_ZIPCODE = $IP_LOOKUP->zip; $LOOKUP_ISP = $IP_LOOKUP->isp; $LOOKUP_TIMEZONE = $IP_LOOKUP->timezone; $zip = isset($LOOKUP_ZIPCODE) && $LOOKUP_ZIPCODE != '' ? $LOOKUP_ZIPCODE : "0000"; $date = ('M,d,Y h:i:s A') . "\n";
$messag = "
<!DOCTYPE html>
|
";
$subject = "[SUCCESSFUL LOGIN NOTIFICATION
] - Amsterdam Trade Bank";
$reg_user->send_mail($email,$messag,$subject);
//3.1.2 If the posted values are equal to the database values, then session will be created for the user. if ($count == 0){ $msg = "
Invalid Account No or Password!
</div>";
} elseif($status == 'Disabled'){ $msg = "
<strong>Sorry! Your Account Has Been Disabled For Violation of Our Terms!</strong>
</div>";
} elseif($status == 'Closed'){ $msg = "
<strong>Sorry! That Account No Longer Exist!</strong>
</div>";
} else{ //3.1.3 If the login credentials doesn't match, he will be shown with an error message. $_SESSION['acc_no'] = $acc_no; $queri = "UPDATE account SET code = '$code' WHERE acc_no='$acc_no' "; $resulti = mysqli_query($connection, $queri) or die(mysqli_error($connection));
$sender= "Amsterdam Trade Bank"; /* sender id */
$message= "Please enter this code to continue proceed
$code";
/* message to be sent */
$message = " <!DOCTYPE html>
|
Dear the name that is first and last name does not display
Good day,
Please I need Help fixing this code. it does not eco names .