File manager - Edit - /home/familylifersmpc/htdocs/www.familylifersmpc.com/regLoan.php
Back
<?php //start PHP session session_start(); include('includes/conn.php'); include('includes/config.php'); //check if register form is submitted $sid = $_SESSION['alogin']; if(strlen($_SESSION['alogin'])=="") { header("Location: login.php"); } else{ $sql = "SELECT cname FROM users WHERE uname='". $sid. "'"; $query = $dbh->prepare($sql); $query->execute(); $results=$query->fetchAll(PDO::FETCH_OBJ); $cnt=1; if($query->rowCount() > 0) { foreach($results as $result) { }} if(isset($_POST['register'])){ //assign variables to post values $userID = $_SESSION['alogin']; $name = $result->cname; $description = $_POST['description']; $principal = $_POST['principal']; $terms = $_POST['terms']; $paymentmode = $_POST['paymentmode']; $status = "PENDING"; $str1 = $principal; $x = str_replace( ',', '', $str1); if( is_numeric($x)) { echo $x."\n"; } $principal = $x; //insert new loan to our database $stmt = $pdo->prepare('INSERT INTO tblloanapp (description, principal, terms, paymentmode, name, userID, status) VALUES (:description, :principal, :terms, :paymentmode, :name, :userID, :status)'); try{ $stmt->execute(['description' => $description, 'principal' => $principal, 'terms' => $terms, 'paymentmode' => $paymentmode, 'name' => $name, 'userID' => $userID, 'status' => $status]); $_SESSION['success'] = 'Loan application successfully submitted!'; } catch(PDOException $e){ $_SESSION['error'] = 'Loan application submission failed! Try again. <br> Click "<strong>Applied Loans</strong>" to check loan status!'; } } else{ $_SESSION['error'] = 'Loan application submission failed! Try again. <br> Click "<strong>Applied Loans</strong>" to check loan status!'; } header('location: dashboard.php'); }?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings