PageRenderTime 63ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 1ms

/admin/state/newreport.php

https://github.com/damanlovett/SEAHO
PHP | 189 lines | 176 code | 12 blank | 1 comment | 14 complexity | 5f77b051d0251fc082c9a9222f49563b MD5 | raw file
  1. <?php require_once('../../Connections/Directory.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  7. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  8. switch ($theType) {
  9. case "text":
  10. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  11. break;
  12. case "long":
  13. case "int":
  14. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  15. break;
  16. case "double":
  17. $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  18. break;
  19. case "date":
  20. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  21. break;
  22. case "defined":
  23. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  24. break;
  25. }
  26. return $theValue;
  27. }
  28. }
  29. ?>
  30. <?php require_once('../../fckeditor/fckeditor.php'); ?>
  31. <?php require_once('../includefiles/init.php'); ?>
  32. <?php require_once('../includefiles/AdminLogin.php'); ?>
  33. <?php
  34. // Post for new report
  35. $_POST['title'] = $_POST['typeof']." ".$_POST['year'];
  36. $editFormAction = $_SERVER['PHP_SELF'];
  37. if (isset($_SERVER['QUERY_STRING'])) {
  38. $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  39. }
  40. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "newreport")) {
  41. $insertSQL = sprintf("INSERT INTO team_pages (page_id, state_id, title, type, content, submitted_by, created_on) VALUES (%s, %s, %s, %s, %s, %s, %s)",
  42. GetSQLValueString($_POST['page_id'], "text"),
  43. GetSQLValueString($_POST['state_id'], "text"),
  44. GetSQLValueString($_POST['title'], "text"),
  45. GetSQLValueString($_POST['type'], "text"),
  46. GetSQLValueString($_POST['content'], "text"),
  47. GetSQLValueString($_POST['submitted_by'], "text"),
  48. GetSQLValueString($_POST['created_on'], "date"));
  49. mysql_select_db($database_Directory, $Directory);
  50. $Result1 = mysql_query($insertSQL, $Directory) or die(mysql_error());
  51. }
  52. mysql_select_db($database_Directory, $Directory);
  53. $query_rsReports = "SELECT * FROM team_reports ORDER BY `description` ASC";
  54. $rsReports = mysql_query($query_rsReports, $Directory) or die(mysql_error());
  55. $row_rsReports = mysql_fetch_assoc($rsReports);
  56. $totalRows_rsReports = mysql_num_rows($rsReports);
  57. ?>
  58. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  59. <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/adminTemplate.dwt.php" codeOutsideHTMLIsLocked="false" -->
  60. <head>
  61. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  62. <!-- InstanceBeginEditable name="doctitle" -->
  63. <title>State Page Manager</title>
  64. <!-- InstanceEndEditable -->
  65. <link href="../styles/mainStyle.css" rel="stylesheet" type="text/css" />
  66. <link href="../styles/table.css" rel="stylesheet" type="text/css" />
  67. <link href="../styles/navLeft.css" rel="stylesheet" type="text/css" />
  68. <!-- InstanceBeginEditable name="head" -->
  69. <style type="text/css">
  70. <!--
  71. .style1 {
  72. font-size: 12px;
  73. font-weight: bold;
  74. color: #000099;
  75. }
  76. -->
  77. </style>
  78. <!-- InstanceEndEditable -->
  79. </head>
  80. <body>
  81. <div id="header"><?php require_once('../includefiles/userInfo.php'); ?></div>
  82. <div id="sidebar"><?php require_once('../includefiles/navPage.php'); ?></div>
  83. <div id="mainContent">
  84. <div id="mainText">
  85. <h2><!-- InstanceBeginEditable name="PageTitle" --><span class="pageHeadstate">State Report Manager</span> <!-- InstanceEndEditable --></h2>
  86. <!-- InstanceBeginEditable name="PageContent" -->
  87. <div id="pageInformation">
  88. <?php if(isset($_POST['Submit'])){echo "<strong>New Report Added</strong> - ( <a href='index.php'>Return to State Menu</a> )";}?>
  89. <form action="<?php echo $editFormAction; ?>" method="POST" name="newreport" id="newreport">
  90. <table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#D6DFF7">
  91. <tr>
  92. <td bgcolor="#FFFFFF">&nbsp;</td>
  93. <td bgcolor="#FFFFFF">&nbsp;</td>
  94. <td bgcolor="#FFFFFF">&nbsp;</td>
  95. </tr>
  96. <tr>
  97. <td bgcolor="#FFFFFF">&nbsp;</td>
  98. <td bgcolor="#FFFFFF"><span class="style1">Title</span>
  99. <label>
  100. <select name="typeof" id="typeof">
  101. <?php
  102. do {
  103. ?>
  104. <option value="<?php echo $row_rsReports['description']?>"><?php echo $row_rsReports['description']?></option>
  105. <?php
  106. } while ($row_rsReports = mysql_fetch_assoc($rsReports));
  107. $rows = mysql_num_rows($rsReports);
  108. if($rows > 0) {
  109. mysql_data_seek($rsReports, 0);
  110. $row_rsReports = mysql_fetch_assoc($rsReports);
  111. }
  112. ?>
  113. </select>
  114. </label>
  115. <label>
  116. <select name="year" id="year">
  117. <option value="2006">2006</option>
  118. <option value="2007">2007</option>
  119. <option value="2008">2008</option>
  120. <option value="2008">2009</option>
  121. <option value="2010">2010</option>
  122. <option value="2011">2011</option>
  123. <option value="2012">2012</option>
  124. <option value="2013">2013</option>
  125. <option value="2014">2014</option>
  126. <option value="---------------" selected="selected">---------------</option>
  127. </select>
  128. </label></td>
  129. <td bgcolor="#FFFFFF">&nbsp;</td>
  130. </tr>
  131. <tr>
  132. <td bgcolor="#FFFFFF">&nbsp;</td>
  133. <td bgcolor="#FFFFFF"><hr /></td>
  134. <td bgcolor="#FFFFFF">&nbsp;</td>
  135. </tr>
  136. <tr>
  137. <td bgcolor="#FFFFFF">&nbsp;</td>
  138. <td bgcolor="#D6DFF7"><div class="style1">Report Information</div>
  139. <br />
  140. <?php
  141. $oFCKeditor = new FCKeditor('content') ;
  142. $oFCKeditor->BasePath = '/FCKeditor/';
  143. $oFCKeditor->Config['CustomConfigurationsPath'] = '/fckeditor/fckconfigState.js' ;
  144. $oFCKeditor->Width = '100%' ;
  145. $oFCKeditor->Height = '500' ;
  146. $oFCKeditor->Value = 'Enter Report Here';
  147. $oFCKeditor->Create() ;
  148. ?></td>
  149. <td bgcolor="#FFFFFF">&nbsp;</td>
  150. </tr>
  151. <tr>
  152. <td bgcolor="#FFFFFF">&nbsp;</td>
  153. <td bgcolor="#FFFFFF"><label>
  154. <input name="Submit" type="submit" class="submitButton" id="Submit" value="Submit Report" />
  155. <input name="page_id" type="hidden" id="page_id" value="<?php echo create_guid();?>" />
  156. <input name="type" type="hidden" id="type" value="State" />
  157. <input name="title" type="hidden" id="title" />
  158. <input name="submitted_by" type="hidden" id="submitted_by" value="<?php echo $_SESSION['first_name']." ".$_SESSION['last_name'];?>" />
  159. <input name="state_id" type="hidden" id="state_id" value="<?php echo $_SESSION['staccess'];?>" />
  160. <input name="created_on" type="hidden" id="created_on" value="<?php echo date("YmdHis");?>" />
  161. </label></td>
  162. <td bgcolor="#FFFFFF">&nbsp;</td>
  163. </tr>
  164. </table>
  165. <input type="hidden" name="MM_insert" value="newreport">
  166. </form>
  167. </div>
  168. <p>&nbsp;</p>
  169. <!-- InstanceEndEditable --></div>
  170. </div>
  171. <div id="footer"><?php require_once('../includefiles/footer.php'); ?>
  172. </div>
  173. </body>
  174. <!-- InstanceEnd --></html>
  175. <?php
  176. mysql_free_result($rsReports);
  177. ?>