Thread: [Openfirst-cvscommit] awards/admin index.php,1.20,1.21
Brought to you by:
xtimg
From: Astronouth7303 <ast...@us...> - 2005-03-14 04:14:06
|
Update of /cvsroot/openfirst/awards/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7567/awards/admin Modified Files: index.php Log Message: Fixed bugs with queries Index: index.php =================================================================== RCS file: /cvsroot/openfirst/awards/admin/index.php,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** index.php 14 Mar 2005 02:41:13 -0000 1.20 --- index.php 14 Mar 2005 04:13:41 -0000 1.21 *************** *** 36,42 **** die(include_once($footer)); } ! // If user has posted create then insert new award record ! if (isset($_POST['create'])){ if($_POST['award']!="" || (isset($_POST['firstaward']) && $_POST['firstaward'] == '1')){ if($_POST['firstaward'] == "1") { --- 36,56 ---- die(include_once($footer)); } ! $DisplayForm = true; ! $CreateNew = true; ! if (array_key_exists('AwardID', $_POST)) { ! $CreateNew = false; ! $DisplayForm = false; ! } ! if (array_key_exists('create', $_POST)) { ! $CreateNew = true; ! $DisplayForm = false; ! } ! if (array_key_exists('modify', $_POST)) { ! $CreateNew = false; ! $DisplayForm = false; ! } ! # print_r($_POST); // If user has posted create then insert new award record ! if ($CreateNew && !$DisplayForm){ if($_POST['award']!="" || (isset($_POST['firstaward']) && $_POST['firstaward'] == '1')){ if($_POST['firstaward'] == "1") { *************** *** 48,59 **** ofirst_dbquery("INSERT INTO ofirst_awards (AwardName,FIRSTAward, Event,Date,Image,Description,Recipient) values( ! '".$_POST['award']."', ! '".$_POST['firstaward']."', ! '".$_POST['event']."', ! '".$_POST['date']."', ! '".$_POST['type']."', ! '".$_POST['description']."', ! '".$_POST['recipient']."')") ! or die("INSERT: ". ofirst_dberror()); echo("<p>Congratulations on your new award. Award submitted!</p><p>[ <a href='./'>Manage Awards</a> ]</p>"); --- 62,75 ---- ofirst_dbquery("INSERT INTO ofirst_awards (AwardName,FIRSTAward, Event,Date,Image,Description,Recipient) values( ! '".addslashes($_POST['award'])."', ! '".addslashes($_POST['firstaward'])."', ! '".addslashes($_POST['event'])."', ! '".addslashes($_POST['date'])."', ! '".addslashes($_POST['type'])."', ! '".addslashes($_POST['description'])."', ! '".addslashes($_POST['recipient'])."')") ! /*or die("INSERT: ".ofirst_dberror())*/ ! or die(trigger_error('an openFIRST DB error')) ! ; echo("<p>Congratulations on your new award. Award submitted!</p><p>[ <a href='./'>Manage Awards</a> ]</p>"); *************** *** 66,70 **** // If the user has submitted modifications to an award, then make them. ! if (isset($_POST['modify'])){ if($_POST['award']!="" || (isset($_POST['firstaward']) && $_POST['firstaward'] == '1')){ if($_POST['firstaward'] == "1") { --- 82,86 ---- // If the user has submitted modifications to an award, then make them. ! if (!$CreateNew && !$DisplayForm){ if($_POST['award']!="" || (isset($_POST['firstaward']) && $_POST['firstaward'] == '1')){ if($_POST['firstaward'] == "1") { *************** *** 74,87 **** $_POST['description'] = $fa->Description; } ! ofirst_dbquery("UPDATE ofirst_awards SET AwardName='".$_POST['award']."', ! FIRSTAward = '".$_POST['firstaward']."', ! Event = '".$_POST['event']."', ! Date = '".$_POST['date'] . "', ! Image = '".$_POST['type']."', ! Description = '".$_POST['description']."', ! Recipient = '".$_POST['recipient']."' WHERE ID='" . $_POST["AwardID"] . "';") or die("UPDATE: ".ofirst_dberror()); ! echo("<p>Award modifications submitted!</p><p>[ <a href='./'>Manage Awards</a> ]</p>"); } else { --- 90,103 ---- $_POST['description'] = $fa->Description; } ! ofirst_dbquery("UPDATE ofirst_awards SET AwardName='".$_POST['award']."', ! FIRSTAward = '".addslashes($_POST['firstaward'])."', ! Event = '".addslashes($_POST['event'])."', ! Date = '".addslashes($_POST['date']). "', ! Image = '".addslashes($_POST['type'])."', ! Description = '".addslashes($_POST['description'])."', ! Recipient = '".addslashes($_POST['recipient'])."' WHERE ID='" . $_POST["AwardID"] . "';") or die("UPDATE: ".ofirst_dberror()); ! echo("<p>Award modifications submitted!</p><p>[ <a href='./'>Manage Awards</a> ]</p>"); } else { *************** *** 93,99 **** // If the user has elected to modify an award, fill the form with those details. ! if(isset($_GET["MODIFY"])) { $award = ofirst_dbfetch_object(ofirst_dbquery("SELECT * FROM ofirst_awards WHERE ID='" . $_GET["MODIFY"] . "';")); $award->template = false; } else { $award = (object)''; --- 109,116 ---- // If the user has elected to modify an award, fill the form with those details. ! if(!$CreateNew) { $award = ofirst_dbfetch_object(ofirst_dbquery("SELECT * FROM ofirst_awards WHERE ID='" . $_GET["MODIFY"] . "';")); $award->template = false; + } else { $award = (object)''; *************** *** 191,195 **** <tr> <th> </th> ! <?php if(!is_object($award)) { ?> <td><input name="create" type="submit" id="create" value="Create Award"></td> <?php } else { ?> --- 208,212 ---- <tr> <th> </th> ! <?php if($award->template) { ?> <td><input name="create" type="submit" id="create" value="Create Award"></td> <?php } else { ?> *************** *** 228,232 **** ?> </table> ! <br> <?php } else { --- 245,249 ---- ?> </table> ! <br /> <?php } else { |