| Server IP : 195.130.67.5 / Your IP : 216.73.216.231 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/icd/labs/ |
Upload File : |
<?php
/*
*************************************************************************************
** insert_choice_final.php
*************************************************************************************
*/
session_start(); // Εκκίνηση session.
header("Cache-control: private"); // Διόρθωση σφάλματος "cache control" για τον IE6.
$labs_number = $_SESSION['labs_number'];
$am = $_SESSION['username'];
$lesson = $_SESSION['lesson'];
$ipox_parak = $_POST['ipox_parak'];
$eksamino = $_POST['eksamino'];
$connection = mysqli_connect("localhost", "icd_labs", "t3!$3r") or die(mysqli_error());
mysqli_select_db($connection,"laboratories") or die(mysqli_error());
mysqli_set_charset($connection,"utf8");
mysqli_query($connection, "SET NAMES 'utf8'");
/*
*************************************************************************************
** Δημιουργία ερωτημάτων σύμφωνα με τον αριθμό των εργαστηριακών μαθημάτων για
** την καταχώρησή τους στον πίνακα με τις επιλογές των σπουδαστών.
*************************************************************************************
*/
$post_error = 1;
if($_POST['choice1'])
{
$post_error = 0;
switch ($labs_number) {
case 1:
$ch[1] = $_POST['choice1'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]')";
break;
case 2:
$ch[1] = $_POST['choice1'];
$ch[2] = $_POST['choice2'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1, ch2) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]', '$ch[2]')";
break;
case 3:
$ch[1] = $_POST['choice1'];
$ch[2] = $_POST['choice2'];
$ch[3] = $_POST['choice3'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1, ch2, ch3) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]', '$ch[2]', '$ch[3]')";
break;
case 4:
$ch[1] = $_POST['choice1'];
$ch[2] = $_POST['choice2'];
$ch[3] = $_POST['choice3'];
$ch[4] = $_POST['choice4'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1, ch2, ch3, ch4) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]', '$ch[2]', '$ch[3]', '$ch[4]')";
break;
case 5:
$ch[1] = $_POST['choice1'];
$ch[2] = $_POST['choice2'];
$ch[3] = $_POST['choice3'];
$ch[4] = $_POST['choice4'];
$ch[5] = $_POST['choice5'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1, ch2, ch3, ch4, ch5) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]', '$ch[2]', '$ch[3]', '$ch[4]', '$ch[5]')";
break;
case 6:
$ch[1] = $_POST['choice1'];
$ch[2] = $_POST['choice2'];
$ch[3] = $_POST['choice3'];
$ch[4] = $_POST['choice4'];
$ch[5] = $_POST['choice5'];
$ch[6] = $_POST['choice6'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1, ch2, ch3, ch4, ch5, ch6) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]', '$ch[2]', '$ch[3]', '$ch[4]', '$ch[5]', '$ch[6]')";
break;
case 7:
$ch[1] = $_POST['choice1'];
$ch[2] = $_POST['choice2'];
$ch[3] = $_POST['choice3'];
$ch[4] = $_POST['choice4'];
$ch[5] = $_POST['choice5'];
$ch[6] = $_POST['choice6'];
$ch[7] = $_POST['choice7'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1, ch2, ch3, ch4, ch5, ch6, ch7) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]', '$ch[2]', '$ch[3]', '$ch[4]', '$ch[5]', '$ch[6]', '$ch[7]')";
break;
case 8:
$ch[1] = $_POST['choice1'];
$ch[2] = $_POST['choice2'];
$ch[3] = $_POST['choice3'];
$ch[4] = $_POST['choice4'];
$ch[5] = $_POST['choice5'];
$ch[6] = $_POST['choice6'];
$ch[7] = $_POST['choice7'];
$ch[8] = $_POST['choice8'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]', '$ch[2]', '$ch[3]', '$ch[4]', '$ch[5]', '$ch[6]', '$ch[7]', '$ch[8]')";
break;
case 9:
$ch[1] = $_POST['choice1'];
$ch[2] = $_POST['choice2'];
$ch[3] = $_POST['choice3'];
$ch[4] = $_POST['choice4'];
$ch[5] = $_POST['choice5'];
$ch[6] = $_POST['choice6'];
$ch[7] = $_POST['choice7'];
$ch[8] = $_POST['choice8'];
$ch[9] = $_POST['choice9'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]', '$ch[2]', '$ch[3]', '$ch[4]', '$ch[5]', '$ch[6]', '$ch[7]', '$ch[8]', '$ch[9]')";
break;
case 10:
$ch[1] = $_POST['choice1'];
$ch[2] = $_POST['choice2'];
$ch[3] = $_POST['choice3'];
$ch[4] = $_POST['choice4'];
$ch[5] = $_POST['choice5'];
$ch[6] = $_POST['choice6'];
$ch[7] = $_POST['choice7'];
$ch[8] = $_POST['choice8'];
$ch[9] = $_POST['choice9'];
$ch[10] = $_POST['choice10'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]', '$ch[2]', '$ch[3]', '$ch[4]', '$ch[5]', '$ch[6]', '$ch[7]', '$ch[8]', '$ch[9]', '$ch[10]')";
break;
case 11:
$ch[1] = $_POST['choice1'];
$ch[2] = $_POST['choice2'];
$ch[3] = $_POST['choice3'];
$ch[4] = $_POST['choice4'];
$ch[5] = $_POST['choice5'];
$ch[6] = $_POST['choice6'];
$ch[7] = $_POST['choice7'];
$ch[8] = $_POST['choice8'];
$ch[9] = $_POST['choice9'];
$ch[10] = $_POST['choice10'];
$ch[11] = $_POST['choice11'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10,ch11) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]', '$ch[2]', '$ch[3]', '$ch[4]', '$ch[5]', '$ch[6]', '$ch[7]', '$ch[8]', '$ch[9]', '$ch[10]', '$ch[11]')";
break;
default:
$ch[1] = $_POST['choice1'];
$ch[2] = $_POST['choice2'];
$ch[3] = $_POST['choice3'];
$ch[4] = $_POST['choice4'];
$ch[5] = $_POST['choice5'];
$ch[6] = $_POST['choice6'];
$ch[7] = $_POST['choice7'];
$ch[8] = $_POST['choice8'];
$ch[9] = $_POST['choice9'];
$ch[10] = $_POST['choice10'];
$ch[11] = $_POST['choice11'];
$ch[12] = $_POST['choice12'];
$sql_insert = "INSERT INTO choices(am, lesson_name, eksamino, ipox_parak, ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10,ch11,ch12) VALUES('$am', '$lesson', '$eksamino', '$ipox_parak', '$ch[1]', '$ch[2]', '$ch[3]', '$ch[4]', '$ch[5]', '$ch[6]', '$ch[7]', '$ch[8]', '$ch[9]', '$ch[10]', '$ch[11]', '$ch[12]')";
break;
}
}
/*
*************************************************************************************
** Έλεγχος για σωστή καταχώρηση όλων των επιλογών.
*************************************************************************************
*/
$error = 0;
for($i=1;$i<=$labs_number;$i++)
{
for($j=$i+1;$j<=$labs_number;$j++)
{
if($ch[$i] == $ch[$j])
{
$error = 1;
}
}
}
/*
*************************************************************************************
** Αν όλα είναι σωστά τότε η καταχώρηση γίνεται επιτυχώς.
*************************************************************************************
*/
if($post_error==0 && $error==0)
{
$result_insert = mysqli_query($connection,$sql_insert) or die(mysqli_error());
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>E-LABS - ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ ΠΛΗΡΟΦΟΡΙΚΗΣ, ΥΠΟΛΟΓΙΣΤΩΝ ΚΑΙ ΤΗΛΕΠΙΚΟΙΝΩΝΙΩΝ - ΔΙΠΑΕ</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7">
<style type="text/css">
<!--
body {
background-image: url(pics/back.gif);
}
.style5 {color: #191919; font-weight: bold; }
.style6 {
font-size: 12px;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
a:link {
color: #0000CC;
text-decoration: underline;
}
a:visited {
color: #0000CC;
text-decoration: underline;
}
a:hover {
color: #FFFFFF;
text-decoration: none;
}
a:active {
text-decoration: underline;
}
.style7 {
color: #003300;
font-weight: bold;
}
.style9 {
font-size: 14px;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #009900;
}
-->
</style></head>
<body>
<div align="left">
<table width="1000" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="150" colspan="4" valign="top"><img src="pics/index_up.jpg" width="1000" height="150"></td>
<td width="8"> </td>
</tr>
<tr>
<td height="2" colspan="4" valign="top"><img src="pics/horizontal_bar.gif" width="1000" height="2"></td>
<td></td>
</tr>
<tr>
<td width="16" height="19"> </td>
<td width="590" valign="top"><div align="left" class="style7">Συνδεδεμένος Χρήστης: <?php echo $_SESSION['epitheto']; echo " "; echo $_SESSION['onoma']; ?> </div></td>
<td width="327"> </td>
<td width="67"> </td>
<td></td>
</tr>
<tr>
<td height="2" colspan="4" valign="top"><img src="pics/horizontal_bar.gif" width="1000" height="2"></td>
<td></td>
</tr>
<tr>
<td height="17"></td>
<td colspan="2" valign="top"><span class="style9">ΕΠΙΤΥΧΗΣ ΚΑΤΑΧΩΡΗΣΗ ΝΕΟΥ ΕΡΓΑΣΤΗΡΙΟΥ</span></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="34"></td>
<td colspan="3" valign="top"><div align="left" class="style9">
Η καταχώρηση του εργαστηρίου έγινε επιτυχώς. Παρακαλώ επιστρέψτε στην <a href="student.php">αρχική σελίδα</a> για όποια άλλη καταχώρηση επιθυμείτε.</div></td>
<td></td>
</tr>
<tr>
<td height="701"></td>
<td> </td>
<td> </td>
<td> </td>
<td></td>
</tr>
</table>
</div>
</body>
</html>
<?php
}
/*
*************************************************************************************
** Σε αντίθετη περίπτωση εμφανίζεται μήνυμα σφάλματος.
*************************************************************************************
*/
else
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>E-LABS - ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ ΠΛΗΡΟΦΟΡΙΚΗΣ, ΥΠΟΛΟΓΙΣΤΩΝ ΚΑΙ ΤΗΛΕΠΙΚΟΙΝΩΝΙΩΝ - ΔΙΠΑΕ</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7">
<style type="text/css">
<!--
body {
background-image: url(pics/back.gif);
}
.style5 {color: #191919; font-weight: bold; }
.style6 {
font-size: 12px;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
a:link {
color: #0000CC;
text-decoration: underline;
}
a:visited {
color: #0000CC;
text-decoration: underline;
}
a:hover {
color: #FFFFFF;
text-decoration: none;
}
a:active {
text-decoration: underline;
}
.style7 {
color: #003300;
font-weight: bold;
}
.style9 {
font-size: 14px;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #009900;
}
-->
</style></head>
<body>
<table width="1000" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="150" colspan="3" valign="top"><img src="pics/index_up.jpg" width="1000" height="150"></td>
<td width="4"> </td>
</tr>
<tr>
<td width="55" height="119"> </td>
<td width="826" valign="top"><span class="style5"><?php
echo "Τα δεδομένα που καταχωρήσατε δεν είναι σωστά. Μεταβείτε στην <a href=javascript:history.back()>προηγούμενη</a> σελίδα για να προσπαθήσετε ξανά.";
exit;
?></span></td>
<td width="119"> </td>
<td> </td>
</tr>
<tr>
<td height="496"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
<?php
}
/*
*************************************************************************************
** Developed by Petrellis Manolis.
*************************************************************************************
*/
?>