diff --git a/.hta_slug/admin/all-leads.php b/.hta_slug/admin/all-leads.php index a4bbc49..10fe385 100644 --- a/.hta_slug/admin/all-leads.php +++ b/.hta_slug/admin/all-leads.php @@ -204,8 +204,8 @@ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $searchQuery = isset($_GET['search']) ? trim($_GET['search']) : ''; - $start_date = isset($_GET['start_date']) ? $_GET['start_date'] : ''; - $end_date = isset($_GET['end_date']) ? $_GET['end_date'] : ''; - + $searchTerm =isset($_GET['search']) ? $_GET['search'] : "%"; + $businessVertical =isset($_GET['bv']) ? $_GET['bv'] : "%"; + $start_date = isset($_GET['start_date']) ? $_GET['start_date'] : '2014-05-05'; + $end_date = isset($_GET['end_date']) ? $_GET['end_date'] : date('Y-m-d'); + $start_time = microtime(true); + $resultsPerPage = 100; + $page =isset($_GET['page']) ? $_GET['page'] : 1; + $offset = ($page - 1) * $resultsPerPage ; $accessArray = explode(",", $_SESSION['access']); $placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,? $placeholderString = implode(',', array_fill(0, count($accessArray), '?')); - if (!empty($searchQuery)) { - // this is keywords search - $stmt = $conn->prepare("SELECT * FROM cleads WHERE (id LIKE ? OR name LIKE ? OR email LIKE ? OR phone LIKE ?) ORDER BY time DESC LIMIT ?, ?"); - $stmt->bindValue(1, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(2, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(3, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(4, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue( 5, 0, PDO::PARAM_INT); // Offset for pagination - $stmt->bindValue( 6, $recordsPerPage, PDO::PARAM_INT); // Records per page - // this is for date serch - }elseif (!empty($start_date) && !empty($end_date)) { - $start_date = date('Y-m-d', strtotime($start_date)); - $end_date = date('Y-m-d', strtotime($end_date)); - $stmt = $conn->prepare("SELECT * FROM cleads WHERE time BETWEEN ? AND ?"); - $stmt->bindValue(1, $start_date); - $stmt->bindValue(2, $end_date); - }else{ - // if user type admin then show all lead - if($_SESSION['user_type'] == 'admin'){ - $stmt = $conn->prepare("SELECT COUNT(*) FROM cleads"); - $stmt->execute(); - $totalRecords = $stmt->fetchColumn(); - - $totalPages = ceil($totalRecords / $recordsPerPage); - - $offset = ($currentPage - 1) * $recordsPerPage; - - $stmt = $conn->prepare("SELECT * FROM cleads ORDER BY time DESC LIMIT :offset, :recordsPerPage"); - $stmt->bindParam(':offset', $offset, PDO::PARAM_INT); - $stmt->bindParam(':recordsPerPage', $recordsPerPage, PDO::PARAM_INT); - }else{ - } - } + //first query to get the total number for pagination + $sql = "SELECT COUNT(*) FROM cleads + WHERE name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm AND time BETWEEN :start_date AND :end_date AND verticals LIKE :businessVertical"; + $stmt = $conn->prepare($sql); + $stmt->bindValue(':searchTerm', "%$searchTerm%"); + $stmt->bindValue(':limit', $resultsPerPage, PDO::PARAM_INT); + $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); + $stmt->bindValue(':start_date', $start_date); + $stmt->bindValue(':end_date', $end_date); + $stmt->bindValue(':businessVertical', $businessVertical); $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - $row_count = count($rows); - for ($i = 0; $i < $row_count; $i++) { - // echo $row_count . " "; - } - echo "

Total ".$row_count." Rows Found

"; + $totalRows = $stmt->fetchColumn(); + + // second & final query to get the page_view data + + $sql = "SELECT * FROM cleads + WHERE name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm AND time BETWEEN :start_date AND :end_date AND verticals LIKE :businessVertical + ORDER BY id DESC LIMIT :limit OFFSET :offset"; + $stmt = $conn->prepare($sql); + $stmt->bindValue(':searchTerm', "%$searchTerm%"); // PDO::PARAM_STR is the default data type binding so is not needed + $stmt->bindValue(':limit', $resultsPerPage, PDO::PARAM_INT); + $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); + $stmt->bindValue(':start_date', $start_date); + $stmt->bindValue(':end_date', $end_date); + $stmt->bindValue(':businessVertical', $businessVertical); + $stmt->execute(); + $leads = $stmt->fetchAll(PDO::FETCH_ASSOC); + $totalResults = count($leads); + $totalPages = ceil($totalRows / $resultsPerPage); + + echo "

Total ".$totalRows." Rows Found

"; // Status Conditional Color - foreach($rows as $row){ - $only_date = explode(' ', $row['time']); - $lead_id = $row['id']; - if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';} - elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 2px solid #2C9C9C; border-radius: 20px; text-align: center; color: #2C9C9C;';} - elseif($row['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 2px solid #3F4254; border-radius: 20px; text-align: center; color: #3F4254;';} - elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 2px solid #40916C; border-radius: 20px; text-align: center; color: #40916C;';} - elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';} + foreach($leads as $lead){ + $only_date =isset($lead['time']) ? substr($lead['time'], 0, 10): 'Not Available'; + $lead_id = $lead['id']; + if($lead['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';} + elseif($lead['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 2px solid #2C9C9C; border-radius: 20px; text-align: center; color: #2C9C9C;';} + elseif($lead['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 2px solid #3F4254; border-radius: 20px; text-align: center; color: #3F4254;';} + elseif($lead['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 2px solid #40916C; border-radius: 20px; text-align: center; color: #40916C;';} + elseif($lead['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';} // if status = warm then select // if($row['status'] == 'Warm'){$conditional_status = '

'.$row['status'].'

';}elseif($row['status'] != 'Warm'){$conditional_status = $row['status'];} ?> @@ -298,36 +293,72 @@
- +
- + - - -
+ + +
- - + + Error: " . $e->getMessage() . "

"; } + + $end_time = microtime(true); + + // Calculate execution time + $execution_time = ($end_time - $start_time); + + // Output execution time + echo "Page executed in: " . $execution_time . " seconds"; ?> - "; + +?> + + + +'; + +?> +
@@ -414,26 +445,6 @@
-
@@ -532,7 +543,7 @@ }); function deleteCofermation(){ let deleteButton = document.getElementById('delete-button'); - let leadID = document.getElementById('').value; + let leadID = document.getElementById('').value; //getting Err: here if(leadID != null){ if(deleteButton.style.display === 'flex'){ deleteButton.style.display = 'none'; @@ -570,20 +581,7 @@ transform: translateX(0%); } } - /* .add-lead-form{ - background-color: #F8F8F8; - display: none; - position: fixed; - top: 50%; - right: 0%; - transform: translate(-0%, -50%); - width: 100%; - max-width: 500px; - box-shadow: 0px 0px 20px 0px #443780; - border-radius: 5px; - z-index: 100; - height: 100%; - } */ + .delete-confirm{ position: fixed; display: none; diff --git a/.hta_slug/admin/edit-user.php b/.hta_slug/admin/edit-user.php index 17a5e90..b684781 100644 --- a/.hta_slug/admin/edit-user.php +++ b/.hta_slug/admin/edit-user.php @@ -3,7 +3,7 @@ require_once('.htac_header.php'); require_once('.htac_nav.php'); - if ($_SERVER["REQUEST_METHOD"] == "POST") { + if ($_SERVER["REQUEST_METHOD"] == "POST") { // $name = $_POST['name']; // $email = $_POST['email']; diff --git a/.hta_slug/admin/list_leads.php b/.hta_slug/admin/list_leads.php new file mode 100644 index 0000000..e69de29 diff --git a/.hta_slug/admin/test.php b/.hta_slug/admin/test.php new file mode 100644 index 0000000..cbc57e5 --- /dev/null +++ b/.hta_slug/admin/test.php @@ -0,0 +1,46 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +} catch (PDOException $e) { + die("Database connection failed: " . $e->getMessage()); +} + +// Pagination variables +$limit = 10; // Number of records per page +$page = isset($_GET['page']) ? $_GET['page'] : 1; // Current page number +$offset = ($page - 1) * $limit; // Offset for pagination + +// Fetch products with pagination +try { + $stmt = $pdo->prepare("SELECT * FROM cleads LIMIT :limit OFFSET :offset"); + $stmt->bindParam(':limit', $limit, PDO::PARAM_INT); + $stmt->bindParam(':offset', $offset, PDO::PARAM_INT); + $stmt->execute(); + $products = $stmt->fetchAll(PDO::FETCH_ASSOC); + + // Count total number of products + $totalStmt = $pdo->query("SELECT COUNT(*) FROM products"); + $totalProducts = $totalStmt->fetchColumn(); +} catch (PDOException $e) { + die("Error fetching products: " . $e->getMessage()); +} + +// Display products +echo "

Product List

"; + +echo ""; + +// Pagination links +$totalPages = ceil($totalProducts / $limit); +echo "
"; +echo "

Pages:

"; +for ($i = 1; $i <= $totalPages; $i++) { + echo "$i "; +} +echo "
"; +?> diff --git a/.hta_slug/admin/users.php b/.hta_slug/admin/users.php index 5b172d5..304494d 100644 --- a/.hta_slug/admin/users.php +++ b/.hta_slug/admin/users.php @@ -10,32 +10,70 @@ } if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST['name'] && $_POST['pass'] && $_POST['email']) { - $select_access = ['beanstalk', 'inhouse', 'teenybeans', 'iimtt', 'buzzapp', 'atheneum', 'teenybeans_curriculum']; - $access_values_array = []; - - foreach ($select_access as $access) { - if (isset($_POST[$access])) { - $access_values_array[] = $_POST[$access]; + + $mysqli = new mysqli($mariaServer, $mariaUser, $mariaPass, $mariaDb); + if ($mysqli->connect_error) die("Connection failed: " . $mysqli->connect_error); + $result = $mysqli->query("SELECT bv FROM business_verticals"); + if ($result) { + $access_array = array(); + while ($row = $result->fetch_assoc()) { + $access_array[] = $row['bv']; } - } - $access_value = implode(',', $access_values_array); - $name = $_POST['name']; - $email = $_POST['email']; - $phone = $_POST['phone']; - $password = md5($_POST['pass']); - $selected_states = implode(',', $_POST['selectedStates']); // Collect selected state values + + // $access_array = ['beanstalk', 'inhouse', 'teenybeans', 'iimtt', 'buzzapp', 'atheneum', 'teenybeans_curriculum']; + $access_values_array = []; + foreach ($access_array as $access) { + if (isset($_POST[$access])) { + $access_values_array[] = $_POST[$access]; + } + } + $selected_access = implode(',', $access_values_array); + + + $result->free(); + // print_r($access_array); + } else { echo "Error: " . $mysqli->error; } + $mysqli->close(); + + + + + $apiUrl = 'https://api.siliconpin.com/v3/list/country/state/?country=IN'; + $handle = fopen($apiUrl, 'rb'); + if ($handle === false) { + echo 'Unable to open URL'; + } else { + $jsonResponse = stream_get_contents($handle); + fclose($handle); + $states = json_decode($jsonResponse, true); + if ($states === null) { + echo 'Error decoding JSON from API'; + } else { + $state_values_array = []; + if (isset($_POST['international'])) $state_values_array[] ='international'; + foreach ($states as $state) { + if (isset($_POST[$state['iso2']])) $state_values_array[] = $_POST[$state['iso2']]; + } + $selected_states = implode(',', $state_values_array); + } + } + + + + try { + $pass=md5($_POST['pass']); $stmt = $conn->prepare("INSERT INTO users (name, email, mobile, access, pass, states) VALUES (:name, :email, :mobile, :access, :pass, :states)"); - $stmt->bindParam(':name', $name); - $stmt->bindParam(':email', $email); - $stmt->bindParam(':mobile', $phone); - $stmt->bindParam(':access', $access_value); - $stmt->bindParam(':pass', $password); + $stmt->bindParam(':name', $_POST['name']); + $stmt->bindParam(':email', $_POST['email']); + $stmt->bindParam(':mobile', $_POST['phone']); + $stmt->bindParam(':access', $selected_access); + $stmt->bindParam(':pass', $pass); $stmt->bindParam(':states', $selected_states); // Bind selected states $stmt->execute(); - echo "Record added successfully"; + echo "A new user added."; } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } @@ -136,11 +174,39 @@ ?>
+

-

Access by state:

-
- -
+

Responsible Area:

+
+    + +
+

+
+ + '; + echo '
'; + } + } + } + + + ?> + +
@@ -153,23 +219,23 @@
+ + \ No newline at end of file diff --git a/.hta_slug/leads/_home copy 2.php b/.hta_slug/leads/_home copy 2.php deleted file mode 100644 index ab8447d..0000000 --- a/.hta_slug/leads/_home copy 2.php +++ /dev/null @@ -1,68 +0,0 @@ - -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("SELECT * FROM business_verticals"); - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - - if (count($rows) >= 1) { - foreach($rows as $row){ - echo '
- '.$row['bv'].' -
'; - } - } else { - echo "

Not Found any Data

"; - } - - } catch (PDOException $e) { - echo "

Error: " . $e->getMessage() . "

"; - } -?> -
- setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $accessArray = explode(",", $_SESSION['access']); - $placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,? - $stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) LIMIT 10"); - foreach ($accessArray as $key => $value) { - $stmt->bindValue($key + 1, $value); - } - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - echo ' -
- - - - - '; - $num_rows = $stmt->rowCount(); - - } catch (PDOException $e) { - echo "

Error: " . $e->getMessage() . "

"; - } - - ?> - - - -
\ No newline at end of file diff --git a/.hta_slug/leads/_home copy 3.php b/.hta_slug/leads/_home copy 3.php deleted file mode 100644 index ad54dac..0000000 --- a/.hta_slug/leads/_home copy 3.php +++ /dev/null @@ -1,71 +0,0 @@ - - -
- Add Leads -
-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - // $stmt = $conn->prepare("SELECT * FROM users WHERE email=:email"); - // $stmt->bindParam(':email', $_SESSION['email']); - // $stmt->execute(); - // $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - // $num_rows = $stmt->rowCount(); - // foreach($rows as $row){ - // $user_access_data = explode(",", $row['access']); - // foreach($user_access_data as $access_data){ - // echo '
'.$access_data.'
'; - // } - // } - // } catch (PDOException $e) { - // echo "

Error: " . $e->getMessage() . "

"; - // }; - - try { - $conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); - $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - if($_SESSION['user_type'] == 'admin'){ - $stmt = $conn->prepare("SELECT * FROM cleads ORDER BY time DESC"); - }else{ - $accessArray = explode(",", $_SESSION['access']); - $placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,? - $stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) ORDER BY time DESC"); - foreach ($accessArray as $key => $value) { - $stmt->bindValue($key + 1, $value); - } - // $stmt->bindValue(":user", $_SESSION['email']); - } - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); -?> -
- -Error: " . $e->getMessage() . "

"; - } -?> - \ No newline at end of file diff --git a/.hta_slug/leads/_home copy.php b/.hta_slug/leads/_home copy.php deleted file mode 100644 index 433b51a..0000000 --- a/.hta_slug/leads/_home copy.php +++ /dev/null @@ -1,82 +0,0 @@ - -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("SELECT * FROM business_verticals"); - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - - if (count($rows) >= 1) { - foreach($rows as $row){ - echo '
- '.$row['bv'].' -
'; - } - } else { - echo "

Not Found any Data

"; - } - - } catch (PDOException $e) { - echo "

Error: " . $e->getMessage() . "

"; - } -?> -
- - - - - - - - - - - - - - - setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $accessArray = explode(",", $_SESSION['access']); - $placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,? - $stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders)"); - foreach ($accessArray as $key => $value) { - $stmt->bindValue($key + 1, $value); - } - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - $num_rows = $stmt->rowCount(); - if ($num_rows >= 1) { - foreach($rows as $row){ - echo ' - - - - - - - - - '; - } - } else{ - echo "

