From c394e927b1b168231bdddb18ce8d652bf89517be Mon Sep 17 00:00:00 2001 From: root Date: Mon, 18 Mar 2019 15:08:56 -0400 Subject: [PATCH] Added start_page function in config, Added Contacts and Locations, seperated client nav and page routes out --- add_client_contact_modal.php | 3 +- add_client_location_modal.php | 64 +++++++++++++++++++++++++++++++++ client.php | 68 ++++++++++------------------------- client_contacts.php | 10 +++--- client_locations.php | 53 +++++++++++++++++++++++++++ client_nav.php | 35 ++++++++++++++++++ client_routes.php | 42 ++++++++++++++++++++++ config.php | 2 ++ login.php | 2 +- post.php | 36 +++++++++++++++++++ 10 files changed, 257 insertions(+), 58 deletions(-) create mode 100644 add_client_location_modal.php create mode 100644 client_locations.php create mode 100644 client_nav.php create mode 100644 client_routes.php diff --git a/add_client_contact_modal.php b/add_client_contact_modal.php index 362f7d82..1065a239 100644 --- a/add_client_contact_modal.php +++ b/add_client_contact_modal.php @@ -8,6 +8,7 @@
+
diff --git a/add_client_location_modal.php b/add_client_location_modal.php new file mode 100644 index 00000000..5e935824 --- /dev/null +++ b/add_client_location_modal.php @@ -0,0 +1,64 @@ + \ No newline at end of file diff --git a/client.php b/client.php index 4d53bf85..e2dc1aa4 100644 --- a/client.php +++ b/client.php @@ -31,7 +31,18 @@ if(isset($_GET['client_id'])){ @@ -41,63 +52,20 @@ if(isset($_GET['client_id'])){
- +
- +
+ + + + +
@@ -18,18 +18,18 @@ $client_contact_id = $row['client_contact_id']; $client_contact_name = $row['client_contact_name']; $client_contact_title = $row['client_contact_title']; - $client_contact_email = $row['client_contact_email']; $client_contact_phone = $row['client_contact_phone']; if(strlen($client_contact_phone)>2){ $client_contact_phone = substr($row['client_contact_phone'],0,3)."-".substr($row['client_contact_phone'],3,3)."-".substr($row['client_contact_phone'],6,4); } + $client_contact_email = $row['client_contact_email']; ?> - +
-
- - \ No newline at end of file + \ No newline at end of file diff --git a/client_locations.php b/client_locations.php new file mode 100644 index 00000000..aa89616d --- /dev/null +++ b/client_locations.php @@ -0,0 +1,53 @@ + + +
+ + + + + + + + + + + 2){ + $client_location_phone = substr($row['client_location_phone'],0,3)."-".substr($row['client_location_phone'],3,3)."-".substr($row['client_location_phone'],6,4); + } + + ?> + + + + + + + + + + +
NameAddressPhoneActions
" target="_blank"> + +
+
\ No newline at end of file diff --git a/client_nav.php b/client_nav.php new file mode 100644 index 00000000..c6b66cae --- /dev/null +++ b/client_nav.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/client_routes.php b/client_routes.php new file mode 100644 index 00000000..e10c9495 --- /dev/null +++ b/client_routes.php @@ -0,0 +1,42 @@ + \ No newline at end of file diff --git a/config.php b/config.php index a75bf694..bccc8a7d 100644 --- a/config.php +++ b/config.php @@ -10,6 +10,8 @@ $config_time_format = "h:ia"; $config_no_records = "There is nothing here!"; + $config_start_page = "clients.php"; + $config_company_name = "PittPC"; $config_company_address = ""; $config_company_city = ""; diff --git a/login.php b/login.php index 8f1d398a..fee70e0e 100644 --- a/login.php +++ b/login.php @@ -17,7 +17,7 @@ if(isset($_POST['login'])){ $_SESSION['user_id'] = $row['user_id']; $_SESSION['name'] = $row['name']; - header("Location: index.php"); + header("Location: $config_start_page"); }else{ $response = "
diff --git a/post.php b/post.php index f0a92dca..022b9b39 100644 --- a/post.php +++ b/post.php @@ -362,6 +362,42 @@ if(isset($_GET['delete_invoice_payment'])){ } +if(isset($_POST['add_client_contact'])){ + + $client_id = intval($_POST['client_id']); + $name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])); + $title = strip_tags(mysqli_real_escape_string($mysqli,$_POST['title'])); + $phone = strip_tags(mysqli_real_escape_string($mysqli,$_POST['phone'])); + $phone = preg_replace("/[^0-9]/", '',$phone); + $email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email'])); + + mysqli_query($mysqli,"INSERT INTO client_contacts SET client_contact_name = '$name', client_contact_title = '$title', client_contact_phone = '$phone', client_contact_email = '$email', client_id = $client_id"); + + $_SESSION['alert_message'] = "Contact added"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} + +if(isset($_POST['add_client_location'])){ + + $client_id = intval($_POST['client_id']); + $name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])); + $address = strip_tags(mysqli_real_escape_string($mysqli,$_POST['address'])); + $city = strip_tags(mysqli_real_escape_string($mysqli,$_POST['city'])); + $state = strip_tags(mysqli_real_escape_string($mysqli,$_POST['state'])); + $zip = strip_tags(mysqli_real_escape_string($mysqli,$_POST['zip'])); + $phone = strip_tags(mysqli_real_escape_string($mysqli,$_POST['phone'])); + $phone = preg_replace("/[^0-9]/", '',$phone); + + mysqli_query($mysqli,"INSERT INTO client_locations SET client_location_name = '$name', client_location_address = '$address', client_location_city = '$city', client_location_state = '$state', client_location_zip = '$zip', client_location_phone = '$phone', client_id = $client_id"); + + $_SESSION['alert_message'] = "Location added"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} + if(isset($_POST['add_user'])){ $email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email'])); $password = mysqli_real_escape_string($mysqli,$_POST['password']);