Code:
<?php
require('includes/application_top.php');
if ($HTTP_GET_VARS['action']) {
switch ($HTTP_GET_VARS['action']) {
case 'deleteconfirm':
$customers_id = tep_db_prepare_input($HTTP_GET_VARS['User_Email']);
if ($HTTP_POST_VARS['delete_reviews'] == 'on') {
$reviews_query = tep_db_query("select reviews_id from " . TABLE_REVIEWS . " where customers_id = '" . tep_db_input($customers_id) . "'");
while ($reviews = tep_db_fetch_array($reviews_query)) {
tep_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . $reviews['reviews_id'] . "'");
}
tep_db_query("delete from " . TABLE_REVIEWS . " where customers_id = '" . tep_db_input($customers_id) . "'");
} else {
tep_db_query("update " . TABLE_REVIEWS . " set customers_id = null where customers_id = '" . tep_db_input($customers_id) . "'");
}
tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . tep_db_input($customers_id) . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . tep_db_input($customers_id) . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . tep_db_input($customers_id) . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . tep_db_input($customers_id) . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . tep_db_input($customers_id) . "'");
tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . tep_db_input($customers_id) . "'");
tep_redirect(tep_href_link(FILENAME_CUSTOM_BUILD, tep_get_all_get_params(array('cID', 'action'))));
break;
}
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php');
define('HEADING_TITLE_SEARCH', 'Search:');
define('TABLE_HEADING_LASTNAME', 'Last Name');
define('TABLE_HEADING_FIRSTNAME', 'First Name');
define('TABLE_HEADING_ACCOUNT_CREATED', 'Account Created');
define('TABLE_HEADING_ACTION', 'Action');
define('TEXT_DATE_ACCOUNT_CREATED', 'Account Created<br>');
define('TEXT_DATE_ACCOUNT_LAST_MODIFIED', 'Last Modified<br>');
define('TEXT_INFO_DATE_LAST_LOGON', 'Last Logon<br>');
define('TEXT_INFO_NUMBER_OF_LOGONS', 'Number Of Logons<br>');
define('TEXT_INFO_COUNTRY', 'Country<br>');
define('TEXT_INFO_NUMBER_OF_REVIEWS', 'Number Of Reviews<br>');
?>
<!-- left_navigation_eof //-->
</tr></table></td>
<!-- body_text //-->
<td valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LASTNAME; ?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FIRSTNAME; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACCOUNT_CREATED; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
</tr>
<?php
$customers_query_raw = "select User_Email, Motherboard, Processor, Memory, HardDrive, VideoCard, ComputerCase, SoundCard, Modem, NetworkCard, OperatingSystem, Cd_Rw, DVD_Rom, Warranty from custom_builds group by User_Email";
$customers_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_query_raw, $customers_query_numrows);
$customers_query = tep_db_query($customers_query_raw);
while ($customers = tep_db_fetch_array($customers_query)) {
$info_query = tep_db_query("select customers_info_date_account_created as date_account_created, customers_info_date_account_last_modified as date_account_last_modified, customers_info_date_of_last_logon as date_last_logon, customers_info_number_of_logons as number_of_logons from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customers['User_Email'] . "'");
$info = tep_db_fetch_array($info_query);
if (((!$HTTP_GET_VARS['User_Email']) || (@$HTTP_GET_VARS['User_Email'] == $customers['User_Email'])) && (!$cInfo)) {
$country_query = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . $customers['entry_country_id'] . "'");
$country = tep_db_fetch_array($country_query);
$reviews_query = tep_db_query("select count(*) as number_of_reviews from " . TABLE_REVIEWS . " where customers_id = '" . $customers['User_Email'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
$customer_info = tep_array_merge($country, $info, $reviews);
$cInfo_array = tep_array_merge($customers, $customer_info);
$cInfo = new objectInfo($cInfo_array);
}
if ( ($customers['User_Email'] == $cInfo->User_Email) ) {
echo ' <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_CUSTOM_BUILD, tep_get_all_get_params(array('cID')) . 'cID=' . $customers['User_Email']) . '\'">' . "\n";
} else {
echo ' <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_CUSTOM_BUILD, tep_get_all_get_params(array('cID')) . 'cID=' . $customers['User_Email']) . '\'">' . "\n";
}
?>
<td class="dataTableContent"><?php echo $customers['User_Email']; ?></td>
<td class="dataTableContent"><?php echo $customers['Motherboard']; ?></td>
<td class="dataTableContent" align="right"><?php echo $customers['Processor']; ?></td>
<td class="dataTableContent" align="right"><?php if ( ($customers['User_Email'] == $cInfo->User_Email) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CUSTOM_BUILD, tep_get_all_get_params(array('cID')) . 'cID=' . $customers['User_Email']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
</tr>
<?php
}
?>
<tr>
<td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="smallText" valign="top"><?php echo $customers_split->display_count($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td>
<td class="smallText" align="right"><?php echo $customers_split->display_links($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?></td>
</tr>
</table></td>
</tr>
</table></td>
<?php
$heading = array();
$contents = array();
switch ($HTTP_GET_VARS['action']) {
case 'confirm':
$heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_CUSTOMER . '</b>');
$contents = array('form' => tep_draw_form('customers', FILENAME_CUSTOM_BUILD, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->User_Email . '&action=deleteconfirm'));
$contents[] = array('text' => TEXT_DELETE_INTRO . '<br><br><b>' . $cInfo->User_Email . '</b>');
if ($cInfo->number_of_reviews > 0) $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('delete_reviews', 'on', true) . ' ' . sprintf(TEXT_DELETE_REVIEWS, $cInfo->number_of_reviews));
$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_CUSTOM_BUILD, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->User_Email) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
break;
default:
if (is_object($cInfo)) {
$heading[] = array('text' => '<b>' . $cInfo->User_Email . '</b>');
$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CUSTOM_BUILD, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->User_Email . '&action=confirm') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_MAIL, 'selected_box=tools&customer=' . $cInfo->User_Email) . '">' . tep_image_button('button_email.gif', IMAGE_EMAIL) . '</a>');
$contents[] = array('text' => '<br>MotherBoard' . $cInfo->Motherboard);
$contents[] = array('text' => '<br>Processor' . $cInfo->Processor);
$contents[] = array('text' => '<br>Video Card' . $cInfo->VideoCard);
$contents[] = array('text' => '<br>Sound Card' . $cInfo->SoundCard);
$contents[] = array('text' => '<br>Network Card' . $cInfo->NetworkCard);
$contents[] = array('text' => '<br>Computer Case' . $cInfo->Tower);
$contents[] = array('text' => '<br>Amount Of Memory' . $cInfo->Memory);
$contents[] = array('text' => '<br>CD-ReWriter' . $cInfo->Cd_Rw);
$contents[] = array('text' => '<br>DVD-Rom' . $cInfo->DVD_Rom);
$contents[] = array('text' => '<br>Modem' . $cInfo->Modem);
$contents[] = array('text' => '<br>Operating System' . $cInfo->OperatingSystem);
$contents[] = array('text' => '<br>Warranty' . $cInfo->Warranty);
}
break;
}
if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
echo ' <td width="25%" valign="top">' . "\n";
$box = new box;
echo $box->infoBox($heading, $contents);
echo ' </td>' . "\n";
}
?>
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Bookmarks