summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IUT_auth_my.inc.php16
-rw-r--r--auth_my.inc.php16
-rw-r--r--test/AWOR_auth.php44
-rw-r--r--test/ajax/ajax.php14
-rw-r--r--test/ajax/ajax_simple.js37
-rw-r--r--test/ajax/coucou.txt1
-rw-r--r--test/awor1.txt18
-rw-r--r--test/pop3.txt12
-rw-r--r--test/test-tab_v1.php103
-rw-r--r--test/test-tab_v2.php126
-rw-r--r--test/test_array.php14
11 files changed, 401 insertions, 0 deletions
diff --git a/IUT_auth_my.inc.php b/IUT_auth_my.inc.php
new file mode 100644
index 0000000..1fb5ae6
--- /dev/null
+++ b/IUT_auth_my.inc.php
@@ -0,0 +1,16 @@
+<?php
+
+function mysql_conn_select_db()
+ {
+ $mysql_host='localhost';
+ $mysql_user='258';
+ $mysql_pass='ess_ku_elle';
+ $mysql_base='258_tests';
+
+ $link = mysql_connect($mysql_host,$mysql_user,$mysql_pass)
+ or die('Erreur MySql : Impossible de se connecter : ' . mysql_error());
+ mysql_select_db($mysql_base) or die('Erreur Mysql : Impossible de sélectionner la database');
+
+ return ($link);
+}
+?>
diff --git a/auth_my.inc.php b/auth_my.inc.php
new file mode 100644
index 0000000..f451755
--- /dev/null
+++ b/auth_my.inc.php
@@ -0,0 +1,16 @@
+<?php
+
+function mysql_conn_select_db()
+ {
+ $mysql_host='localhost';
+ $mysql_user='lud_restricted';
+ $mysql_pass='maille_ess_ku_elle';
+ $mysql_base='intranet_projet';
+
+ $link = mysql_connect($mysql_host,$mysql_user,$mysql_pass)
+ or die('Erreur MySql : Impossible de se connecter : ' . mysql_error());
+ mysql_select_db($mysql_base) or die('Erreur Mysql : Impossible de sélectionner la database');
+
+ return ($link);
+}
+?>
diff --git a/test/AWOR_auth.php b/test/AWOR_auth.php
new file mode 100644
index 0000000..7d8df12
--- /dev/null
+++ b/test/AWOR_auth.php
@@ -0,0 +1,44 @@
+<?php
+require_once('auth.inc.php');
+
+$server_adr="pop.wanadoo.fr";
+$port=110;
+//$service="pop3";
+//$flags="/ssl/novalidate-cert";
+//$options = OP_READONLY;
+
+
+$user="ludolpiftrash";
+$upw="Pioupiou";
+
+// Le module imap est un module à ajouter à php
+//if ( imap_open( '{' . $server_adr . ':' . $port . '/service=' . $service . $flags . '}', $username, $password, $options ) === false )
+if ( ($errno = pop3_auth ($server_adr, $port, $user, $upw) ) != 0 )
+{
+ echo "Erreur numéro " . $errno;
+}
+else
+{
+ echo "OK";
+}
+
+
+/*
+// Pour se connecter à un serveur IMAP fonctionnant sur le port 143 de la
+// machine locale, faites ceci :
+$mbox = imap_open("{localhost:143}INBOX","user_id","password");
+
+// Pour se connecter à un serveur POP3 fonctionnant sur le port 110 du
+// serveur local, faites ceci :
+$mbox = imap_open("{localhost:110/pop3}INBOX","user_id","password");
+
+// Pour se connecter à un serveur SSL IMAP ou POP3, ajoutez /ssl
+// après la spécification du protocole
+$mbox = imap_open("{localhost:993/imap/ssl}INBOX", "user_id", "password");
+
+// Pour se connecter à un serveur SSL IMAP ou POP3 avec un certificat auto-signé
+// ajoutez /ssl/novalidate-cert après le protocole :
+$mbox = imap_open("{localhost:995/pop3/ssl/novalidate-cert}", "user_id", "password");
+
+*/
+?> \ No newline at end of file
diff --git a/test/ajax/ajax.php b/test/ajax/ajax.php
new file mode 100644
index 0000000..f5c8162
--- /dev/null
+++ b/test/ajax/ajax.php
@@ -0,0 +1,14 @@
+<?php
+ echo '<?xml version="1.0" encoding="ISO-8859-1"?>';
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <title>Test AJAX</title>
+ <script type="text/javascript" src="ajax_simple.js"></script>
+ </head>
+ <body>
+ <p><a href="#" onclick="url2div('coucou.txt','pong')" >Ping</a></p>
+ <div id="pong">Cliquez sur ping !</div>
+ </body>
+</html> \ No newline at end of file
diff --git a/test/ajax/ajax_simple.js b/test/ajax/ajax_simple.js
new file mode 100644
index 0000000..74005cb
--- /dev/null
+++ b/test/ajax/ajax_simple.js
@@ -0,0 +1,37 @@
+function url2div(url,divid) {
+ var http_request = false;
+
+ if (window.XMLHttpRequest) { // Mozilla, Safari,...
+ http_request = new XMLHttpRequest();
+ if (http_request.overrideMimeType) {
+ http_request.overrideMimeType('text/xml');
+ }
+ } else if (window.ActiveXObject) { // IE
+ try {
+ http_request = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (e) {
+ try {
+ http_request = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch (e) {}
+ }
+ }
+
+ if (!http_request) {
+ alert('Abandon : Impossible de créer une instance XMLHTTP');
+ return false;
+ }
+
+ http_request.onreadystatechange = function(){
+
+ if (http_request.readyState == 4) {
+ if (http_request.status == 200) {
+ document.getElementById(divid).innerHTML = http_request.responseText;
+ } else {
+ document.getElementById(divid).innerHTML = "Un problème est survenu ...";
+ }
+ }
+ };
+
+ http_request.open('GET', url, true);
+ http_request.send(null);
+} \ No newline at end of file
diff --git a/test/ajax/coucou.txt b/test/ajax/coucou.txt
new file mode 100644
index 0000000..bc08321
--- /dev/null
+++ b/test/ajax/coucou.txt
@@ -0,0 +1 @@
+pong !
diff --git a/test/awor1.txt b/test/awor1.txt
new file mode 100644
index 0000000..e02eb8d
--- /dev/null
+++ b/test/awor1.txt
@@ -0,0 +1,18 @@
+<?php
+ # server switch webetud
+if (($_SERVER["REMOTE_ADDR"] == "localhost")
+ || ($_SERVER["REMOTE_ADDR"] == "127.0.0.1")
+ ){
+ $login='etud';
+ $login='Inglebert';
+} else {
+ VerifOuvertureSession("quelconque");
+}
+ #################################################
+ # Récupération login webetud
+ #################################################
+ function VerifOuvertureSession($typeParam)
+ {
+ session_start();
+ #peu importe
+ } \ No newline at end of file
diff --git a/test/pop3.txt b/test/pop3.txt
new file mode 100644
index 0000000..089e868
--- /dev/null
+++ b/test/pop3.txt
@@ -0,0 +1,12 @@
+ $connexion = @fsockopen($server, 110, $errno, $errstr, 10);
+ if($connexion) {
+ $output = fgets($connexion, 128);
+ fputs($connexion, "user $user\n");
+ $output = fgets($connexion, 128);
+ $upw = "" . $_REQUEST['user_pw'] ;
+ fputs($connexion, "pass $upw\n");
+ $output = fgets($connexion, 128);
+ $subout = substr($output, 0, 4);
+ fputs($connexion, "quit\n");
+ fclose($connexion);
+ if ($subout == "+OK ") {
diff --git a/test/test-tab_v1.php b/test/test-tab_v1.php
new file mode 100644
index 0000000..79d13b1
--- /dev/null
+++ b/test/test-tab_v1.php
@@ -0,0 +1,103 @@
+<?php
+$mysql_host='localhost';
+$mysql_user='lud_restricted';
+$mysql_pass='maille_ess_ku_elle';
+$mysql_base='awor';
+$link = mysql_connect($mysql_host,$mysql_user,$mysql_pass)
+ or die('Erreur MySql : Impossible de se connecter : ' . mysql_error());
+mysql_select_db($mysql_base) or die('Erreur Mysql : Impossible de sélectionner la database');
+
+// Variables récupérées par les $_POST ou dans les sessions (évite les modifications côté client)
+
+$id_reunion=1;
+$id_personne=2;
+
+echo '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n"
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
+ <head>
+ <title>Tests BD</title>
+ <link rel="stylesheet" type="text/css" href="style1.css" />
+ </head>
+ <body>
+<table class="details" cellspacing="0">
+<thead>
+<tr>
+<th>Personnes/Creneaux</th>
+<?php
+ $query="SELECT idC, UNIX_TIMESTAMP(dateHeure), duree FROM Creneau WHERE idR='$id_reunion';";
+ $creneaux=array();
+ if ( $result = mysql_query($query) )
+ {
+ while ( $c = mysql_fetch_row($result) )
+ {
+ $date_deb =$c[1];
+ //echo $date_deb . "\n";
+ $date_fin = $date_deb + 60 * $c[2];
+ echo '<th>' . date('d/m/y', $date_deb) . '<br />' . date('H:i', $date_deb) . ' - ' . date('H:i', $date_fin) . "</th>\n";
+ $creneaux[] = $c[0];
+ }
+ }
+ //print_r($creneaux);
+?>
+</tr>
+</thead>
+<tbody>
+<?php
+ // Requette écrivant les disponibilités dans un tableau associatif en une seule fois
+ $query='SELECT ch.idC, ch.idP, ch.estDispo FROM Choisir ch, Creneau c, Personne p, Appartenir a, Reunion r WHERE '
+ ."c.idR=$id_reunion AND r.idR=$id_reunion AND a.idL=r.idL AND p.idP=a.idP AND ch.idC = c.idC AND ch.idP = p.idP;";
+ //echo $query . "\n";
+ $dispos=array();
+ if ( $result = mysql_query($query) )
+ {
+ while ( list($idC, $idP, $estDispo) = mysql_fetch_row($result) )
+ {
+ $dispos[$idC][$idP]=$estDispo;
+ }
+ }
+ //print_r($dispos);
+
+ $query='SELECT p.idP, p.prenomP, p.nomP FROM Personne p, Appartenir a, Reunion r WHERE '
+ . "r.idR='$id_reunion' AND a.idL=r.idL AND p.idP=a.idP;";
+ if ( $result = mysql_query($query) )
+ {
+ while ( $p = mysql_fetch_array($result) )
+ {
+ // Boucle sur chaque personne
+ // TODO : vérif car changement de la boucle
+ echo "<tr>\n<td>$p[1] $p[2]</td>\n";
+ // Pour chaque créneau
+ foreach ( $creneaux as $c_id )
+ {
+ // TODO : voir si l'on est la personne concernée !!!
+
+ // Cas général, on n'est pas la personne concernée
+ if ( ! isset($dispos[$c_id][$p[0]]) )
+ {
+ // Dispo Inconnue (icone ?)
+ echo '<td><img src="./images/question.gif" alt="Inconnu" height="15" width="15"></td>' . "\n";
+ }
+ else
+ {
+ if ( $dispos[$c_id][$p[0]] == 'oui' )
+ {
+ // Disponible
+ echo '<td><img src="./images/ok.gif" alt="Disponible" height="16" width="16"></td>' . "\n";
+ }else
+ {
+ // Non Disponible
+ echo '<td><img src="./images/del.gif" alt="Non disponible" height="15" width="15"></td>' . "\n";
+ }
+ }
+ }
+ echo "</tr>\n";
+ }
+ }
+?>
+</tbody>
+</table>
+</body>
+</html>
+
diff --git a/test/test-tab_v2.php b/test/test-tab_v2.php
new file mode 100644
index 0000000..b5b7e1d
--- /dev/null
+++ b/test/test-tab_v2.php
@@ -0,0 +1,126 @@
+<?php
+$mysql_host='localhost';
+$mysql_user='lud_restricted';
+$mysql_pass='maille_ess_ku_elle';
+$mysql_base='awor';
+$link = mysql_connect($mysql_host,$mysql_user,$mysql_pass)
+ or die('Erreur MySql : Impossible de se connecter : ' . mysql_error());
+mysql_select_db($mysql_base) or die('Erreur Mysql : Impossible de sélectionner la database');
+
+// Variables récupérées par les $_POST ou dans les sessions (évite les modifications côté client)
+
+$id_reunion=1;
+$id_personne=2;
+
+echo '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n"
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
+ <head>
+ <title>Tests BD</title>
+ <link rel="stylesheet" type="text/css" href="style1.css" />
+ </head>
+ <body>
+<table class="details" cellspacing="0">
+<thead>
+<tr>
+<th>Personnes/Creneaux</th>
+<?php
+ $query="SELECT idC, UNIX_TIMESTAMP(dateHeure), duree FROM Creneau WHERE idR='$id_reunion';";
+ $creneaux=array();
+ if ( $result = mysql_query($query) )
+ {
+ while ( $c = mysql_fetch_row($result) )
+ {
+ $date_deb =$c[1];
+ //echo $date_deb . "\n";
+ $date_fin = $date_deb + 60 * $c[2];
+ echo '<th>' . date('d/m/y', $date_deb) . '<br />' . date('H:i', $date_deb) . ' - ' . date('H:i', $date_fin) . "</th>\n";
+ $creneaux[] = $c[0];
+ }
+ }
+ //print_r($creneaux);
+?>
+</tr>
+</thead>
+<tbody>
+<?php
+ // Requette écrivant les disponibilités dans un tableau associatif en une seule fois
+ $query='SELECT ch.idC, ch.idP, ch.estDispo FROM Choisir ch, Creneau c, Personne p, Appartenir a, Reunion r WHERE '
+ ."c.idR=$id_reunion AND r.idR=$id_reunion AND a.idL=r.idL AND p.idP=a.idP AND ch.idC = c.idC AND ch.idP = p.idP;";
+ //echo $query . "\n";
+ $dispos=array();
+ if ( $result = mysql_query($query) )
+ {
+ while ( list($idC, $idP, $estDispo) = mysql_fetch_row($result) )
+ {
+ $dispos[$idC][$idP]=$estDispo;
+ }
+ }
+ //print_r($dispos);
+
+ $query='SELECT p.idP, p.prenomP, p.nomP FROM Personne p, Appartenir a, Reunion r WHERE '
+ . "r.idR='$id_reunion' AND a.idL=r.idL AND p.idP=a.idP;";
+ if ( $result = mysql_query($query) )
+ {
+ while ( $p = mysql_fetch_array($result) )
+ {
+ // Boucle sur chaque personne
+ // TODO : vérif car changement de la boucle
+ echo "<tr>\n<td>$p[1] $p[2]</td>\n";
+ // Pour chaque créneau
+ foreach ( $creneaux as $c_id )
+ {
+ // TODO : voir si l'on est la personne concernée !!!
+ if ( $p[0]!=$id_personne )
+ {
+ // Cas général, on n'est pas la personne concernée
+ if ( ! isset($dispos[$c_id][$p[0]]) )
+ {
+ // Dispo Inconnue (icone ?)
+ echo '<td><img src="./images/question.gif" alt="Inconnu" height="15" width="15"></td>' . "\n";
+ }
+ else
+ {
+ if ( $dispos[$c_id][$p[0]] == 'oui' )
+ {
+ // Disponible
+ echo '<td><img src="./images/ok.gif" alt="Disponible" height="16" width="16"></td>' . "\n";
+ }else
+ {
+ // Non Disponible
+ echo '<td><img src="./images/del.gif" alt="Non disponible" height="15" width="15"></td>' . "\n";
+ }
+ }
+ }
+ else
+ {
+ // On est la personne concernée, on peut donc choisir le créneau
+ if ( ! isset($dispos[$c_id][$p[0]]) )
+ {
+ // Dispo Inconnue
+ echo '<td><img src="./images/button_ok.png" alt="Disponible" height="25" width="25">&nbsp;&nbsp;<img src="./images/button_del.png" alt="Non disponible" height="25" width="25"></td>' . "\n";
+ }
+ else
+ {
+ if ( $dispos[$c_id][$p[0]] == 'oui' )
+ {
+ // Disponible
+ echo '<td><img src="./images/ok.gif" alt="Disponible" height="16" width="16">&nbsp;&nbsp;<img src="./images/button_del.png" alt="Non disponible" height="25" width="25"></td>' . "\n";
+ }else
+ {
+ // Non Disponible
+ echo '<td><img src="./images/button_ok.png" alt="Disponible" height="25" width="25">&nbsp;&nbsp;<img src="./images/del.gif" alt="Non disponible" height="15" width="15"></td>' . "\n";
+ }
+ }
+ }
+ }
+ echo "</tr>\n";
+ }
+ }
+?>
+</tbody>
+</table>
+</body>
+</html>
+
diff --git a/test/test_array.php b/test/test_array.php
new file mode 100644
index 0000000..4e1f052
--- /dev/null
+++ b/test/test_array.php
@@ -0,0 +1,14 @@
+<?php echo '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
+ <head>
+ <title>Tests BD</title>
+ <link rel="stylesheet" type="text/css" href="style1.css" />
+ </head>
+ <body>
+<?php
+ requiere_once('fonctions.inc.php');
+ generate_html_array_personnes_crenaux(false);
+?>
+ </body>
+</html>