<?php

/*

  osCommRes, Services Online
  http://www.oscommres.com

  Copyright (c) 2005 osCommRes

  Released under the GNU General Public License
  
  Freeway eCommerce from ZacWare
http://www.zac-ware.com/freeway

Copyright 2007 ZacWare Pty. Ltd
*/
// Set flag that this is a parent file
	define( '_FEXEC', 1 );
require('includes/application_top.php');


?>
<html>
<head>
<title>Valid Categories/service List</title>
<style type="text/css">
<!--
h4 {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; text-align: center}
p {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small}
th {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small}
td {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small}
-->
</style>
<head>
<body>
<table width="550" border="1" cellspacing="1" bordercolor="gray">
<tr>
<td colspan="4">
<h4>Valid Categories List</h4>
</td>
</tr>
<?
   $coupon_get=tep_db_query("select restrict_to_service_categories from " . TABLE_COUPONS . " where coupon_id='".$HTTP_GET_VARS['cid']."'");
   $get_result=tep_db_fetch_array($coupon_get);
   echo "<tr><th>Service ID</th><th>Service Name</th></tr><tr>";
   $cat_ids = split("[,]", $get_result['restrict_to_service_categories']);
   for ($i = 0; $i < count($cat_ids); $i++) {
    // $result = mysql_query("SELECT * FROM categories, categories_description WHERE categories.categories_id = categories_description.categories_id and categories_description.language_id = '" . $languages_id . "' and categories.categories_id='" . $cat_ids[$i] . "'");
     $result = mysql_query("SELECT * FROM services_categories, services_categories_description WHERE services_categories.services_categories_id = services_categories_description.services_categories_id and services_categories_description.language_id = '" . $languages_id . "' and services_categories.services_categories_id='" . $cat_ids[$i] . "'");
     if ($row = mysql_fetch_array($result)) {
       echo "<td>".$row["services_categories_id"]."</td>\n";
       echo "<td>".$row["services_categories_name"]."</td>\n";
       echo "</tr>\n";
     } 
   }
    echo "</table>\n";
?>
<br>
<table width="550" border="0" cellspacing="1">
<tr>
<td align=middle><input type="button" value="Close Window" onClick="window.close()"></td>
</tr></table>
</body>
</html>
