View Single Post
  #10  
Old 05-26-2004, 01:46 PM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

Ok, I made a few small changes that allow you to call this from the Admin area and cleaned up the GUI a little (room for improvement)

First of all stats_keywords.php goes in XCART/admin not XCART/customer, here it is with the changes:

UPDATED 05/27/04 TO FUNKY PURPLE (you get the idea)
Code:
<?php require "./auth.php"; require $xcart_dir."/include/categories.php"; require $xcart_dir."/include/security.php"; ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> </head> <body marginwidth="0" marginheight="0" topmargin="50" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#73004E"> <table width="435" border="2" cellspacing="0" cellpadding="4" align="center" bgcolor="#73004E"> <tr> <td width="104" valign="middle" bgcolor="#73004E"> <form method="post" action="stats_keywords.php"> <input type="hidden" name="action" value="deletedb"> <input type="submit" value="deleteDB"> </form> <form method="post" action="stats_keywords.php"> <input type="hidden" name="action" value="updatedb"> <input type="submit" value="UpdateDB"> </form> <form method="post" action="stats_keywords.php"> <input type="hidden" name="action" value="show_searches"> <input type="hidden" name="sortorder" value="search_text"> <input type="hidden" name="ascdsc" value="ASC"> <input type="submit" value="Sort By Name"> </form> <form method="post" action="stats_keywords.php"> <input type="hidden" name="action" value="show_searches"> <input type="hidden" name="sortorder" value="search_count"> <input type="hidden" name="ascdsc" value="DESC"> <input type="submit" value="Sort By Count"> </form> <form method="post" action="home.php"> <input type="submit" value="Back To Admin"></form></td> <td width="200" valign="top"> <?php if ($HTTP_POST_VARS['action'] == 'deletedb') { mysql_query("delete from search_queries_sorted"); } // delete db if ($HTTP_POST_VARS['action'] == 'updatedb') { $sql_q = mysql_query("select search_id, search_text from search_queries order by search_text"); while ($sql_q_result = mysql_fetch_array($sql_q)) { /* $sql_count = mysql_query("select count(*) as total from search_queries where search_text = '" . $sql_q_result['search_text'] . "'"); $sql_count_result = mysql_fetch_array($sql_count); */ $update_q = mysql_query("select search_text, search_count from search_queries_sorted where search_text = '" . $sql_q_result['search_text'] . "'"); $update_q_result = mysql_fetch_array($update_q); $count = 1 + $update_q_result['search_count']; if ($update_q_result['search_count'] != '') { mysql_query("update ignore search_queries_sorted set search_count = '" . $count . "' where search_text = '" . $sql_q_result['search_text'] . "'"); } else { mysql_query("insert ignore into search_queries_sorted (search_text, search_count) values ('" . $sql_q_result['search_text'] . "','" . $sql_count_result['total'] . "')"); } // search_count mysql_query("delete from search_queries where search_id = '" . $sql_q_result['search_id'] . "'"); } // while } // updatedb if ($HTTP_POST_VARS['action'] == 'show_searches') { ?> <table cellpadding=2 cellspacing=2 border="1" bgcolor="#FFFFFF"><tr><td class="main" align="left"> [b]<u>Keyword </td><td class="main" align="center"> [b]<u>Searches </td></tr> <?php $sql_q = mysql_query("select search_text, search_count from search_queries_sorted order by search_count DESC"); while ($sql_q_result = mysql_fetch_array($sql_q)) { $searchcount = ($sql_q_result['search_count'] + 1); echo '<tr><td class="main" nowrap> ' . $sql_q_result['search_text'] . '</td><td> ' . $searchcount . '</td></tr>'; } // while ?> </table> <?php } // if show_searches ?> </td> </tr> </table> </p> </body> </html>

OOoops! I forgot this... Add this line to skin1/admin/menu_admin.tpl
Code:


Done!
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote