daily pastebin goal
18%
SHARE
TWEET

Untitled

a guest May 16th, 2018 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <? ob_start();
  2. session_start();
  3. error_reporting(0);
  4. if($_SESSION['professor'] == "professor"){
  5.  
  6. $socket = mysql_connect($host,$user,$pass) or die(mysql_error());
  7. $res = mysql_db_query($db,"SELECT * FROM turma order by nome asc", $socket);
  8. $numero = mysql_num_rows($res); ?>
  9. <h2 style="font-family: arial;">Sistema de chamada online</h2>
  10. <hr width="100%"></hr>
  11. <table><tr><td>
  12. <form  name="turma" method="post" action="" style="border: 0px; padding: 0px; margin: 0px;">
  13. <?if($_POST[turma]==""){echo "Selecione a turma: ";}else{ echo "Turma selecionada: ";}?>
  14. <select name="turma" id="turma" value="turma" style="width: 200px; background: #FFFF00; border: 1px solid #CC0000;" onChange="document.turma.submit()"/>
  15. <option value="">Selecione</option>
  16. <?
  17. while ($valor=mysql_fetch_array($res)){
  18. ?>
  19. <option value="<?=$valor[id];?>" <?if($valor[id] == $_POST[turma]){echo "selected"; }?>><?=$valor[nome];?></option>
  20. <input type="hidden" name="bimestre" value="<?=$_POST[bimestre];?>" >
  21. <input type="hidden" name="nometurma" value="<?=$valor[nome];?>" >
  22. <?}?>
  23. </select>
  24. </form>
  25. </td>
  26.  
  27. <?if($_POST[turma]==""){break;}
  28. else{?>
  29.  
  30. <td>
  31. <form  name="bimestre" method="post" action="" style="border: 0px; padding: 0px; margin: 0px;">
  32. <?if($_POST[bimestre]==""){echo "Selecione o bimestre: ";}else{ echo "Bimestre selecionado: ";}?>
  33. <select name="bimestre" id="bimestre" value="bimestre" style="width: 200px; background: #FFFF00; border: 1px solid #CC0000;" onChange="document.bimestre.submit()"/>
  34. <option value="">Selecione</option>
  35. <option value="1" <?if($_POST[bimestre] == "1"){echo "selected"; }?> >1° Bimestre</option>
  36. <option value="2" <?if($_POST[bimestre] == "2"){echo "selected"; }?> >2° Bimestre</option>
  37. <option value="3" <?if($_POST[bimestre] == "3"){echo "selected"; }?> >3° Bimestre</option>
  38. <option value="4" <?if($_POST[bimestre] == "4"){echo "selected"; }?> >4° Bimestre</option>
  39. <input type="hidden" name="turma" value="<?=$_POST[turma];?>" >
  40. <input type="hidden" name="nometurma" value="<?=$_POST[nometurma];?>" >
  41. </select>
  42. </form>
  43. </td></tr></table><?}
  44. if($_POST[bimestre]==""){break;}else{
  45.  
  46.  
  47.  
  48.  
  49. // Começa mostrar resultador
  50. $socket = mysql_connect($host,$user,$pass) or die(mysql_error());
  51. $res = mysql_db_query($db,"SELECT * FROM professor where id='$identificacao'", $socket);
  52. $valor=mysql_fetch_array($res);
  53. $res2 = mysql_db_query($db,"SELECT * FROM disciplina where id='$valor[disciplina]'", $socket);
  54.  
  55. //variaveis
  56. $bimestre=$_POST[bimestre];
  57. $id_turma=$_POST[turma];
  58. $nome_turma=$_POST[nometurma];
  59. $id_disciplina=$valor[disciplina];
  60.  
  61. # Agora vou inserir os dados das faltas dos alunos no banco de dados #
  62.  
  63. for($a=1; $a <27; $a++){
  64. for($i=1; $i <23; $i++){
  65. $aluno=$_POST['aluno'.$a];
  66. $data_encontro=$_POST['dataencontro'.$i];
  67.  
  68. $falta=$_POST['falta'.$i.$a];
  69. $var_a=$_POST[$a];
  70. $var_i=$_POST[$i];
  71.  
  72. if($aluno!=""){
  73. if($data_encontro!=""){
  74. if($falta!=""){
  75. mysql_db_query($db,"insert into falta values('', '$aluno' , '$id_disciplina' , '$data_encontro' , '$falta' , '$bimestre','$id_turma', '$a','$i' )",$socket);
  76.  
  77. } } }else{
  78. }
  79.  
  80.    
  81. } }
  82.  
  83.  
  84.  
  85.  
  86.  
  87. #Pronto, está salvo no banco de dados vamos mostrar os resultados...#
  88.  
  89.  
  90. $valor2=mysql_fetch_array($res2);
  91.  
  92. ?>
  93. <hr width="100%"></hr>
  94. <table align="left">
  95. <tr><td>Nome do professor: </td><td><?=$valor[nome_professor];?></td></tr>
  96. <tr><td>Disciplina: </td><td><?=$valor2[nome];?></td></tr>
  97. <tr><td>Turma: </td><td><?=$nome_turma;?></td></tr>
  98. <tr><td>Bimestre: </td><td><?=$bimestre;?></td></tr>
  99. </table>
  100. <br clear="all">
  101.  
  102. <hr width="100%"></hr>
  103. <?
  104. $alunoc = mysql_db_query($db,"SELECT * FROM aluno where turma='$_POST[turma]' order by nome_aluno asc", $socket);
  105. ?>
  106. <table width="100%">
  107. <form method="post" action="">
  108. <?for($a=1; $a <27; $a++){
  109.  
  110.  
  111. if($a==1){
  112. ?>
  113. <tr>
  114. <td style="border: 1px solid black; width: 130px; font-family: arial; font-size: 10px;">
  115. <div style="width: 100%; border-bottom:1px solid black;background: url(direita.gif) no-repeat 98% 0; ">Data encontro</div>
  116. <div style="width: 100%;background: url(baixo.gif) no-repeat 98% 50%; ">Nome do aluno </div></td>
  117. <?}else{?>
  118. <tr>
  119. <td style="border: 1px solid black; width: 130px; font-family: arial; font-size: 10px;">
  120.  
  121. <?
  122.  
  123. $pega_aluno=mysql_fetch_array($alunoc);
  124.  
  125.  
  126. $aluno=$pega_aluno[nome_aluno];
  127. $alunoid=$pega_aluno[id];
  128.  
  129. ?>
  130. <input type="text" value="<?=$aluno;?>" style="width: 129px; font-family: arial; font-size:10px; border: 0px;">
  131.  
  132. <INPUT TYPE="hidden" NAME="aluno<?=$a;?>" value="<?=$alunoid;?>">
  133.  
  134. </td>
  135.  
  136. <?}for($i=1; $i <23; $i++){
  137.  
  138.     if($a==1){
  139.  
  140. //Escolhe a data
  141. ?>
  142.    
  143. <td style="border: 1px solid black; width: 20px; font-family: arial; font-size: 9px;" valign="top" align="center">
  144. <script type="text/javascript" src="dhtmlgoodies_calendar/dhtmlgoodies_calendar.js?random=20060118"></script>
  145. <link type="text/css" rel="stylesheet" href="dhtmlgoodies_calendar/dhtmlgoodies_calendar.css?random=20051112" media="screen"></LINK>
  146.  
  147. <div style="width: 100%;">
  148. <input type="button" value="<?=$i;?>" style="font-family: arial; font-size:9px; width: 30px; height: 15px; background:#FF0000; border:0px; color: #fff;" onclick="displayCalendar(document.getElementById('dataencontro<?=$i;?>'),'dd/mm',this)" onkeyup/>
  149. </div>
  150. <?$conta=mysql_num_rows($alunoc);
  151. ?>
  152.  
  153.  
  154. <div style="width: 100%;">
  155. <input type="text" id="dataencontro<?=$i;?>" name="dataencontro<?=$i;?>" style="width: 30px; font-family: arial; font-size:10px; border: 0px;">
  156. </div>
  157.  
  158. </td>
  159.     <?
  160. }else{?>
  161.  
  162. <td style="border: 1px solid black; width: 20px;">
  163. <input type="hidden" name="<?=$i;?>" value="<?=$i;?>">
  164. <input type="hidden" name="<?=$a;?>" value="<?=$a;?>">
  165. <input type="text" name="falta<?=$i.$a;?>" onchange="if(document.getElementById('dataencontro<?=$i;?>').value != '' ) document.getElementById('falta<?=$i.$a;?>').value = 0; value="<?
  166. #Consulta as faltas e mostra#################################################################################
  167. $consulta_faltas = mysql_db_query($db,"select * from falta where a='$a' and i='$i' and bimestre='$bimestre' and disciplina='$id_disciplina'and turma='$id_turma'", $socket);
  168. $mostra_faltas=mysql_fetch_array($consulta_faltas);
  169. echo $mostra_faltas[falta];
  170. ###Ok...#####################################################################################################
  171. ?>" style="width: 15px; font-family: arial; font-size:10px; border: 0px;">
  172. </td>
  173. <? } }
  174.     if($a==1){
  175. ?>
  176. <td style="border: 1px solid black; width: 20px; font-family: arial; font-size: 10px;">
  177. Total
  178. </td>
  179. <?}else{?>
  180. <td style="border: 1px solid black; width: 20px; font-family: arial; font-size: 10px;">
  181. &nbsp;
  182. </td>
  183. <? }?>
  184.  
  185. </tr><? } ?>
  186. </table>
  187. <input type="hidden" name="turma" value="<?=$_POST[turma];?>" >
  188. <input type="hidden" name="nometurma" value="<?=$_POST[nometurma];?>" >
  189. <input type="hidden" name="bimestre" value="<?=$_POST[bimestre];?>" >
  190.  
  191.  
  192. <p align="center"><input type="submit" value="Salvar dados"> <input type="submit" value="Gerar PDF e imprimir"></p>
  193. </form>
  194.  
  195.  
  196. <? }
  197. //fim
  198. }else{
  199. $mensagem_erro= "Caro, para acessar este arquivo, você precisa estar logado em nosso sistema.";
  200.             header("Location: ../index.php?mensagem_erro=$mensagem_erro");   }
  201. ?>
RAW Paste Data
Top