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

title

Body

[close]

/includes/ -> camping_log.php (source)

   1  <?php
   2  if ($script_name = basename($HTTP_SERVER_VARS["SCRIPT_NAME"]) == "camping_log.php" ) {
   3   print "<meta http-equiv=\"refresh\" content=\"0; URL=../index.php\">";
   4   exit;
   5  }
   6  print "</center>";
   7  
   8  
   9  if ($camping_update == 'Y' && $user_group <= 2) {
  10   foreach ($location_title as $location_title_key => $location_title_data) {
  11    $check_date = verifydate($location_date[$location_title_key]);
  12    $days = $location_days[$location_title_key];
  13    if ($location_title_key == '000' && $location_title_data != '') {
  14     mysql_query("insert into tbl_scout_camping
  15                   (scout_key
  16                   ,location
  17                   ,date
  18           ,days
  19                   ) values
  20                   (\"$rowid\"
  21                   ,\"$location_title_data\"
  22                   ,\"$check_date\"
  23           ,\"$days\"
  24                   )
  25                 ");
  26    }
  27    if ($location_title_key != '000') {
  28     if ($delete[$location_title_key] == 'Y') {
  29      mysql_query("delete from tbl_scout_camping
  30                    where record_key = \"$location_title_key\"
  31                  ");
  32     } else {
  33      mysql_query("update tbl_scout_camping
  34                    set
  35                    location = \"" . $location_title_data . "\"
  36                    ,date = \"" . $check_date . "\"
  37            ,days = \"" . $days . "\"
  38                    where record_key = \"$location_title_key\"
  39                  ");  
  40     }
  41    } 
  42   }
  43  }
  44  
  45  $sql = mysql_query("select first_name, last_name from tbl_scout where record_key=$rowid");
  46  extract(mysql_fetch_assoc($sql));
  47  mysql_free_result($sql);
  48  
  49  $sql = mysql_query("select position from tbl_scout_leadership where scout_key=$rowid and enddate='0000-00-00'");
  50  extract(mysql_fetch_assoc($sql));
  51  mysql_free_result($sql);
  52  
  53  print "<center><h2>$position $first_name $last_name</h2></center>";
  54  print "<center><h3>Camping Log</h3></center>";
  55  
  56  if ($user_group < 2 && $print != 'Y') {
  57   print "\n<center><form method=POST action=./index.php>
  58   <input type=hidden name=rowid value=$rowid>
  59   <input type=hidden name=camping_log value=Y>
  60   <input type=hidden name=camping_update value=Y>
  61   <input type=submit value=Submit></center><p>";
  62  }
  63  
  64  print "<center><table class=white border=1><tr align=center><td><h3>Date</td><td><h3>Nights</td><td><h3>Location</td>";
  65  if ($user_group < 2 && $print != 'Y') {
  66   print "<td>Delete?</td>";
  67  }
  68  print "</tr>";
  69  
  70  $i = 3;
  71  
  72  $sql = mysql_query("select record_key as location_key,location as location_title,date as location_date,days from tbl_scout_camping where scout_key = $rowid order by date");
  73  
  74  
  75  while ($row = mysql_fetch_assoc($sql)) {
  76   extract($row);
  77   if ($user_group >= 2 or $print == 'Y') {
  78    print "\n<tr><td>$location_date</td><td>$days</td><td>$location_title</td></tr>";
  79   }
  80   if ($user_group < 2 && $print != 'Y') {
  81    $i = $i + 1;
  82    print "\n<tr><td><input type=text size=10 maxlength=10 name=location_date[$location_key] value=\"$location_date\"
  83           onChange=\"var box=document.forms[0].elements[$i];var d=parseDate(box.value);
  84                           if(d==null){
  85                            alert('Date string not recognizable!');
  86                            box.value='';
  87                            box.focus();
  88                           } else {
  89                            box.value=formatDate(d,'yyyy-MM-dd');
  90                           }\"></td>
  91    <td><input type=text size=2 name=location_days[$location_key] maxlength=2 value=\"$days\"></td>
  92    <td><input type=text size=25 name=location_title[$location_key] value=\"$location_title\"></td>
  93    <td><input type=checkbox name=delete[$location_key] value=Y></td></tr>";
  94   }
  95   $i = $i + 3;
  96  }
  97  mysql_free_result($sql);
  98  
  99  
 100  if ($user_group < 2 && $print != 'Y') {
 101   $i = $i + 1;
 102   print "\n<tr><td><input type=text size=10 maxlength=10 name=location_date[000]
 103            onChange=\"var box=document.forms[0].elements[$i];var d=parseDate(box.value);
 104                           if(d==null){
 105                            alert('Date string not recognizable!');
 106                            box.value='';
 107                            box.focus();
 108                           } else {
 109                            box.value=formatDate(d,'yyyy-MM-dd');
 110                           }\"></td>
 111   <td><input type=text size=2 name=location_days[000] maxlength=2</td>
 112   <td><input type=text size=25 name=location_title[000]</td></tr>";
 113  }
 114  print "</table>";
 115  
 116  if ($user_group < 2 && $print != 'Y') {
 117   print "\n<input type=submit value=Submit></form></center>";
 118  }
 119  ?>


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