Code: Select all
<?php
/*
$Id: stats_inactive_user.php,v 1.2 2004/05/02 15:00:00
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2004 osCommerce
Released under the GNU General Public License
Created by John Wood - www.z-is.net
*/
require('includes/application_top.php');
require('includes/template_top.php');
?>
<h1 class="display-4 mb-2"><?php echo HEADING_TITLE; ?></h1>
<?php
$cust_query = tep_db_query("select customers_firstname, customers_lastname from " . 'customers' . " where customers_id = '" . $_GET['id'] . "'");
$cust = tep_db_fetch_array($cust_query);
if ($_GET['go'] == ''){
?>
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ID; ?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_EMAIL; ?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NEWS; ?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ACCOUNT_CREATED; ?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LAST_LOGON; ?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_DELETE; ?></td>
</tr>
</thead>
<?php
$siu_query_raw = "select ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter from " . 'customers_info' . " ci, " . 'customers' . " c left join " . 'orders' . " o on c.customers_id = o.customers_id where o.customers_id is NULL and c.customers_id = ci.customers_info_id order by c.customers_id";
$siu_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $siu_query_raw, $siu_query_numrows );
$siu_query = tep_db_query($siu_query_raw);
while ($customers = tep_db_fetch_array($siu_query)) {
if ($customers['customers_newsletter'] == '1') {
$customers['customers_newsletter'] = NEWSLETTER_YES;
} else {
$customers['customers_newsletter'] = NEWSLETTER_NO ;
}
?>
<tbody>
<tr class="dataTableRow">
<td class="dataTableContent"><?php echo $customers['customers_id'];?></td>
<td class="dataTableContent"><?php echo $customers['customers_firstname'] . ' ' . $customers['customers_lastname'];?></td>
<td class="dataTableContent"><?php echo '<a href="mailto:' . $customers['customers_email_address'] . '"><u>' . $customers['customers_email_address'] . '</u></a>' ; ?></td>
<td class="dataTableContent"><?php echo $customers['customers_newsletter']; ?></td>
<td class="dataTableContent"><?php echo tep_date_short($customers['customers_info_date_account_created']); ?></td>
<td class="dataTableContent"><?php echo tep_date_short($customers['customers_info_date_of_last_logon']); ?></td>
<td class="dataTableContent"><?php echo '<a href="' . tep_href_link('stats_inactive_user.php', 'go=delete&id=' . $customers['customers_id'] . '&page=' . $_GET['page']) .'">' . SIU_DELETE . '</a>'; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="row">
<div class="col-sm-6"><?php echo $siu_split->display_count($siu_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></div>
<div class="col-sm-6 text-sm-right"><?php echo $siu_split->display_links($siu_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?></div>
</tr>
</div>
<?php
} elseif ($_GET['go'] == 'delete'){
echo '<br />' . sprintf(SURE_TO_DELETE, $cust['customers_firstname'] . ' ' . $cust['customers_lastname']) . '<br /><br />' . tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link('stats_inactive_user.php', 'page=' . $page . '&go=deleteyes&id=' . $cid)) . ' ' . tep_draw_button(IMAGE_CANCEL, 'cancel', tep_href_link('stats_inactive_user.php', 'page=' . $page), 'primary') . '<br /><br />';
} elseif ($_GET['go'] == 'deleteyes'){
tep_db_query("DELETE FROM " . 'customers' . " where customers_id = '" . $_GET['id'] . "'");
tep_db_query("DELETE FROM " . 'customers_basket' . " where customers_id = '" . $_GET['id'] . "'");
tep_db_query("DELETE FROM " . 'customers_basket_attributes' . " where customers_id = '" . $_GET['id'] . "'");
tep_db_query("DELETE FROM " . 'customers_info' . " where customers_info_id = '" . $_GET['id'] . "'");
tep_db_query("DELETE FROM " . 'address_book' . " where customers_id = '" . $_GET['id'] . "'");
tep_db_query("DELETE FROM " . 'products_notifications' . " where customers_id = '" . $_GET['id'] . "'");
echo '<br />' . sprintf(SIU_CUSTOMER_DELETED, $cust['customers_firstname'] . ' ' . $cust['customers_lastname']) . '<br /><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('stats_inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>';
}
?>
<?php
require 'includes/template_bottom.php';
require 'includes/application_bottom.php';
?>
Code: Select all
<?php
} elseif ($_GET['go'] == 'delete'){
echo '<br />' . sprintf(SURE_TO_DELETE, $cust['customers_firstname'] . ' ' . $cust['customers_lastname']) . '<br /><br />' . tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link('stats_inactive_user.php', 'page=' . $page . '&go=deleteyes&id=' . $cid)) . ' ' . tep_draw_button(IMAGE_CANCEL, 'cancel', tep_href_link('stats_inactive_user.php', 'page=' . $page), 'primary') . '<br /><br />';
} elseif ($_GET['go'] == 'deleteyes'){
tep_db_query("DELETE FROM customers WHERE customers_id = " . (int)$customers_id);
tep_db_query("DELETE FROM customers_basket WHERE customers_id = " . (int)$customers_id);
tep_db_query("DELETE FROM customers_basket_attributes WHERE customers_id = " . (int)$customers_id);
tep_db_query("DELETE FROM customers_info WHERE customers_info_id = " . (int)$customers_id);
tep_db_query("DELETE FROM address_book WHERE customers_id = " . (int)$customers_id);
tep_db_query("DELETE FROM products_notifications WHERE customers_id = " . (int)$customers_id);
echo '<br />' . sprintf(SIU_CUSTOMER_DELETED, $cust['customers_firstname'] . ' ' . $cust['customers_lastname']) . '<br /><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('stats_inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>';
}
?>
<?php