Not Found any Data

"; - } - - } catch (PDOException $e) { - echo "

Error: " . $e->getMessage() . "

"; - } - - ?> - - -
NameIDStatusEmailPhonebusiness_typeTimeAction
'.$row['name'].''.$row['id'].''.$row['status'].''.$row['email'].''.$row['phone'].''.$row['business_type'].''.$row['time'].'Delete
-
\ No newline at end of file diff --git a/.hta_slug/leads/_home.php b/.hta_slug/leads/_home.php deleted file mode 100644 index 68a74a1..0000000 --- a/.hta_slug/leads/_home.php +++ /dev/null @@ -1,548 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } catch(PDOException $e) { - echo "Connection failed: " . $e->getMessage(); - } - if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['new_lead']) && $_POST['new_lead'] && isset($_POST['name']) && $_POST['name'] && isset($_POST['phone']) && $_POST['phone']) { - $name = $_POST['name']; - $email = $_POST['email']; - $phone = $_POST['phone']; - $formname = 'crm-portal'; - $note = $_POST['note']; - $origin = $_POST['origin']; - $gender = $_POST['gender']; - $profession = $_POST['profession']; - $country = $_POST['country']; - $state = $_POST['state']; - $city = $_POST['city']; - $address = $_POST['address']; - $status = 'New'; - try { - $stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address)"); - $stmt->bindParam(':name', $name); - $stmt->bindParam(':email', $email); - $stmt->bindParam(':phone', $phone); - $stmt->bindParam(':formname', $formname); - $stmt->bindParam(':note', $note); - $stmt->bindParam(':origin', $origin); - $stmt->bindParam(':status', $status); - $stmt->bindParam(':gender', $gender); - $stmt->bindParam(':profession', $profession); - $stmt->bindParam(':country', $country); - $stmt->bindParam(':state', $state); - $stmt->bindParam(':city', $city); - $stmt->bindParam(':address', $address); - $stmt->execute(); - echo "Record added successfully"; - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } - } -?> -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $delete_placeholders = rtrim(str_repeat('?,', count($selectedIds)), ','); - $stmt = $conn->prepare("DELETE FROM cleads WHERE id IN ($delete_placeholders)"); - foreach($selectedIds as $key => $id) { - $stmt->bindValue($key + 1, $id, PDO::PARAM_INT); - } - $stmt->execute(); - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } - } - } -?> -

Lead Management

-
- - -
- -
-

Choose Date for filter

-
-
- - -
  |   -
- - -
-
- -
-
-
- Delete

'; - } - ?> - -
-
- - -
-
- -
- -
- - - - - - '; - ?> - - - - - - - - - - - setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $searchQuery = isset($_GET['search']) ? trim($_GET['search']) : ''; - $start_date = isset($_GET['start_date']) ? $_GET['start_date'] : ''; - $end_date = isset($_GET['end_date']) ? $_GET['end_date'] : ''; - - $accessArray = explode(",", $_SESSION['access']); - $placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,? - $placeholderString = implode(',', array_fill(0, count($accessArray), '?')); - if (!empty($searchQuery)) { - // this is keywords search - $stmt = $conn->prepare("SELECT * FROM cleads WHERE (id LIKE ? OR name LIKE ? OR email LIKE ? OR phone LIKE ?) AND business_type IN ($placeholders) ORDER BY time DESC LIMIT ?, ?"); - $stmt->bindValue(1, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(2, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(3, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(4, "%$searchQuery%", PDO::PARAM_STR); - foreach ($accessArray as $key => $value) { - $stmt->bindValue($key + 5, $value); - } - $stmt->bindValue(count($accessArray) + 5, 0, PDO::PARAM_INT); // Offset for pagination - $stmt->bindValue(count($accessArray) + 6, $recordsPerPage, PDO::PARAM_INT); // Records per page - // this is for date serch - }elseif (!empty($start_date) && !empty($end_date)) { - $start_date = date('Y-m-d', strtotime($start_date)); - $end_date = date('Y-m-d', strtotime($end_date)); - $stmt = $conn->prepare("SELECT * FROM cleads WHERE time BETWEEN ? AND ? AND business_type IN ($placeholders)"); - $stmt->bindValue(1, $start_date); - $stmt->bindValue(2, $end_date); - - foreach ($accessArray as $key => $value) { - $stmt->bindValue($key + 3, $value); - } - }else{ - // if user type admin then show all lead - if($_SESSION['user_type'] == 'admin'){ - $stmt = $conn->prepare("SELECT COUNT(*) FROM cleads"); - $stmt->execute(); - $totalRecords = $stmt->fetchColumn(); - - $totalPages = ceil($totalRecords / $recordsPerPage); - - $offset = ($currentPage - 1) * $recordsPerPage; - - $stmt = $conn->prepare("SELECT * FROM cleads ORDER BY time DESC LIMIT :offset, :recordsPerPage"); - $stmt->bindParam(':offset', $offset, PDO::PARAM_INT); - $stmt->bindParam(':recordsPerPage', $recordsPerPage, PDO::PARAM_INT); - }else{ - // if user type user then show only given access lead - $stmt = $conn->prepare("SELECT COUNT(*) FROM cleads WHERE business_type IN ($placeholders)"); - foreach ($accessArray as $key => $value) { - $stmt->bindValue($key + 1, $value); - } - $stmt->execute(); - - $totalRecords = $stmt->fetchColumn(); - $totalPages = ceil($totalRecords / $recordsPerPage); - $offset = ($currentPage - 1) * $recordsPerPage; - - - $stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) ORDER BY time DESC LIMIT ?, ?"); - $paramCount = count($accessArray); - for ($i = 0; $i < $paramCount; $i++) { - $stmt->bindValue($i + 1, $accessArray[$i]); - } - $stmt->bindValue($paramCount + 1, $offset, PDO::PARAM_INT); - $stmt->bindValue($paramCount + 2, $recordsPerPage, PDO::PARAM_INT); - } - } - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - $row_count = count($rows); - for ($i = 0; $i < $row_count; $i++) { - // echo $row_count . " "; - } - echo "

Total ".$row_count." Rows Found

"; - // Status Conditional Color - foreach($rows as $row){ - $only_date = explode(' ', $row['time']); - $lead_id = $row['id']; - if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';} - elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 2px solid #2C9C9C; border-radius: 20px; text-align: center; color: #2C9C9C;';} - elseif($row['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 2px solid #3F4254; border-radius: 20px; text-align: center; color: #3F4254;';} - elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 2px solid #40916C; border-radius: 20px; text-align: center; color: #40916C;';} - elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';} - // if status = warm then select - // if($row['status'] == 'Warm'){$conditional_status = '

'.$row['status'].'

';}elseif($row['status'] != 'Warm'){$conditional_status = $row['status'];} - ?> - - - - - - - - - - - - - Error: " . $e->getMessage() . "

"; - } - ?> - -
NameIDStatus UpdateForm NameDateQuick Action
- -
-
- - -
-
-
- - - - -
-
-

Add Lead

-

-
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
Lead Information
-
-
- - -
- -
-
- - -
-
- -
-
-
- - - \ No newline at end of file diff --git a/.hta_slug/leads/add-lead.php b/.hta_slug/leads/add-lead.php deleted file mode 100644 index 61af5c8..0000000 --- a/.hta_slug/leads/add-lead.php +++ /dev/null @@ -1,63 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } catch(PDOException $e) { - echo "Connection failed: " . $e->getMessage(); - } - if ($_SERVER["REQUEST_METHOD"] == "POST") { - $name = $_POST['name']; - $email = $_POST['email']; - $phone = $_POST['phone']; - $formname = 'crm-portal'; - $note = $_POST['note']; - $details = $_POST['details']; - $status = 'New'; - try { - $stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, details, status) VALUES (:name, :email, :phone, :formname, :note, :details, :status)"); - $stmt->bindParam(':name', $name); - $stmt->bindParam(':email', $email); - $stmt->bindParam(':phone', $phone); - $stmt->bindParam(':formname', $formname); - $stmt->bindParam(':note', $note); - $stmt->bindParam(':details', $details); - $stmt->bindParam(':status', $status); - $stmt->execute(); - echo "Record added successfully"; - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } - } -?> -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- - -
- -
-
-
\ No newline at end of file diff --git a/.hta_slug/leads/bv.php b/.hta_slug/leads/bv.php deleted file mode 100644 index eec26ff..0000000 --- a/.hta_slug/leads/bv.php +++ /dev/null @@ -1,28 +0,0 @@ - -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("SELECT * FROM business_verticals"); - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - - if (count($rows) >= 1) { - foreach($rows as $row){ echo '
- '.$row['bv'].' -
'; ?> - Not Found any Data

"; - } - - } catch (PDOException $e) { - echo "

Error: " . $e->getMessage() . "

"; - } -?> diff --git a/.hta_slug/leads/by-business-verticals copy.php b/.hta_slug/leads/by-business-verticals copy.php deleted file mode 100644 index 30c0ce7..0000000 --- a/.hta_slug/leads/by-business-verticals copy.php +++ /dev/null @@ -1,59 +0,0 @@ - -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - // $stmt = $conn->prepare("SELECT * FROM users WHERE email=:email"); - // $stmt->bindParam(':email', $_SESSION['email']); - // $stmt->execute(); - // $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - // $num_rows = $stmt->rowCount(); - // foreach($rows as $row){ - // $user_access_data = explode(",", $row['access']); - // foreach($user_access_data as $access_data){ - // echo '
'.$access_data.'
'; - // } - // } - // } catch (PDOException $e) { - // echo "

Error: " . $e->getMessage() . "

"; - // } -?> - -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type = :business_type ORDER BY time DESC"); - $stmt->bindParam(':business_type', $_GET['bv']); - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); -?> -
- -Error: " . $e->getMessage() . "

"; - } -?> \ No newline at end of file diff --git a/.hta_slug/leads/by-business-verticals.php b/.hta_slug/leads/by-business-verticals.php deleted file mode 100644 index 1d62fdf..0000000 --- a/.hta_slug/leads/by-business-verticals.php +++ /dev/null @@ -1,446 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } catch(PDOException $e) { - echo "Connection failed: " . $e->getMessage(); - } - if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['new_lead']) && $_POST['new_lead'] && isset($_POST['name']) && $_POST['name'] && isset($_POST['phone']) && $_POST['phone']) { - $name = $_POST['name']; - $email = $_POST['email']; - $phone = $_POST['phone']; - $formname = 'crm-portal'; - $note = $_POST['note']; - $origin = $_POST['origin']; - $gender = $_POST['gender']; - $profession = $_POST['profession']; - $country = $_POST['country']; - $state = $_POST['state']; - $city = $_POST['city']; - $address = $_POST['address']; - $status = 'New'; - try { - $stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address)"); - $stmt->bindParam(':name', $name); - $stmt->bindParam(':email', $email); - $stmt->bindParam(':phone', $phone); - $stmt->bindParam(':formname', $formname); - $stmt->bindParam(':note', $note); - $stmt->bindParam(':origin', $origin); - $stmt->bindParam(':status', $status); - $stmt->bindParam(':gender', $gender); - $stmt->bindParam(':profession', $profession); - $stmt->bindParam(':country', $country); - $stmt->bindParam(':state', $state); - $stmt->bindParam(':city', $city); - $stmt->bindParam(':address', $address); - $stmt->execute(); - echo "Record added successfully"; - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } - } -?> -

