[ PHPXref.com ] [ Generated: Sun Jul 20 20:12:55 2008 ] [ Scout Tracker 0.13 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/includes/ -> all_camping_record.php (source)

   1  <?php
   2  if ($script_name = basename($HTTP_SERVER_VARS["SCRIPT_NAME"]) == "all_camping_record.php" ) {
   3   print "<meta http-equiv=\"refresh\" content=\"0; URL=./index.php\">";
   4   exit;
   5  }
   6  
   7  print "<center><h3>All Scouts Camping Record</h3></center></center>";
   8  
   9  
  10  if ($add_date == "Y" && $user_group <=2) {
  11   $check_date = verifydate($camp_date);
  12   if ($check_date == '0000-00-00') {
  13    print "<center><h2>Invalid Date $camp_date</h2></center>\n<br>";
  14   } else {
  15    print "<center><h2>Adding Camp Date $check_date at $location for:</h2></center>";
  16    foreach ($camp_days as $rowid => $days) {
  17     if ($days > 0) {
  18      $sql_insert = mysql_query("insert into tbl_scout_camping
  19                                  (scout_key
  20                         ,location
  21                       ,date
  22                      ,days
  23                      ) values
  24                      (\"$rowid\"
  25                      ,\"$location\"
  26                      ,\"$check_date\"
  27                      ,\"$days\"
  28                      )
  29                     ");
  30      $sql = mysql_query("select last_name, first_name from tbl_scout where record_key=$rowid");
  31      extract(mysql_fetch_assoc($sql));
  32      mysql_free_result($sql);
  33      print "$first_name,$last_name for $days nights<br>\n";
  34     }
  35    }
  36  
  37   }
  38  }
  39  
  40  if ($user_group < "2" ) {
  41      print "<form method=POST action=./index.php>";
  42      print "<input type=hidden name=all_camping_record value=Y>";
  43      print "<input type=hidden name=add_date value=Y>";
  44  }
  45  
  46  print "<table border=1 align=center class=white><tr align=center><td><h3>Scout</td><td><h3>Total Nights</td>";
  47  if ($user_group < "2" ) {
  48   print "<td><h3>Add<br>Nights</td>";
  49  }
  50  print "</tr>";
  51  
  52  $sql = mysql_query("select a.first_name as first_name,
  53                             a.last_name as last_name,
  54                 sum(b.days) as total_days,
  55                 a.record_key as rowid
  56              from tbl_scout as a
  57              left join tbl_scout_camping as b
  58              on a.record_key = b.scout_key
  59              group by a.last_name, a.first_name
  60              order by birthdate");
  61  
  62  
  63  while ($row = mysql_fetch_assoc($sql)) {
  64      extract($row);
  65      print "<tr><td>$first_name $last_name</td><td align=center>$total_days</td>";
  66      if ($user_group < "2" ) {
  67       print "<td align=center><input type=text name=camp_days[$rowid] size=2 maxlength=2></td>";
  68      }
  69      print "</tr>\n";
  70  }
  71  mysql_free_result($sql);
  72  
  73  print "</table>";
  74  if ($user_group < "2" ) {
  75   print "<center><hr width=50%>Add Campout Date: <input type=text name=camp_date size=10
  76         onChange=\"var box=document.forms[0].camp_date;var d=parseDate(box.value);
  77                           if(d==null){
  78                            alert('Date string not recognizable!');
  79                            box.value='';
  80                            box.focus();
  81                           } else {
  82                            box.value=formatDate(d,'yyyy-MM-dd');
  83                           }\"><br>
  84          Location: <input type=text name=location size=25<br>
  85          <input type=submit value=Submit></form>";
  86  }
  87  
  88  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]