Разработка информационной системы заочного обучения, страница 28

if (@$HTTP_SESSION_VARS['user']=="admin"){

@$db = mysql_pconnect('localhost','root','');

include "../header.php";

include "menu_stud.php";

include "add_stud_plan_menu2.php";

echo'<HR>';

if(@ $write=="OK"){

$result = mysql_query("SELECT * FROM `allgroup`.`kurs$kurs$spec`");

$num = mysql_num_rows($result);

if (@!$num) $num=1;

for ($i=1;$i<=$num;$i++)

{

@$myArray = mysql_fetch_array($result);

if (@!$myArray) $num=0;

$temp=htmlspecialchars(stripslashes($myArray['p1']));

$temp2=htmlspecialchars(stripslashes($myArray['p2']));

mysql_query("UPDATE `allgroup`.`$spec` SET `p".$kurs."` = '".$num."', `p15_".$kurs."_".$i."_1` = '".$temp."', `p15_".$kurs."_".$i."_2` = '".$temp2."' WHERE CONVERT( `nomer` USING utf8 ) ='$nomer' LIMIT 1");

}

}

$write="NO";

$result = mysql_query("SELECT * FROM `allgroup`.`".$spec."`");

$num = mysql_num_rows($result);

echo '<table ALIGN="left" border=1><tr><td>1к</td><td>2к</td><td>3к</td><td>4к</td><td>5к</td><td>6к</td><td>№зач.</td><td>Фамилия</td><td>Имя</td><td>Отчество</td><td>&nbsp;</td></tr>';

for ($i=0; $i<$num; $i++){

$myArray = mysql_fetch_array($result);

echo '<tr><form  action="insert_plan.php" method=post>';

for ($j=1;$j<=6;$j++)

if (htmlspecialchars(stripslashes($myArray['p'.$j]))) {echo '<td><a href="show_insert_plan.php?spec='.$spec.'&nomer='.htmlspecialchars(stripslashes($myArray['nomer'])).'&kurs='.$j.'"><IMG SRC="/images/imYES.gif" ></a></td>';}

else echo '<td><IMG SRC="/images/imNO.gif"></td>';

echo'<td>';

echo htmlspecialchars(stripslashes($myArray['nomer']));

echo '<input type="hidden" NAME="nomer" VALUE="'.htmlspecialchars(stripslashes($myArray['nomer'])).'">

<input type="hidden" NAME="spec" VALUE="'.$spec.'">

</td><td>';

echo htmlspecialchars(stripslashes($myArray['p1_1']));

echo '</td>

<td>';

echo htmlspecialchars(stripslashes($myArray['p1_2']));

echo '</td>

<td>';

echo htmlspecialchars(stripslashes($myArray['p1_3']));

echo '</td>

<td><input type="submit" VALUE="добавить"></td>

</tr>';

echo'</form>';};

echo '</table>';

include "../footer.php";}

else include "reg_error.php";?>

add_stud_plan_menu2.php:

<?php

echo'<form name="form1" action="add_stud_plan.php" method="post">

<center>  Выберете cпециальность:';

$result = mysql_query("SELECT * FROM `allgroup`.vsespec");

$num = mysql_num_rows($result);

echo '<select name="spec">';

if (@ $spec) echo '<option>'.$spec;

for ($i=0; $i<$num; $i++){

$myArray = mysql_fetch_array($result);

echo "<option>";

echo htmlspecialchars(stripslashes($myArray['spec']));

echo '';};

echo '</select><br>

<input type="submit" value="Добавить план студентам выбраной специальности">

</form>';

?>

add_stud_plan_menu.php:

<?php

@ session_start();

if (@$HTTP_SESSION_VARS['user']=="admin"){

@$db = mysql_pconnect('localhost','root','');

include "../header.php";

include "menu_stud.php";

include "add_stud_plan_menu2.php";

include "../footer.php";}else include "reg_error.php";

?>

doska_admin.php:

<?php

if (@$HTTP_SESSION_VARS['user']=="admin"){

@$db = mysql_pconnect('localhost','root','');

$result = mysql_query("SELECT * FROM `allgroup`.`stol_all`");

@$num = mysql_num_rows($result);

echo '<table border=0>';

for ($i=0; $i<$num; $i++){