Lead Management

-
- - -
- -
-

Choose Date for filter

-
-
- - - -
  |   -
- - -
-
- -
-
-
- -
-
- - - -
-
- - -
- - - - - - - - - - - - - - - setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $searchQuery = isset($_GET['search']) ? trim($_GET['search']) : ''; - $start_date = isset($_GET['start_date']) ? $_GET['start_date'] : ''; - $end_date = isset($_GET['end_date']) ? $_GET['end_date'] : ''; - $accessArray = explode(",", $_SESSION['access']); - $placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,? - $placeholderString = implode(',', array_fill(0, count($accessArray), '?')); - if (!empty($searchQuery)) { - // this is keywords search - $stmt = $conn->prepare("SELECT * FROM cleads WHERE (id LIKE ? OR name LIKE ? OR email LIKE ? OR phone LIKE ?) AND business_type = ? ORDER BY time DESC LIMIT ?, ?"); - $stmt->bindValue(1, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(2, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(3, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(4, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(5, $_GET['bv']); - $stmt->bindValue(6, 0, PDO::PARAM_INT); // Offset for pagination - $stmt->bindValue(7, $recordsPerPage, PDO::PARAM_INT); // Records per page - // this is for date serch - }elseif (!empty($start_date) && !empty($end_date)) { - $start_date = date('Y-m-d', strtotime($start_date)); - $end_date = date('Y-m-d', strtotime($end_date)); - $stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type = ? AND `time` BETWEEN ? AND ?"); - $stmt->bindValue(1, $_GET['bv']); - $stmt->bindValue(2, $start_date); - $stmt->bindValue(3, $end_date); - }else{ - // if user type admin then show all lead - if($_SESSION['user_type'] == 'admin'){ - $stmt = $conn->prepare("SELECT COUNT(*) FROM cleads"); - $stmt->execute(); - $totalRecords = $stmt->fetchColumn(); - - $totalPages = ceil($totalRecords / $recordsPerPage); - - $offset = ($currentPage - 1) * $recordsPerPage; - - $stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type = :business_type ORDER BY time DESC LIMIT :offset, :recordsPerPage"); - $stmt->bindParam(':business_type', $_GET['bv'], PDO::PARAM_INT); - $stmt->bindParam(':offset', $offset, PDO::PARAM_INT); - $stmt->bindParam(':recordsPerPage', $recordsPerPage, PDO::PARAM_INT); - }else{ - // if user type user then show only given access lead - $stmt = $conn->prepare("SELECT COUNT(*) FROM cleads WHERE business_type = ?"); - $stmt->bindValue(1, $_GET['bv']); - $stmt->execute(); - - $totalRecords = $stmt->fetchColumn(); - $totalPages = ceil($totalRecords / $recordsPerPage); - $offset = ($currentPage - 1) * $recordsPerPage; - - $stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type = :business_type ORDER BY time DESC LIMIT :offset, :recordsPerPage"); - $stmt->bindParam(':business_type', $_GET['bv']); - $stmt->bindParam(':offset', $offset, PDO::PARAM_INT); - $stmt->bindParam(':recordsPerPage', $recordsPerPage, PDO::PARAM_INT); - } - } - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - $row_count = count($rows); - for ($i = 0; $i < $row_count; $i++) { - // echo $row_count . " "; - } - echo "

Total ".$row_count." Rows Found

"; - // Status Conditional Color - foreach($rows as $row){ - if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';} - elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 2px solid #2C9C9C; border-radius: 20px; text-align: center; color: #2C9C9C;';} - elseif($row['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 2px solid #3F4254; border-radius: 20px; text-align: center; color: #3F4254;';} - elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 2px solid #40916C; border-radius: 20px; text-align: center; color: #40916C;';} - elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';} - // if status = warm then select - if($row['status'] == 'Warm'){$conditional_status = '

'.$row['status'].'

';}elseif($row['status'] != 'Warm'){$conditional_status = $row['status'];} - ?> - - - - - - - - - - Error: " . $e->getMessage() . "

"; - } - ?> - -
NameIDStatus UpdateContact DetailForm NameDate & TimeQuick Action
-

 

-

 

-
-
- - -
-
- - - - -
-
-

Add Lead

-

-
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
Lead Information
-
-
- - -
-
- - -
-
-
- - -
-
- -
-
-
- - - \ No newline at end of file diff --git a/.hta_slug/leads/delete-lead.php b/.hta_slug/leads/delete-lead.php deleted file mode 100644 index 62f4ee6..0000000 --- a/.hta_slug/leads/delete-lead.php +++ /dev/null @@ -1,27 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - - $stmt = $conn->prepare("DELETE FROM cleads WHERE id = :id"); - $stmt->bindParam(':id', $_POST['id']); - $stmt->execute(); - echo ''; - exit(); - } catch (PDOException $e) { - echo "

Error: " . $e->getMessage() . "

"; - } -} -?> -
-
-

Confirm to Delete id ?

- - - NO -
-
diff --git a/.hta_slug/leads/edit-lead copy.php b/.hta_slug/leads/edit-lead copy.php deleted file mode 100644 index 02449e9..0000000 --- a/.hta_slug/leads/edit-lead copy.php +++ /dev/null @@ -1,171 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("SELECT * FROM cleads WHERE id = :id"); - $stmt->bindParam(':id', $_GET['id']); - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - // var_dump($rows); - foreach($rows as $row){ ?> -
-

ID:

-

FormName:

-

Name:

-

Email:

-

Phone:

-

Subject:

-

Message:

-

Details:

-

Origin:

-

Time:

-
- Error: " . $e->getMessage() . "

"; -}; - -if($_SERVER['REQUEST_METHOD']=="POST" && $_POST['update_data']){ - try { - $conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); - $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("UPDATE cleads SET name = :name, email = :email, phone = :phone, date = :date, status = :status, user = :user WHERE id = :id"); - $stmt->bindParam(':name', $_POST['name']); - $stmt->bindParam(':email', $_POST['email']); - $stmt->bindParam(':phone', $_POST['phone']); - $stmt->bindParam(':date', $_POST['date']); - $stmt->bindParam(':status', $_POST['status']); - $stmt->bindParam(':user', $_POST['user']); - $stmt->bindParam(':id', $_GET['id']); - $stmt->execute(); - - echo "Record Updated successfully"; - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } -} -?> -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- -
-
- -
- -
- -
-
- setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("INSERT INTO comments (comments, user, locale, leadid) VALUES (:comments, :user, :locale, :leadid)"); - $stmt->bindParam(':comments', $_POST['comments']); - $stmt->bindParam(':user', $_SESSION['email']); - $stmt->bindParam(':locale', $local_lang); - $stmt->bindParam(':leadid', $_GET['id']); - $stmt->execute(); - echo "New Comment save successfully"; - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } - }; - - try { - $password = md5($_POST['pass']); - $email = $_POST['email']; - $conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); - $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("SELECT * FROM comments WHERE leadid = :leadid ORDER BY created_at DESC"); - $stmt->bindParam(':leadid', $_GET['id']); - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - // var_dump($rows); - foreach($rows as $row){ ?> -
-

