Fix Ignoring session_start() because a session is already active added action menu under contacts

This commit is contained in:
johnny@pittpc.com
2021-02-04 13:40:33 -05:00
parent ca8405f39d
commit 17710cf6b8
3 changed files with 20 additions and 10 deletions

View File

@@ -4,7 +4,9 @@
header("Location: setup.php"); header("Location: setup.php");
} }
session_start(); if(!isset($_SESSION)){
session_start();
}
if(!$_SESSION['logged']){ if(!$_SESSION['logged']){
header("Location: logout.php"); header("Location: logout.php");

View File

@@ -1,9 +1,5 @@
<?php <?php
//Rebuild URL
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
//Paging //Paging
if(isset($_GET['p'])){ if(isset($_GET['p'])){
$p = intval($_GET['p']); $p = intval($_GET['p']);
@@ -40,12 +36,12 @@ if(isset($_GET['o'])){
$disp = "DESC"; $disp = "DESC";
} }
//Rebuild URL
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM contacts WHERE client_id = $client_id AND (contact_name LIKE '%$q%') ORDER BY $sb $o LIMIT $record_from, $record_to"); $sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM contacts WHERE client_id = $client_id AND (contact_name LIKE '%$q%') ORDER BY $sb $o LIMIT $record_from, $record_to");
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$total_found_rows = $num_rows[0];
$total_pages = ceil($total_found_rows / 10);
?> ?>
@@ -74,6 +70,7 @@ $total_pages = ceil($total_found_rows / 10);
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_title&o=<?php echo $disp; ?>">Title</a></th> <th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_title&o=<?php echo $disp; ?>">Title</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_email&o=<?php echo $disp; ?>">Email</a></th> <th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_email&o=<?php echo $disp; ?>">Email</a></th>
<th>Phone</th> <th>Phone</th>
<th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -138,6 +135,18 @@ $total_pages = ceil($total_found_rows / 10);
} }
?> ?>
</td> </td>
<td>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editContactModal<?php echo $contact_id; ?>">Edit</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="post.php?delete_contact=<?php echo $contact_id; ?>">Delete</a>
</div>
</div>
</td>
</tr> </tr>
@@ -153,7 +162,6 @@ $total_pages = ceil($total_found_rows / 10);
</table> </table>
<?php include("pagination.php"); ?> <?php include("pagination.php"); ?>
<?php include("delete_confirm_modal.php"); ?>
</div> </div>
</div> </div>

View File

@@ -105,7 +105,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tr> <tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_name&o=<?php echo $disp; ?>">Vendor</a></th> <th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_name&o=<?php echo $disp; ?>">Vendor</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_description&o=<?php echo $disp; ?>">Description</a></th> <th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_description&o=<?php echo $disp; ?>">Description</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_contact&o=<?php echo $disp; ?>">Contact</a></th> <th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_contact_name&o=<?php echo $disp; ?>">Contact</a></th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>