Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/public_html/member/
Upload File :
Current File : /home2/wtmwscom/public_html/member/lead_add_mode.php

<?php
session_start();
include('../connection.php');
include '../function_lib.php';
include './imageresize.php';
$create_by_uid = $_SESSION['userid'];

$lead_limit = array(0=>0, 1=>1, 2=>2, 3=>4, 4=>10,);
$plan_type = mysqli_fetch_object(mysqli_query($connection, "SELECT plan_type FROM user WHERE uid = '".$_SESSION['userid']."'"))->plan_type;
if($plan_type==0 ){
    setMessage('There is no lead credit for this account.', 'alert-msg error');
    redirect("lead_report.php");
    die;
} else{
    $lead_created_count = mysqli_fetch_object(mysqli_query($connection, "SELECT count(recid) as count FROM lead WHERE create_by_uid = '".$_SESSION['userid']."' AND date(reg_date) = '".date('Y-m-d')."' "))->count;
    if($lead_created_count >= $lead_limit[$plan_type] ) {
        setMessage('lead credit limit reached.', 'alert-msg error');
        redirect("lead_report.php");
        die;
    }
}
$name = $_POST['name'];
$dob = $_POST['dob'];
$sex = $_POST['sex'];
$address = $_POST['address'];
$city = $_POST['city'];
$country = $_POST['country'];
$mobile = $_POST['mobile'];
$email = $_POST['email'];

$pan_no = $_POST['pan_no'];
$aadhar_no = $_POST['aadhar_no'];


$uid = createId();

if($uid) {
    $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/";
        $smallImage = $resize->do_resize(800, 500, $_FILES['receipt'], $smallPath, 0, "thumb", 90);

    }
    
   $sql = "INSERT INTO `lead` (`uid`, `name`, `dob`,`gender`, `address`, `city`, `country`,`mobile`, `email`, `reg_date`, `pan_no`, `aadhar_no`, `create_by_uid`, `filename`) VALUES 
        ('".$uid ."', '".$name."','".$dob."','".$sex."','".$address."','".$city."','".$country."','".$mobile."','".$email."','".date('Y-m-d H:i:s')."', '$pan_no', '".$aadhar_no."', '".$create_by_uid."', '".$smallImage."')";

    $is_insert = mysqli_query($connection, $sql);
    //echo $sql; die;
    if($is_insert){
        setMessage('Lead added successfully.', 'alert-msg success');
    } else {
        setMessage('Mobile or email already exist.', 'alert-msg error');
    }
}
redirect("lead_report.php");
?>