-

-
- Error: " . $e->getMessage() . "

"; - }; - ?> - -
-
-
- -
-
- -
-
-
\ No newline at end of file diff --git a/.hta_slug/leads/edit-lead.php b/.hta_slug/leads/edit-lead.php deleted file mode 100644 index 06b71e7..0000000 --- a/.hta_slug/leads/edit-lead.php +++ /dev/null @@ -1,588 +0,0 @@ -prepare("SELECT COUNT(*) FROM comments WHERE leadid = :leadid"); - $stmt->bindParam(':leadid', $_GET['id']); - $stmt->execute(); - $totalRecords = $stmt->fetchColumn(); - // echo $totalRecords; - if($_SERVER['REQUEST_METHOD']=="POST" && $_POST['update_data']){ - try { - $conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); - $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("UPDATE cleads SET name = :name, email = :email, phone = :phone, date = :date, status = :status, user = :user, country = :country, state= :state, city = :city, address = :address, profession = :profession, coupon_code = :coupon_code, gender = :gender, warm_status = :warm_status WHERE id = :id"); - $stmt->bindParam(':name', $_POST['name']); - $stmt->bindParam(':email', $_POST['email']); - $stmt->bindParam(':phone', $_POST['phone']); - $stmt->bindParam(':date', $_POST['date']); - $stmt->bindParam(':status', $_POST['status']); - $stmt->bindParam(':user', $_POST['user']); - $stmt->bindParam(':country', $_POST['country']); - $stmt->bindParam(':state', $_POST['state']); - $stmt->bindParam(':city', $_POST['city']); - $stmt->bindParam(':address', $_POST['address']); - $stmt->bindParam(':profession', $_POST['profession']); - $stmt->bindParam(':coupon_code', $_POST['coupon_code']); - $stmt->bindParam(':gender', $_POST['gender']); - $stmt->bindParam(':warm_status', $_POST['warm_status']); - $stmt->bindParam(':id', $_GET['id']); - $stmt->execute(); - - echo "Record Updated successfully"; - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } - }; - try { - $password = md5($_POST['pass']); - $email = $_POST['email']; - $conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); - $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("SELECT * FROM cleads WHERE id = :id"); - $stmt->bindParam(':id', $_GET['id']); - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - // var_dump($rows); - foreach($rows as $row){ - $nameParts = explode(" ", $row['name']); - $firstInitial = substr($nameParts[0], 0, 1); - $lastInitial = substr($nameParts[count($nameParts) - 1], 0, 1); - $name_letter = $firstInitial.$lastInitial; - if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 1px solid #FB5555; border-radius: 5px; color: #FB5555;';} - elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 1px solid #2C9C9C; border-radius: 5px; color: #2C9C9C;';} - elseif($row['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 1px solid #3F4254; border-radius: 5px; color: #3F4254;';} - elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 1px solid #40916C; border-radius: 5px; color: #40916C;';} - elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 1px solid #FB5555; border-radius: 5px; color: #FB5555;';} -?> -
-
-
-
-
-
-

