Advertisement
Guest User

reformated crap

a guest
May 3rd, 2011
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.74 KB | None | 0 0
  1. <FORM NAME ="ATT_REG" METHOD ="Get" ACTION = "book_student">
  2.     <tr>
  3.         <td>
  4.             <?php
  5.             $array_holder = 0;
  6.             ?>
  7.             <tr>
  8.                 <td>
  9.                     <?php
  10.                     while($nt=mysql_fetch_array($result4)){
  11.                         $INPUTID[$array_holder] = $nt['ID'];
  12.                         ?>
  13.  
  14.                         <tr>
  15.                             <td align="right"><input type="checkbox" name="<?php echo $array_holder ?>" value="<?php echo $nt['ID']; ?>"  checked="checked"></td>
  16.                             <td width="150"> <font size="2" face="bmwtyperegular"><?php echo $nt['ID']; ?></font></td>
  17.                             <td width="150">   <font size="2" face="bmwtyperegular"><?php echo $nt[Surname]; ?></font></td>
  18.                             <td width="150"> <font size="2" face="bmwtyperegular"><?php echo $nt['Name']; ?></font></td>
  19.                         </tr>
  20.                         <?php
  21.                         $array_holder++;
  22.                     }
  23.                     ?>
  24.                 </td>
  25.             </tr>
  26.             <tr>
  27.                 <td> <font size="2" face="bmwtyperegular">Leave Type:</font></td>
  28.                 <td>
  29.                     <select name="Booking">
  30.                         <option value="Offsite">Offsite Work</option>
  31.                         <option value="Leave">Leave</option>
  32.                         <option value="Sick">Sick Leave</option>
  33.                         <option value="NO_SPEC">Change Time</option>
  34.                     </select>
  35.                 </td>
  36.             </tr>
  37.             <tr>
  38.                 <td> <font size="2" face="bmwtyperegular">Leave Date:</font></td>
  39.                 <td>
  40.                 <?php
  41.                     require_once('classes/tc_calendar.php');
  42.                     //instantiate class and set properties
  43.                     $myDate = date("d/m/Y");
  44.                     $myDateY = date("Y");
  45.                     $myDateM = date("m");
  46.                     $myDateD = date("d");
  47.  
  48.                     $myCalendar = new tc_calendar("date1", true);
  49.                     $myCalendar->setIcon("iconCalendar.gif");
  50.                     $myCalendar->setDate($myDateD, $myDateM, $myDateY);
  51.                     $myCalendar->writeScript();
  52.                     $theDate = isset($_REQUEST['date1']) ? $_REQUEST['date1'] : "";
  53.  
  54.                 ?>
  55.                 </td>
  56.             </tr>
  57.             <tr>
  58.                 <td> <font size="2" face="bmwtyperegular">Assessor ID:</font></td>
  59.                 <td>
  60.                     <select name="AID">
  61.                         <?php
  62.                         while($nt=mysql_fetch_array($result3)){
  63.                             echo '<option value='. $nt['ID'].'">'. $nt['Name'].' '.$nt['Surname'] .'</option>';
  64.                         }
  65.                         ?>
  66.                     </select>
  67.                 </td>
  68.             </tr>
  69.             <tr>
  70.                 <td> <font size="2" face="bmwtyperegular">PIN Code:</font></td>
  71.                 <td><input type="password" name="PIN" value="" size ="4"></td>
  72.             </tr>
  73.         </td>
  74.     </tr>
  75. </table>
  76. <input type="submit" name="SUB1" value="Book Learner">
  77. </form>
  78.  
  79. <?php
  80. $ID = $_GET['ID'];
  81. $Booking = $_GET['Booking'];
  82. $Date = $_GET['Date'];
  83. $Date = $theDate[8].$theDate[9].'/'.$theDate[5].$theDate[6].'/'.$theDate[0].$theDate[1].$theDate[2].$theDate[3];
  84.  
  85. $AID = $_GET['AID'];
  86. $PIN = $_GET['PIN'];
  87. $Time = "06:59:59am";
  88.  
  89. $query1 = "select ID,PIN from assessors where ID='$AID'";
  90. $result1=mysql_query($query1);
  91. $num=mysql_numrows($result1);
  92.  
  93. $PIN_STATUS = "NOT_OK";
  94.  
  95. while($r=mysql_fetch_array($result1)){
  96.     $TAID =$r["ID"];
  97.     $TPIN =$r["PIN"];
  98.     if($TAID == $AID){
  99.         if($TPIN == $PIN){
  100.             $PIN_STATUS = "OK";
  101.         }
  102.     }
  103. }
  104.  
  105. if ($PIN_STATUS == "OK"){
  106.     $true_array++;
  107.     $query1 = "DELETE FROM attendance WHERE ID='$ID' and Date='$Date'";
  108.     $result1=mysql_query($query1);
  109.     $query1 = "Insert  into attendance(ID,UnitStandardID,Date,Time,AssessorID) VALUES ('$ID','$Booking','$Date','$Time','$AID')";
  110.     $result1=mysql_query($query1);
  111.     $s = $ID.' was booked successfully for Leave type '.$Booking.' on the following Date: '.$Date;
  112.     $in = mysql_affected_rows();
  113.     // echo  $s;
  114. ?>
  115.     <table width="1000">
  116.         <tr>
  117.         <?php
  118.         if($in == 1){
  119.         ?>
  120.             <td width="60"><img src="./images/success.jpg"></td>
  121.             <td> <font size="2" face="bmwtyperegular"><?php echo  $s; ?>;</font></td>
  122.         </tr>
  123.         <?php
  124.         }
  125.         if($in <> 1){
  126.         ?>
  127.             <td width="60"><img src="./images/error.jpg"></td>
  128.             <td> <font size="2" face="bmwtyperegular">Register was not Signed!</font></td>
  129.         </tr>
  130.         <?php
  131.         }
  132.         ?>
  133.     </table>
  134. <?php
  135. }
  136. mysql_close();
  137. ?>
  138. </body>
  139. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement