From 7af59fdbdd4434d8368caaeac56e60cd9de77a22 Mon Sep 17 00:00:00 2001 From: Suvodip Date: Wed, 8 May 2024 23:29:29 +0530 Subject: [PATCH] c --- .hta_slug/edit-lead.php | 8 ++-- .hta_slug/my-leads.php | 10 +++-- .hta_slug/profile.php | 83 +++++++++++++++++++++++++++++++++++++++++ .htac_nav.php | 2 +- 4 files changed, 94 insertions(+), 9 deletions(-) create mode 100644 .hta_slug/profile.php diff --git a/.hta_slug/edit-lead.php b/.hta_slug/edit-lead.php index 454db12..83efff0 100644 --- a/.hta_slug/edit-lead.php +++ b/.hta_slug/edit-lead.php @@ -51,9 +51,9 @@ foreach($rows as $row){ $nameParts = explode(" ", $row['name']); $firstInitial = substr($nameParts[0], 0, 1); - $lastInitial = substr($nameParts[1], 0, 1); - // $lastInitial = substr($nameParts[count($nameParts) - 1], 0, 1); - $name_letter = $firstInitial.$lastInitial; + $lastInitial = isset($nameParts[1]) ? substr($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;';} @@ -413,7 +413,7 @@ - +
diff --git a/.hta_slug/my-leads.php b/.hta_slug/my-leads.php index 168feb0..6e18614 100644 --- a/.hta_slug/my-leads.php +++ b/.hta_slug/my-leads.php @@ -219,11 +219,13 @@ $placeholderString = implode(',', array_fill(0, count($accessArray), '?')); //first query to get the total number for pagination - $parts = explode(',', $_SESSION["states"]); + $states=$_SESSION["states"]; + if( strlen($_SESSION["states"]) <2 ) $states='no_states_access_selected'; + $parts = explode(',', $states); $quotedParts = array_map(function($item) { return "'" . $item . "'";}, $parts); - $newStr = implode(',', $quotedParts); + $stateAcc = implode(',', $quotedParts); - $sql= "SELECT COUNT(*) FROM cleads WHERE state IN ($newStr) OR user LIKE :user AND business_type LIKE :businessVertical AND (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date "; + $sql= "SELECT COUNT(*) FROM cleads WHERE state IN ($stateAcc) OR user LIKE :user AND business_type LIKE :businessVertical AND (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date "; $stmt = $conn->prepare($sql); $stmt->bindValue(':businessVertical', $businessVertical); $stmt->bindValue(':searchTerm', "%".$searchTerm."%"); @@ -235,7 +237,7 @@ // second & final query to get the page_view data - $sql = "SELECT * FROM cleads WHERE state IN ($newStr) OR user LIKE :user AND business_type LIKE :businessVertical AND (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date ORDER BY id DESC LIMIT :limit OFFSET :offset"; + $sql = "SELECT * FROM cleads WHERE state IN ($stateAcc) OR user LIKE :user AND business_type LIKE :businessVertical AND (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date ORDER BY id DESC LIMIT :limit OFFSET :offset"; $stmt = $conn->prepare($sql); $stmt->bindValue(':businessVertical', $businessVertical, PDO::PARAM_STR ); $stmt->bindValue(':searchTerm', "%$searchTerm%"); // PDO::PARAM_STR is the default data type binding so is not needed diff --git a/.hta_slug/profile.php b/.hta_slug/profile.php new file mode 100644 index 0000000..6283acf --- /dev/null +++ b/.hta_slug/profile.php @@ -0,0 +1,83 @@ + +
+

Profile

+
+
+ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $stmt = $conn->prepare("UPDATE users SET name = :name, email = :email, pass = :pass WHERE email = :userID"); + $stmt->bindParam(':name', $_POST['name']); + $stmt->bindParam(':email', $_POST['email']); + $stmt->bindParam(':pass', $convertPass); + $stmt->bindParam(':userID', $_SESSION['email']); + $stmt->execute(); + + echo ''; + } 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); + $stmt = $conn->prepare("SELECT * FROM users WHERE email = :email"); + $stmt->bindParam(':email', $_SESSION['email']); + $stmt->execute(); + $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); + foreach($rows as $row){ + $nameParts = explode(" ", $row['name']); + $firstInitial = substr($nameParts[0], 0, 1); + $lastInitial = substr($nameParts[count($nameParts) - 1], 0, 1); + $nameLetter = $firstInitial.$lastInitial; + ?> +
+

+
+
+
+ + +
+
+ + +
+
+ + +
+
+ +

+
+
+ +

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

"; + }; + ?> + + + +
+

if change profile information then login again

+
\ No newline at end of file diff --git a/.htac_nav.php b/.htac_nav.php index a1d76d6..ace1603 100644 --- a/.htac_nav.php +++ b/.htac_nav.php @@ -51,7 +51,7 @@ $lastInitial = substr($nameParts[count($nameParts) - 1], 0, 1); echo '

Hi '.$nameParts[0].'

  -

'.$firstInitial.$lastInitial.'

+ '.$firstInitial.$lastInitial.'
'; } } catch (PDOException $e) {