-
- - -
-
-
- - -
-
- - -
-
-
-
-

Client ID

-

-
-
-

Form Name

-

-
-
-
-
-

Country

- -
-
-

State

- -
-
-

City

- -
-
-
-
-

Address

- -
-
-

Profession

- -
-
-
-
-

Origin

-

-
-
-

Lead Status

-
- - '; - $options = array("Proposal Sent", "Meeting Conducted", "Interested"); - foreach ($options as $option) { - $selected = ($option == $row['warm_status']) ? 'selected' : ''; - echo ''; - } - echo ''; - } - ?> -
-
-
-
-
-

Coupon Code

- -
-
-

Time

-

-
-
-
-
-

Follow Update

- -
-
-
- -
-
-
-
-
-
-
-

Comments:

- -
-
-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("INSERT INTO comments (comments, user, locale, leadid) VALUES (:comments, :user, :locale, :leadid)"); - $stmt->bindParam(':comments', $_POST['comments']); - $stmt->bindParam(':user', $_SESSION['email']); - $stmt->bindParam(':locale', $local_lang); - $stmt->bindParam(':leadid', $_GET['id']); - $stmt->execute(); - echo "New Comment save successfully"; - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } - }; -?> - -
-
-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("SELECT * FROM comments WHERE leadid = :leadid ORDER BY created_at DESC"); - $stmt->bindParam(':leadid', $_GET['id']); - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - foreach($rows as $row){ - $commenter_name_parts = explode("@", $row['user']); - $commenter_first_name_letter = substr($commenter_name_parts[0], 0, 1); - $commenter_last_name_letter = substr($commenter_name_parts[count($commenter_name_parts) - 1], 0, 1); -?> -
-
-

-


-

-
-

-
-Error: " . $e->getMessage() . "

"; - }; - - if($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['appt_comment'] && $_POST['appt_date'] ){ - try { - $conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); - $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("INSERT INTO appointment (appt_date, email, name, leadid, comment) VALUES (:appt_date, :email, :name, :leadid, :comment)"); - $stmt->bindParam(':appt_date', $_POST['appt_date']); - $stmt->bindParam(':email', $_SESSION['email']); - $stmt->bindParam(':name', $_SESSION['name']); - $stmt->bindParam(':leadid', $_GET['id']); - $stmt->bindParam(':comment', $_POST['comment']); - $stmt->execute(); - $saved_message = "New Appointment save successfully"; - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } - }; - if($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['appt_comment_update'] && $_POST['appt_date'] ){ - try { - $conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); - $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("UPDATE appointment SET appt_date = :appt_date, comment = :comment WHERE id = :appointment_id AND leadid = :leadid"); - $stmt->bindParam(':appt_date', $_POST['appt_date']); - $stmt->bindParam(':comment', $_POST['comment']); - $stmt->bindParam(':leadid', $_GET['id']); - $stmt->bindParam(':appointment_id', $_POST['appointment_id']); - - $stmt->execute(); - - $saved_message = "Appointment updated successfully"; - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } - }; -?> -
-
-
-
-
-

Add Appointment

-

-
- -
-
-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $stmt = $conn->prepare("SELECT * FROM appointment WHERE leadid = :leadid"); - $stmt->bindParam(':leadid', $_GET['id']); - $stmt->execute(); - $appt_data = $stmt->fetchAll(PDO::FETCH_ASSOC); - - // Custom function to compare appointment dates - function compareAppointmentDates($a, $b) { - $dateA = new DateTime($a['appt_date']); - $dateB = new DateTime($b['appt_date']); - $currentDateTime = new DateTime(); - - // Compare appointment dates - if ($dateA == $dateB) { - return 0; - } - - // Check if appointments are in the future or past - if ($dateA > $currentDateTime && $dateB > $currentDateTime) { - return ($dateA < $dateB) ? -1 : 1; // Sort by ascending date - } elseif ($dateA < $currentDateTime && $dateB < $currentDateTime) { - return ($dateA < $dateB) ? 1 : -1; // Sort by descending date - } else { - // One appointment is in the future and one is in the past - return ($dateA > $dateB) ? -1 : 1; // Sort the future appointment first - } - } - - // Sort appointments based on appointment date - usort($appt_data, 'compareAppointmentDates'); - foreach($appt_data as $appt){ - $apptID = $appt['id']; - // echo $appt['name']; - $apptDate = explode(" ", $appt['appt_date']); - $currentDateTime = new DateTime(); - $appointmentDateTime = new DateTime($appt['appt_date']); - - if ($appointmentDateTime > $currentDateTime) { - $app_status = 'Next Appointment'; - } elseif ($appointmentDateTime < $currentDateTime) { - $app_status = 'Expired Appointment'; - } else { - $app_status = 'Today\'s Appointment'; - } -?> -
-
-

- -
-
-

-
-

-

-
-
-
-
-
-

-
-
-
- - -
- -
- - -
-
- -
-
-
- Error: " . $e->getMessage() . "

"; - }; -?> -
-
- -
-
-Error: " . $e->getMessage() . "

"; - }; - -?> -
-

-
-
- - -
-
- - -
-
- -
-
-
- - - \ No newline at end of file diff --git a/.hta_slug/leads/my-leads.php b/.hta_slug/leads/my-leads.php deleted file mode 100644 index 3a0e1fd..0000000 --- a/.hta_slug/leads/my-leads.php +++ /dev/null @@ -1,568 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } catch(PDOException $e) { - echo "Connection failed: " . $e->getMessage(); - } - if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['new_lead']) && $_POST['new_lead'] && isset($_POST['name']) && $_POST['name'] && isset($_POST['phone']) && $_POST['phone']) { - $name = $_POST['name']; - $email = $_POST['email']; - $phone = $_POST['phone']; - $formname = 'crm-portal'; - $note = $_POST['note']; - $origin = $_POST['origin']; - $gender = $_POST['gender']; - $profession = $_POST['profession']; - $country = $_POST['country']; - $state = $_POST['state']; - $city = $_POST['city']; - $address = $_POST['address']; - $status = 'New'; - try { - $stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address)"); - $stmt->bindParam(':name', $name); - $stmt->bindParam(':email', $email); - $stmt->bindParam(':phone', $phone); - $stmt->bindParam(':formname', $formname); - $stmt->bindParam(':note', $note); - $stmt->bindParam(':origin', $origin); - $stmt->bindParam(':status', $status); - $stmt->bindParam(':gender', $gender); - $stmt->bindParam(':profession', $profession); - $stmt->bindParam(':country', $country); - $stmt->bindParam(':state', $state); - $stmt->bindParam(':city', $city); - $stmt->bindParam(':address', $address); - $stmt->execute(); - echo "Record added successfully"; - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } - } -?> -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $delete_placeholders = rtrim(str_repeat('?,', count($selectedIds)), ','); - $stmt = $conn->prepare("DELETE FROM cleads WHERE id IN ($delete_placeholders)"); - foreach($selectedIds as $key => $id) { - $stmt->bindValue($key + 1, $id, PDO::PARAM_INT); - } - $stmt->execute(); - } catch(PDOException $e) { - echo "Error: " . $e->getMessage(); - } - } - } -?> -

Lead Management

-
- - -
- -
-

Choose Date for filter

-
-
- - -
  |   -
- - -
-
- -
-
-
-

Delete

- -
-
- - -
-
- -
- -
- - - - - - '; - ?> - - - - - - - - - - - setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $searchQuery = isset($_GET['search']) ? trim($_GET['search']) : ''; - $start_date = isset($_GET['start_date']) ? $_GET['start_date'] : ''; - $end_date = isset($_GET['end_date']) ? $_GET['end_date'] : ''; - $accessArray = explode(",", $_SESSION['access']); - $placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,? - $placeholderString = implode(',', array_fill(0, count($accessArray), '?')); - - $all_states = "WB, SK"; - $state_array = explode(',', $all_states); - $state_placeholder = rtrim(str_repeat('?,', count($state_array)), ','); - - if (!empty($searchQuery)) { - // this is keywords search - $stmt = $conn->prepare("SELECT * FROM cleads WHERE (id LIKE ? OR name LIKE ? OR email LIKE ? OR phone LIKE ?) AND business_type IN ($placeholders) ORDER BY time DESC LIMIT ?, ?"); - $stmt->bindValue(1, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(2, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(3, "%$searchQuery%", PDO::PARAM_STR); - $stmt->bindValue(4, "%$searchQuery%", PDO::PARAM_STR); - foreach ($accessArray as $key => $value) { - $stmt->bindValue($key + 5, $value); - } - $stmt->bindValue(count($accessArray) + 5, 0, PDO::PARAM_INT); // Offset for pagination - $stmt->bindValue(count($accessArray) + 6, $recordsPerPage, PDO::PARAM_INT); // Records per page - // this is for date serch - }elseif (!empty($start_date) && !empty($end_date)) { - $start_date = date('Y-m-d', strtotime($start_date)); - $end_date = date('Y-m-d', strtotime($end_date)); - $stmt = $conn->prepare("SELECT * FROM cleads WHERE time BETWEEN ? AND ? AND business_type IN ($placeholders)"); - $stmt->bindValue(1, $start_date); - $stmt->bindValue(2, $end_date); - foreach ($accessArray as $key => $value) { - $stmt->bindValue($key + 3, $value); - } - }else{ - // if user type admin then show all lead - if($_SESSION['user_type'] == 'admin'){ - $stmt = $conn->prepare("SELECT COUNT(*) FROM cleads"); - $stmt->execute(); - $totalRecords = $stmt->fetchColumn(); - - $totalPages = ceil($totalRecords / $recordsPerPage); - - $offset = ($currentPage - 1) * $recordsPerPage; - - $stmt = $conn->prepare("SELECT * FROM cleads ORDER BY time DESC LIMIT :offset, :recordsPerPage"); - $stmt->bindParam(':offset', $offset, PDO::PARAM_INT); - $stmt->bindParam(':recordsPerPage', $recordsPerPage, PDO::PARAM_INT); - }else{ - $stmt = $conn->prepare("SELECT COUNT(*) FROM cleads WHERE business_type IN ($placeholders) AND state IN ($state_placeholder)"); - - // Bind values for business types - foreach ($accessArray as $key => $value) { - $stmt->bindValue($key + 1, $value); - } - - // Bind values for states - $statePlaceholderStartIndex = count($accessArray) + 1; // Start index for state placeholders - foreach ($state_array as $key => $state_value) { - $stmt->bindValue($statePlaceholderStartIndex + $key, $state_value); - } - - $stmt->execute(); - - $totalRecords = $stmt->fetchColumn(); - $totalPages = ceil($totalRecords / $recordsPerPage); - $offset = ($currentPage - 1) * $recordsPerPage; - - // Adjusting the SQL query to remove duplicate state placeholders - $state_placeholders = implode(',', array_fill(0, count($state_array), '?')); // Generate placeholders for states - $stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) AND state IN ($state_placeholders) ORDER BY time DESC LIMIT ?, ?"); - - // Bind values for business types - $paramCount = count($accessArray); - for ($i = 0; $i < $paramCount; $i++) { - $stmt->bindValue($i + 1, $accessArray[$i]); - } - - // Bind values for states - $statePlaceholderStartIndex = $paramCount + 1; // Start index for state placeholders - for ($i = 0; $i < count($state_array); $i++) { - $stmt->bindValue($statePlaceholderStartIndex + $i, $state_array[$i]); - } - - // Bind the offset and recordsPerPage parameters - $stmt->bindValue($paramCount + count($state_array) + 1, $offset, PDO::PARAM_INT); - $stmt->bindValue($paramCount + count($state_array) + 2, $recordsPerPage, PDO::PARAM_INT); - - - - } - } - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - var_dump($rows); - $row_count = count($rows); - for ($i = 0; $i < $row_count; $i++) { - // echo $row_count . " "; - } - echo "

Total ".$row_count." Rows Found

"; - // Status Conditional Color - foreach($rows as $row){ - $lead_id = $row['id']; - if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';} - elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 2px solid #2C9C9C; border-radius: 20px; text-align: center; color: #2C9C9C;';} - elseif($row['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 2px solid #3F4254; border-radius: 20px; text-align: center; color: #3F4254;';} - elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 2px solid #40916C; border-radius: 20px; text-align: center; color: #40916C;';} - elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 2px solid #FB5555; border-radius: 20px; text-align: center; color: #FB5555;';} - // if status = warm then select - // if($row['status'] == 'Warm'){$conditional_status = '

'.$row['status'].'

';}elseif($row['status'] != 'Warm'){$conditional_status = $row['status'];} - ?> - - - - - - - - - - - - - Error: " . $e->getMessage() . "

"; - } - ?> - -
NameIDStatus UpdateForm NameDate & TimeQuick Action
- -
-
- - -
-
-
- - - - -
-
-

Add Lead

-

-
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
Lead Information
-
-
- - -
-
- - -
-
-
- - -
-
- -
-
-
- - - \ No newline at end of file diff --git a/.hta_slug/leads/test.php b/.hta_slug/leads/test.php deleted file mode 100644 index ee4c894..0000000 --- a/.hta_slug/leads/test.php +++ /dev/null @@ -1,15 +0,0 @@ - - - - - -WhatsApp Message Link - - - - -Click here to message - - - - \ No newline at end of file diff --git a/.hta_slug/leads/v3.php b/.hta_slug/leads/v3.php deleted file mode 100644 index d801f7d..0000000 --- a/.hta_slug/leads/v3.php +++ /dev/null @@ -1,68 +0,0 @@ - -
- - - - - - - - - - - - - - - setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $accessArray = explode(",", $_SESSION['access']); - $placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,? - $stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) LIMIT 2"); - foreach ($accessArray as $key => $value) { - $stmt->bindValue($key + 1, $value); - } - $stmt->execute(); - $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); - // var_dump($rows); - echo json_encode($rows); - echo ' -
- - - - - '; - $num_rows = $stmt->rowCount(); - - } catch (PDOException $e) { - echo "

Error: " . $e->getMessage() . "

"; - } - - ?> - - -
NameIDStatusEmailPhonebusiness_typeTimeAction
-
- \ No newline at end of file diff --git a/.hta_slug/leads/v4.php b/.hta_slug/leads/v4.php deleted file mode 100644 index 02974c5..0000000 --- a/.hta_slug/leads/v4.php +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - Grid.js Row Selection Example - - - - - -
- - - -