sma-website /courses/index.php

Language PHP Lines 300
MD5 Hash 7d56f8b3b640e834489f8b508df1f801 Estimated Cost $3,428 (why?)
Repository https://bitbucket.org/molusc/sma-website.git View Raw File
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<?php require_once('../Connections/bryanmadge.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 session_start();  ?>
<?php

if (!isset($_GET["catid"]))
    $_GET["catid"] = 0;
$catid = $_GET["catid"];

if (!isset($_GET["debug"]))
    $_GET["debug"] = 0;
$debug = $_GET["debug"];

mysql_select_db($database_bryanmadge, $bryanmadge);

if(isset($_SESSION['company']))
	$query_categories = "SELECT categoryid, category.coursecategory, Count(catalog_id) AS CountOfCourseCatalogID FROM catalog, category WHERE category.id=categoryid AND category.id <> 7 GROUP BY categoryid ORDER BY category.coursecategory";
else
	$query_categories = "SELECT categoryid, category.coursecategory, Count(catalog_id) AS CountOfCourseCatalogID FROM catalog, category WHERE category.id=categoryid GROUP BY categoryid ORDER BY category.coursecategory";
$categories = mysql_query($query_categories, $bryanmadge) or die(mysql_error());
$row_categories = mysql_fetch_assoc($categories);
$totalRows_categories = mysql_num_rows($categories);

$catid_catalog = "8";
if (isset($catid)) {
  $catid_catalog = $catid;
}
mysql_select_db($database_bryanmadge, $bryanmadge);
$query_catalog = sprintf("SELECT catalog.catalog_id, catalog.title, catalog.categoryid, category.coursecategory, catalog.subcategoryid, subcategory.subcategory FROM (catalog INNER JOIN category ON catalog.categoryid = category.id) LEFT JOIN subcategory ON catalog.SubCategoryid = subcategory.id WHERE (((catalog.categoryid)=%s)) ORDER BY category.coursecategory, subcategory.subcategory, catalog.title", GetSQLValueString($catid_catalog, "int"));
$catalog = mysql_query($query_catalog, $bryanmadge) or die(mysql_error());
$row_catalog = mysql_fetch_assoc($catalog);
$totalRows_catalog = mysql_num_rows($catalog);


$catid_subcategories = "7";
if (isset($catid)) {
  $catid_subcategories = (get_magic_quotes_gpc()) ? $catid : addslashes($catid);
}
mysql_select_db($database_bryanmadge, $bryanmadge);
$query_subcategories = sprintf("SELECT subcategory.id, subcategory.subcategory, subcategory.parentcategoryid FROM subcategory WHERE subcategory.parentcategoryid=%s ORDER BY subcategory.subcategory", $catid_subcategories);
$subcategories = mysql_query($query_subcategories, $bryanmadge) or die(mysql_error());
$row_subcategories = mysql_fetch_assoc($subcategories);
$totalRows_subcategories = mysql_num_rows($subcategories);
?>
<html><!-- InstanceBegin template="/Templates/general.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<LINK REL="SHORTCUT ICON" HREF="../favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Dreamweaver MX">
<meta name="keywords" content="CDM Regulations, CESMM, civil engineering, construction management, contract administration, contract procedures, courses, environmental awareness, geotechnical, Health and safety, ICE Conditions of Contract, ICE Professional Review, JCT Form of Contract, Method of Measurement for Highway Works, MMHW, NEC New Engineering and Construction Contract, Project management, report writing, site supervision, Standard Forms of Contract, training, AMPR, CET, CPD, TMPR, Eurocodes">
<!-- #BeginEditable "doctitle" --> 

<title>Training Courses - Symmons Madge Associates Ltd</title>
<meta name="robots" content="noindex">
<!-- #EndEditable -->
<link rel="stylesheet" href="../bma.css" type="text/css">
<link rel="stylesheet" href="../print.css" type="text/css" media="print" />
<!-- InstanceParam name="OptionalPageTitle" type="boolean" value="true" --><!-- InstanceParam name="OptionalBreadcrumbs" type="boolean" value="true" --><!-- InstanceParam name="Google Analytics Code" type="boolean" value="true" -->
</head>

<body><div class="printhide"><!-- #BeginLibraryItem "/Library/Masthead.lbi" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="150" rowspan="2"><a href="../home.html" target="_top">
      <!--        	<img src="../images/smalogo_sml_party_hat.gif" ALT="Symmons Madge Associates Ltd home" width="124" height="90" border="0">
-->
      <img src="../images/smalogo_sml.gif" ALT="Symmons Madge Associates Ltd home" width="124" height="64" border="0"> </a></td>
    <td><p class="tagline"><font size="4">Training for a Successful Future</font></p></td>
  </tr>
  <tr>
    <td valign="bottom"><table class="masthead" width="100%" height=25 border="0" cellpadding="0" cellspacing="0">
      <tr>
        <!--  	<td width="5%" bgcolor="#FFFFFF">&nbsp;</td>-->
        <td align="left" valign="top"><img src="/images/corner_TL.gif" width="15" height="25"></td>
        <td>&nbsp;&nbsp;<a 		  
						href="index.php" target="_top">Courses</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a 
						href="../diary/diary.php" target="_top">Course&nbsp;Diary</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a 
						href="../training/training-club.php" target="_top">Regional Training</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a 
						href="../consultancy/index.html" target="_top">Consultancy</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a 
						href="../search/index.php" target="_top">Search</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a 
                        href="../links.html" target="_top">Links</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a 
						href="../company/about.html" target="_top">About us</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a 
						href="../contact.html" target="_top">Contact</a>&nbsp;&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
<!-- #EndLibraryItem --></div>
<div class="printonly">
  <div align="right"><img src="../images/smalogo_sml.gif" width="124" height="64" class="floatright"></div>
</div>
<div id="main"> 
  <p class="breadcrumbs printhide"><!-- #BeginEditable "breadcrumbs" --> <a href="../home.html" target="_top">Home</a>&nbsp;&gt;&nbsp;<a href="../training/index.html">Training</a>&nbsp;&gt;&nbsp;Course 
  Portfolio<!-- #EndEditable --></p>
  <h1 class="bmapagetitle"><!-- #BeginEditable "title" --><a name="top"></a>Training 
  Course Portfolio<!-- #EndEditable --></h1>
  <!-- #BeginEditable "body" --> <div class="bmabody">
  <table width="100%"  border="0" cellspacing="0" cellpadding="5">
    <tr>
      <td width="200" align="left" valign="top" class="navleft">
	    <?php do { 
	  echo "<li><a href=\"/courses/index.php?catid=",$row_categories['categoryid'],"\">",$row_categories['coursecategory'],"</a></li>";
		 } while ($row_categories = mysql_fetch_assoc($categories)); ?>
	  
  </ul>
	  </td>
      <td valign="top"><div class="bmabody">
        <p>We offer a wide range of courses both on an open and in-house basis. We can also provide many other training courses to meet your specific needs. Please contact us even if the course you need is not listed or should you require a specific course developed.</p>
        <p>To find out more telephone: 01446 775959 or e-mail: <a href="mailto:admin@symmonsmadge.co.uk">admin@symmonsmadge.co.uk</a></p>
        
    
        <!-- iSearch search form -->
    <FORM METHOD="post" ACTION="/search/index.php">

    <TABLE BORDER="0" CELLPADDING="3" CELLSPACING="1">
      <TR ALIGN="center">
        <TD ALIGN="center"><INPUT MAXLENGTH="255" NAME="s" SIZE="40"></TD>
        <TD ALIGN="center"><INPUT TYPE="submit" VALUE="Search"></TD>
      </TR>
    </TABLE>
    <INPUT TYPE="hidden" NAME="action" VALUE="search">
    </FORM>
        
        
        <?php if (1 == $debug) { // Show if debug on
				 echo "Catid: $catid";
		 	   } // Show if debug on ?>
	     <?php if (0 <> $catid) { // show if a cateogry selected ?>  
		 			<h2><?php echo $row_catalog['coursecategory']; ?></h2>
 		 			<?php 
						if (1 == $debug) { // Show if debug on ?>
 					<p>Subcategories: <?php echo $totalRows_subcategories ?> </p>
		   			<?php } // Show if debug on ?>
            		<?php if ($totalRows_subcategories > 0) { // Show if recordset not empty ?>
            		<?php 
						$i = 1;
						do {
					  		$subcatsarry[$i] =  $row_subcategories['subcategory'];	
							$i++;
				 		} while ($row_subcategories = mysql_fetch_assoc($subcategories));
				//		echo print_r($subcatsarry);
						$numsubcats = count($subcatsarry);
//		echo "<br>$numsubcats";
		$tablerows = ceil($numsubcats/2);
//		echo "<br>$tablerows";		
	?>
            <h4>Subcategories:</h4>
            <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="bmabody">
              <?php
	  	$i = 1;
	  	while ($i <= $tablerows) {
	  		echo "<tr valign=\"top\">\n<td><li><a href=\"#$i\"><strong>$subcatsarry[$i]</strong></a></li></td>\n";
			$j = $i + $tablerows;
			if ($j <= $numsubcats) {
    	  		echo "<td><li><a href=\"#$j\"><strong>$subcatsarry[$j]</strong></a></li></td>\n</tr>\n";
			}
			$i++;
		}
	  ?>
            </table>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p></p>
            <?php } // Show if recordset not empty ?>
                <?php
		$subcategories = mysql_query($query_subcategories, $bryanmadge) or die(mysql_error());

		$t = 0;
		$i = 0;
		for ($k = 0; $k <= $numsubcats; $k++) {
		$i = $i + 1;
		if ($row_catalog['catalog_id'] <> null) {
		
		$n = $row_catalog['subcategoryid'];
		
		if (1 == $debug) { // Show if debug on 
		echo 'k: ',$k,"<br>";
		}

		if (($t <> 1) AND (0 == $k) AND ($row_catalog['subcategoryid'] <> null)) {
			$row_subcategories = mysql_fetch_assoc($subcategories);
//			$k = -1;
			$t = 1;
		}

		if (1 == $debug) { // Show if debug on 		
		echo 'k: ',$k,"<br>";
		}

		if (0 < $k) {
			$row_subcategories = mysql_fetch_assoc($subcategories);
		}
		
		if (1 == $debug) { // Show if debug on 
			echo 'catalog.categoryid: ',$row_catalog['categoryid'],"<br>";
			echo 'catalog.subcategoryid: ',$row_catalog['subcategoryid'],"<br>";
	  		echo 'subcategories.id: ',$row_subcategories['id'],"<br>";
			echo 'k: ',$k,"<br>";
		} ?>
                </p>
              <table width="100%" border="0" class="bmabody">
              <tr>
                <td><h3><a name="<?php echo $i; ?>"></a><?php echo $row_subcategories['subcategory']; ?></h3></td>
              </tr>
              <tr>
                <td><ul>
                    <?php do { ?>
                    <li><a href="course-details.php?id=<?php echo $row_catalog['catalog_id']; ?>"><?php echo $row_catalog['title']; ?></a></li>
                    <?php 
		if (1 == $debug) { // Show if debug on 
			echo 'catalog.subcategoryid: ',$row_catalog['subcategoryid'],"<br>";
	  		echo 'subcategories.id: ',$row_subcategories['id'],"<br>";
			echo 'catalog.subcategoryid: ',$row_catalog['subcategoryid'],"<br>";			
		}
		if ($row_catalog['subcategoryid'] == null) {
			$row_catalog['subcategoryid'] = 0;
		}
		if ($row_subcategories['id'] == null) {
			$row_subcategories['id'] = 0;
		}
		if (1 == $debug) { // Show if debug on 		
			echo 'catalog.subcategoryid after check: ',$row_catalog['subcategoryid'],"<br>";			
		}				
		 ?>
                    <?php // } while (($row_catalog = mysql_fetch_assoc($catalog)) AND ($row_catalog['subcategoryid'] = $row_subcategories['id'])); ?>
                    <?php } while (($row_catalog = mysql_fetch_assoc($catalog)) AND $row_subcategories['id'] == $row_catalog['subcategoryid']); ?>
                </ul></td>
              </tr>
              <tr>
                <td><p align="right"><a href="#top">back to top</a></p></td>
              </tr>
            </table>
            <?php
			}
	  }
  ?>
  		    <?php } // show if a cateogry selected ?>
      </div></td>
    </tr>
  </table>
  </div> 
<!-- #EndEditable --></div>
<div class="printhide"><!-- #BeginLibraryItem "/Library/Full Footer.lbi" --><hr width="65%">
<p align="center"><!-- #BeginLibraryItem "/Library/Footer.lbi" --><!-- #EndLibraryItem --></p>

<!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/Legal footer.lbi" --><div align="center" class="bmabody"><font size="1"><a href="../company/legal.html">Legal
      Notice</a><br>
  Copyright &copy; Symmons Madge Associates Ltd, All Rights Reserved</font></div>
<!-- #EndLibraryItem --><!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=337750; 
var sc_partition=1; 
</script>

<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript>
<a href="http://www.statcounter.com/" target="_blank"><img  src="http://c2.statcounter.com/counter.php?sc_project=337750&amp;java=0" alt="counter stats" border="0"></a>
</noscript>
<!-- End of StatCounter Code -->
<!-- InstanceBeginEditable name="EditRegion1" --><!-- #BeginLibraryItem "/Library/Google Analytics PHP Include.lbi" -->
	<?php include_once($_SERVER['DOCUMENT_ROOT'] . "/analyticstracking.php"); ?><!-- #EndLibraryItem --><!-- InstanceEndEditable --></div>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($categories);

mysql_free_result($catalog);

mysql_free_result($subcategories);
?>
Back to Top