alert('$message'); window.location.href = '$redirectUrl'; "; exit(); } else { setcookie($_COOKIE["username"], '', time() - 3600, '/'); header("Location: https://blackhoundenterprises.com/invoices/index.php"); exit(); } } } else { setcookie($_COOKIE["username"], '', time() - 3600, '/'); header("Location: https://blackhoundenterprises.com/invoices/index.php"); exit(); } if(isset($_GET['logout']) && $_GET['logout'] == 1) { // Delete the cookie by setting its expiration time to a past value setcookie("username", $_COOKIE["username"], time() - 3600, '/'); // Redirect to the login page or any other page header("Location: https://blackhoundenterprises.com/invoices/index.php"); exit(); } // Check if the projects.db file exists, and if not, create it $dbFile1 = 'database/clients.db'; if (!file_exists($dbFile1)) { $db = new SQLite3($dbFile1); if (!$db) { die("Failed to create the database file."); } // Create the 'projects' table $createQuery = "CREATE TABLE IF NOT EXISTS clients ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, mobile TEXT, email TEXT, address TEXT )"; $db->exec($createQuery); if (!$db->exec($createQuery)) { die("Failed to create the 'clients' table."); } $db->close(); } else { $db = new SQLite3($dbFile1); if (!$db) { die("Database connection failed: " . $db->lastErrorMsg()); } } // Function to fetch and display data function displayData($db) { $query = "SELECT id, name, mobile, email, address, status FROM clients"; $result = $db->query($query); while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $projectId = $row['id']; $addressParts = explode(',', $row['address']); $NoAndRoad = $addressParts[0]; $area = $addressParts[1]; $fulladdress = $addressParts[0] . "," . $addressParts[1] . "," . $addressParts[2]; $encoded_address = urlencode($fulladdress); $maps_url = "https://maps.google.com/maps?q=" . $encoded_address; if ($row['status'] == "N"){ echo ""; echo "" . $row['name'] . ""; echo "" . $row['mobile']. ""; echo "" . $row['email'] . ""; echo "" .$row['address'] . ""; echo "" . $row['id'] . ""; echo "" . $row['status'] . ""; echo ''; echo ''; echo ""; } } } // Function to fetch and display data function displayData2($db) { $query = "SELECT id, name, mobile, email, address, status FROM clients"; $result = $db->query($query); while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $projectId = $row['id']; $encoded_address = urlencode($row['address']); $maps_url = "https://maps.google.com/maps?q=" . $encoded_address; if ($row['status'] == "O"){ echo ""; echo "" . $row['name'] . ""; echo "" . $row['mobile']. ""; echo "" . $row['email'] . ""; echo "" .$row['address'] . ""; echo "" . $row['id'] . ""; echo "" . $row['status'] . ""; echo ''; echo ''; echo ""; } } } if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["update"])) { $updatedData = $_POST["updatedData"]; $projectId = $_POST["projectId"]; $updateQuery = "UPDATE clients SET name = :name, mobile = :mobile, email = :email, address = :address WHERE id = :id"; $stmt = $db->prepare($updateQuery); if (!$stmt) { die("Prepare failed: " . $db->lastErrorMsg()); } $stmt->bindValue(':name', $updatedData['name'], SQLITE3_TEXT); $stmt->bindValue(':mobile', $updatedData['mobile'], SQLITE3_TEXT); $stmt->bindValue(':email', $updatedData['email'], SQLITE3_TEXT); $stmt->bindValue(':address', $updatedData['address'], SQLITE3_TEXT); $stmt->bindValue(':id', $projectId, SQLITE3_INTEGER); $result = $stmt->execute(); if (!$result) { die("Execute failed: " . $db->lastErrorMsg()); } // Close the prepared statement $stmt->close(); } ?> Clients
Home Clients Projects Invoices Statistics Leads Logout

ACTIVE CLIENTS

Client Mobile Email Address


ARCHIVED CLIENTS



Client Mobile Email Address





close(); ?>