Commit 3b1fd6a5 authored by ibex17's avatar ibex17 🐐
Browse files

creerRepetitoire.html works very well

some changes in the form for the repetitoires
parent 069574b4
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" serverName="raip.site" remoteFilesAllowedToDisappearOnAutoupload="false">
<serverData>
<paths name="raip.site">
<serverdata>
<mappings>
<mapping deploy="/" local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData>
</component>
</project>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PhpUndefinedVariableInspection" enabled="true" level="ERROR" enabled_by_default="true">
<option name="IGNORE_INCLUDE" value="true" />
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WebServers">
<option name="servers">
<webServer id="63d82530-d903-4bbd-96b2-ecc8c088824d" name="raip.site" url="http://185.224.138.197">
<fileTransfer rootFolder="/domains/raip.site/public_html" accessType="FTPS" host="185.224.138.197" port="21">
<advancedOptions>
<advancedOptions dataProtectionLevel="Private" passiveMode="true" shareSSLContext="true" />
</advancedOptions>
</fileTransfer>
</webServer>
</option>
</component>
</project>
\ No newline at end of file
import mysql from 'mysql'
var connection = mysql.createConnection({
host: 'SG-RAIP-4399-mysql-master.servers.mongodirector.com',
user: 'sgroot',
password: 'TTY+Iz0vWzzO1z9b',
database: 'RAIP',
port: 3306,
});
connection.connect(function (err) {
if (err) throw err;
console.log("Connected!");
/* var sql = "INSERT INTO RAIP.utilisateur (email, mot_de_passe, prenom, nom, faculte, niveau_etude, est_un_etudiant, est_un_repetiteur) VALUES ('Ahmed.Buzgheiba@etu.unige.ch', 'Ahmed', 'Buygheiba', 'GSEM', 'Bachelor', 1, 0);";
connection.query(sql, function (err, result) {
if (err) throw err;
console.log("User inserted");
});*/
});
function insertStudentSQL() {
let email = document.querySelector("#email").value;
let mot_De_passe = document.querySelector("#mot_de_passe").value;
let prenom = document.querySelector("#prenom").value;
let nom = document.querySelector("#nom").value;
let faculte = document.querySelector("#faculte").value;
let niveau_etude = document.querySelector("#niveau_etude").value;
let est_un_etudiant = 1;
let est_un_repetiteur = 0;
let sql = "INSERT INTO RAIP.utilisateur (email, mot_de_passe, prenom, nom, faculte, niveau_etude, est_un_etudiant, est_un_repetiteur) VALUES (?,?,?,?,?,?,?);";
connection.query(sql, [email, mot_De_passe, prenom, nom, faculte, niveau_etude, est_un_etudiant, est_un_repetiteur], function (err) {
if (err) throw err;
console.log("User inserted");
});
}
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Connexion</title>
<link href="css/webHeader.css" rel="stylesheet" type="text/css">
<link href="css/formStyle.css" rel="stylesheet" type="text/css">
</head>
<!-- Website page -->
<body>
<div class="container">
<header>
<!-- Header -->
<div class="primary_header">
<h1 class="title1"> RAIP&nbsp;</h1>
<h2 class="title2">Répétitoire Académique d'Introduction à la Programmation&nbsp;</h2>
</div>
<!-- Menu -->
<nav class="secondary_header" id="menu">
<ul>
<li><a href="index.html" style="text-decoration: none">ACCUEIL&nbsp;</a></li>
<li><a href="repetitoires.html" style="text-decoration: none">REPETITOIRES&nbsp;</a></li>
<li><a href="creerCompte.html" style="text-decoration: none">CREER COMPTE&nbsp;</a></li>
<li><a href="connexion.html" style="text-decoration: none">CONNEXION&nbsp;</a></li>
<li><a href="contact.html" style="text-decoration: none">CONTACT&nbsp;</a></li>
</ul>
</nav>
</header>
<!-- Content -->
<section>
<!-- Left article -->
<article class="left_article">
<h3>Ici vous pouvez vous connecter</h3>
<!-- Login form -->
</article>
</section>
<!-- Copyright footer -->
<footer class="secondary_header footer">
<div class="copyright">&copy;2021 - <strong>Prototype projet de Base de Données</strong></div>
</footer>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Connexion</title>
<link href="css/webHeader.css" rel="stylesheet" type="text/css">
<link href="css/confirmation.css" rel="stylesheet" type="text/css">
<link href="css/formStyle.css" rel="stylesheet" type="text/css">
</head>
<!-- Website page -->
<body>
<div class="container">
<header>
<!-- Header -->
<div class="primary_header">
<h1 class="title1"> RAIP&nbsp;</h1>
<h2 class="title2">Répétitoire Académique d'Introduction à la Programmation&nbsp;</h2>
</div>
<!-- Menu -->
<nav class="secondary_header" id="menu">
<ul>
<li><a href="index.html" style="text-decoration: none">ACCUEIL&nbsp;</a></li>
<li><a href="repetitoires.html" style="text-decoration: none">REPETITOIRES&nbsp;</a></li>
<li><a href="creerCompte.html" style="text-decoration: none">CREER COMPTE&nbsp;</a></li>
<li><a href="connexion.html" style="text-decoration: none">CONNEXION&nbsp;</a></li>
<li><a href="contact.html" style="text-decoration: none">CONTACT&nbsp;</a></li>
</ul>
</nav>
</header>
<!-- Content -->
<section>
<!-- Left article -->
<article class="left_article">
<h3>Confirmation de creation d'un nouveau répétitoire</h3>
<p>Vous avez bien créer un nouveau répétitoire</p>
</article>
<!-- Right image -->
<aside class="left_article_confirm">
<img src="images/confirmation-icon-13.jpg" alt="" width="300" height="300"
class="placeholder"/>
</aside>
</section>
<!-- Copyright footer -->
<footer class="secondary_header footer">
<div class="copyright">&copy;2021 - <strong>Prototype projet de Base de Données</strong></div>
</footer>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>inscription</title>
<link href="css/webHeader.css" rel="stylesheet" type="text/css">
<link href="css/formStyle.css" rel="stylesheet" type="text/css">
</head>
<!-- Website page -->
<body>
<div class="container">
<header>
<!-- Header -->
<div class="primary_header">
<h1 class="title1"> RAIP&nbsp;</h1>
<h2 class="title2">Répétitoire Académique d'Introduction à la Programmation&nbsp;</h2>
</div>
<!-- Menu -->
<nav class="secondary_header" id="menu">
<ul>
<li><a href="index.html" style="text-decoration: none">ACCUEIL&nbsp;</a></li>
<li><a href="repetitoires.html" style="text-decoration: none">REPETITOIRES&nbsp;</a></li>
<li><a href="creerCompte.html" style="text-decoration: none">CREER COMPTE&nbsp;</a></li>
<li><a href="connexion.html" style="text-decoration: none">CONNEXION&nbsp;</a></li>
<li><a href="contact.html" style="text-decoration: none">CONTACT&nbsp;</a></li>
</ul>
</nav>
</header>
<!-- Content -->
<section>
<!-- Left article -->
<article class="left_article">
<h3>Creer un nouveau répétitoire </h3>
<!-- Form -->
<div class="form-style-10">
<form action="creerRepetitoire.php" method="post">
<div class="section"><span>1</span>Données du répétitoire</div>
<div class="inner-wrap">
<label>Nom du répétitoire <input type="text" name="nom_repetitoire"
id="nom_repetitoire"/></label>
<label>Date et Heure <br><input type="datetime-local" name="date_heure"
id="date_heure"/></label>
<label>Durée <br><input type="number" name="duree" id="duree"/></label>
</div>
<div class="section"><span>2</span>Sujets abordés</div>
<div class="inner-wrap">
<label>Nom du sejet 1 <input type="text" name="nom_sujet_1" id="nom_sujet_1"/></label>
<label>Nom du sejet 2 <input type="text" name="nom_sujet_2" id="nom_sujet_2"/></label>
<label>Nom du sejet 3 <input type="text" name="nom_sujet_3" id="nom_sujet_3"/></label>
<label>Nom du sejet 4 <input type="text" name="nom_sujet_4" id="nom_sujet_4"/></label>
<label>Nom du sejet 5 <input type="text" name="nom_sujet_5" id="nom_sujet_5"/></label>
</div>
<div class="section"><span>3</span>Email du répétiteur</div>
<div class="inner-wrap">
<label>Email universitaire <input type="email" name="email" id="email"/></label>
</div>
<div class="section"><span>4</span>Tarif</div>
<div class="inner-wrap">
<label>Prix du répétitoire par heure <input type="number" name="prix_repetitoire_heure"
id="prix_repetitoire_heure"/></label>
</div>
<div class="button-section">
<button type="submit" id="submitStudent">Créer un nouveau répétitoire
</button>
<span class="privacy-policy">
<input type="checkbox" name="field7">En cochant vous acceptez nos conditions d'utilisation.
</span>
</div>
</form>
</div>
</article>
</section>
<!-- Copyright footer -->
<footer class="secondary_header footer">
<div class="copyright">&copy;2021 - <strong>Prototype projet de Base de Données</strong></div>
</footer>
</div>
</body>
</html>
<?php
require_once "server/dbConnection.php";
$nom_repetitoire = $_REQUEST['nom_repetitoire'];
$date_heure = $_REQUEST['date_heure'];
$duree = $_REQUEST['duree'];
$nom_sujet_1 = $_REQUEST['nom_sujet_1'];
$nom_sujet_2 = $_REQUEST['nom_sujet_2'];
$nom_sujet_3 = $_REQUEST['nom_sujet_3'];
$nom_sujet_4 = $_REQUEST['nom_sujet_4'];
$nom_sujet_5 = $_REQUEST['nom_sujet_5'];
$email = $_REQUEST['email'];
$prix_repetitoire_heure = $_REQUEST['prix_repetitoire_heure'];
$date = date('Y/m/d', strtotime($date_heure));
$sujets = array($nom_sujet_1, $nom_sujet_2, $nom_sujet_3, $nom_sujet_4, $nom_sujet_5);
// Sends first SQL Query
$SQLQueryRepetitoire = "insert into repetitoire(nom_repetitoire, date_heure, duree, prix_repetitoire_heure)
values (?,?,?,?);";
$stmt = $conn->prepare($SQLQueryRepetitoire);
$stmt->bind_param("ssii", $nom_repetitoire, $date, $duree, $prix_repetitoire_heure);
$stmt->execute();
$stmt->close();
// Sends second SQL Query with a loop for the differents sujets
$SQLQuerySujet = "insert into sujet(nom_sujet)
VALUES (?)";
for ($index = 0; $index < count($sujets); $index++) {
if ($sujets[$index] != "") {
$stmt = $conn->prepare($SQLQuerySujet);
$stmt->bind_param("s", $sujets[$index]);
$stmt->execute();
$stmt->close();
}
}
// Gets the ID_repetitoire
$SQLIDRepetitoire = "select ID_repetitoire from repetitoire where nom_repetitoire=?";
$stmt = $conn->prepare($SQLIDRepetitoire);
$stmt->bind_param("s", $nom_repetitoire);
$stmt->execute();
$ID_repetitoire = $stmt->get_result();
$stmt->close();
// Sends third SQL Query
$SQLQueryDonner = "insert into donner(EMAIL_REPETITEUR, ID_REPETITOIRE)
VALUES (?,?);";
$stmt = $conn->prepare($SQLQueryDonner);
$stmt->bind_param("si", $email, $ID_repetitoire);
$stmt->execute();
$stmt->close();
// Gets the ID_sujet and stores them in an array
$SQLIDSujet = "select ID_sujet from sujet where nom_sujet=?";
$ID_sujets = array();
for ($index = 0; $index < count($sujets); $index++) {
if ($sujets[$index] != "") {
$stmt = $conn->prepare($SQLIDSujet);
$stmt->bind_param("s", $sujets[$index]);
$stmt->execute();
$temp = $stmt->get_result();
$ID_sujets[$index] = $temp;
$stmt->close();
}
}
// Sends forth SQL Query with a loop for the differents sujets
$SQLQueryCreerRepetitoire = "insert into creer_repetitoire(ID_repetitoire, ID_sujet, email_repetiteur)
VALUES (?,?,?);";
for ($index = 0; $index < count($ID_sujets); $index++) {
$stmt = $conn->prepare($SQLQueryCreerRepetitoire);
$stmt->bind_param("iis", $ID_repetitoire, $ID_sujets[$index], $email);
$stmt->execute();
$stmt->close();
}
// Sends fifth SQL Query with a loop for the differents sujets
$SQLQueryCreerSujet = "insert into creer_sujet(ID_sujet, email_repetiteur)
VALUES (?,?);";
for ($index = 0; $index < count($ID_sujets); $index++) {
$stmt = $conn->prepare($SQLQueryCreerSujet);
$stmt->bind_param("is", $ID_sujets[$index], $email);
$stmt->execute();
$stmt->close();
}
// Ends connection and send to confirmation page
header("location: confirmationCompte.html");
$conn->close();
......@@ -52,6 +52,8 @@
.form-style-10 input[type="text"],
.form-style-10 input[type="email"],
.form-style-10 input[type="password"],
.form-style-10 input[type="datetime-local"],
.form-style-10 input[type="number"],
.form-style-10.form-style-10 select, textarea {
display: block;
box-sizing: border-box;
......
......@@ -9,6 +9,24 @@
<link href="css/formStyle.css" rel="stylesheet" type="text/css">
</head>
<script>
function showQuery(string) {
if (str == "") {
document.getElementById("textHint").innerHTML = "";
return;
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("textHint").innerHTML = this.responseText;
}
};
xmlhttp.open("GET", "java.php?q=" + string, true);
xmlhttp.send();
}
}
</script>
<!-- Website page -->
<body>
<div class="container">
......@@ -52,7 +70,7 @@
<aside>
<div class="columns">
<p class="thumbnail_align"><img src="images/scala.jpg" alt="" class="thumbnail"/></p>
<h4><a href="compteEtudiant.html">
<h4><a href="creerRepetitoire.html">
<button class="button">Créer un nouveau cours</button>
</a></h4>
<p>Si vous etes répétiteur vous pouvez creer un nouveau cours ici</p>
......@@ -64,29 +82,52 @@
<div class="row">
<div class="form-style-10">
<form action="studentForm.php" method="post">
<div class="section"><span>1</span>Liste des cours disponibles</div>
<form>
<div class="section">
<span>1</span>
Liste des cours disponibles
</div>
<div class="inner-wrap">
<label>Faculté <select id="faculte" name="faculte">
<optgroup label="UNIGE">
<option value="Sciences">Scala Loop</option>
<option value="Lettres">Lettres</option>
<option value="CUI">CUI</option>
<option value="GSEM">GSEM</option>
</optgroup>
</select></label>
<label>Faculté
<select name="queryList" onchange="showQuery(this.value)">
<optgroup label="UNIGE">
<option value="">Selectionnez une requête</option>
<option value="1">Lettres</option>
<option value="2">CUI</option>
<option value="3">GSEM</option>
</optgroup>
</select>
</label>
</div>
</form>
<br>
<div id="textHint">
<b>Les données du base de données vont s'afficher là en mode moche car j'ai pas encore
fait les styles
CSS...</b>
</div>
</div>
</div>
</div>
<form>
<select name="users" onchange="showUser(this.value)">
<option value="">Select an item:</option>
<option value="1">Le jacobisme universel est :</option>
<option value="2">Loi de la hess ultime</option>
<option value="3">est-ce que les chiens ont bien mangé ?</option>
<option value="4">Liste repetitoire por scala</option>
</select>
</form>
<!-- Copyright footer -->
<footer class="secondary_header footer">
<div class="copyright">&copy;2021 - <strong>Prototype projet de Base de Données</strong></div>
</footer>
</div>
</body>
</html>
<?php
<!DOCTYPE html>
<html>
<head>
<style>
table {
width: 100%;
border-collapse: collapse;
}
table, td, th {
border: 1px solid #a01919;
padding: 5px;
}
th {
text-align: left;
}
</style>
</head>
<body>
<?php
$q = intval($_GET['q']);
// Create database connection
$con = new mysqli(
"SG-RAIP-4399-mysql-master.servers.mongodirector.com",
"sgroot",
"TTY+Iz0vWzzO1z9b",
"RAIP",
3306);
// Check connection
if ($con->connect_error) {
die("Connection failed: " . $con->connect_error);
}
switch ($q) {
case 4:
mysqli_select_db($con, "RAIP");
$sql = "SELECT t.*
FROM RAIP.utilisateur t
LIMIT 501";
$result = mysqli_query($con, $sql);
echo "<table>
<tr>
<th>nom_sujet</th>
<th>ID_repetitoire</th>
</tr>";
while ($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['prenom'] . "</td>";
echo "<td>" . $row['nom'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
break;
case 3:
echo "Tous les petits chiens ont bien mangé!";
break;
default :
echo "HESSIAN !!!!!";
}
?>
</body>
</html>
\ No newline at end of file
<?php
// Create database connection
$conn = new mysqli(
"SG-RAIP-4399-mysql-master.servers.mongodirector.com",
"sgroot",
"TTY+Iz0vWzzO1z9b",
"RAIP",
3306);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment