| Current Path : /home2/wtmwscom/public_html/member/ |
| Current File : /home2/wtmwscom/public_html/member/bank_receipt_modal.php |
<?php
session_start();
include('../connection.php');
include '../function_lib.php';
include './imageresize.php';
if (!isset($_SESSION['userid']) || !isset($_POST['submit'])) {
redirect("./view_profile.php");
die;
}
$uid = $_SESSION['userid'];
if (!empty($_FILES['receipt'])) {
$smallImage = "";
if (!empty($_FILES['receipt']) && isset($_FILES['receipt']['name']) && array_search($_FILES['receipt']['type'], array("image/gif", "image/jpeg", "image/png", "image/jpg")) !== FALSE) {
$resize = new resizeImage();
// upload image in three dimesions
//$largePath = "uploads/news/large/";
//$largeImage = $resize->do_resize(500,400 ,$_FILES['receipt'],$largePath,0,"large");
$smallPath = "uploads/bank_receipt/";
$smallImage = $resize->do_resize(800, 500, $_FILES['receipt'], $smallPath, 0, "thumb", 90);
}
$sql = "INSERT INTO `bank_receipt` (`uid`, `amount`, `payment_type`, `file_name`, `file_path`, `remark`, `datetime`,`payment_mode`,`bank_name`,`bank_branch`,`ifsc`,`mobile`,`payment_datetime`,`transaction_number`) VALUES
('" . $uid . "', '" . $_POST['amount'] . "', '" . $_POST['payment_type'] . "', '" . $smallImage . "', '" . $smallPath . "', '" . $_POST['remark'] . "', '" . date('Y-m-d H:i:s') . "', "
. "'" . $_POST['payment_mode'] . "', '" . $_POST['bank_name'] . "', '" . $_POST['bank_branch'] . "', '" . $_POST['ifsc'] . "', '" . $_POST['mobile'] . "', '" . $_POST['payment_datetime'] . "', '" . $_POST['transaction_number'] . "')";
$is_insert = mysqli_query($connection, $sql);
$bank_receipt_id = mysql_insert_id();
$quantity_array = $_POST['quantity'];
//echo "1 - ".$quantity[1];
$i=0;
foreach ($_POST['pin_package'] as $key => $pin_package_id) {
if (!empty($pin_package_id)) {
$quantity = $quantity_array[$i];
$sql = "INSERT INTO `bank_receipt_package` (`bank_receipt_id`,`pin_package_id`,`quantity`) VALUES"
. " ('$bank_receipt_id', '$pin_package_id', '$quantity')";
mysqli_query($connection, $sql);
}
$i++;
}
//echo $sql; die;
if ($is_insert) {
setMessage('bank receipt uploaded successfully.', 'alert-success');
} else {
setMessage('Something went wrong', 'alert-danger');
}
}
redirect("./bank_receipt.php");
?>