Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Arthur BOSSHARDT
Projet_Tutore_ANNEE_2
Commits
b7719704
Commit
b7719704
authored
Jan 18, 2018
by
Charles DORMEVAL
Browse files
suppression test et levenshtein qui n'étaient pas dans le dossier
parent
788ff3d7
Changes
5
Hide whitespace changes
Inline
Side-by-side
data/Toutes.txt
View file @
b7719704
Quels mots impressionnants! Dakar : deux a, comme arabe, mais si différemment colorés
Quels mots impressionnants! Dakar : deux a, comme arabe, mais si différemment colorés
par les consonnes! Le k intercale son exotisme menaçant, l'r final gronde et se répercute.
—J.-R. BLOCH, Cacaouettes et Bananes, p. 69.
La distinction entre les deux A [non nasalisés] tend à disparaître au profit du seul a
src/extraireCitation/ModeleBd.php
0 → 100644
View file @
b7719704
<?php
class
ModeleBd
{
private
$connexion
;
public
function
__construct
(){
try
{
$this
->
connexion
=
new
PDO
(
"mysql:host=localhost; dbname=projet"
,
"root"
,
""
);
}
catch
(
PDOException
$e
){
$exception
=
new
PDOException
(
$e
->
getMessage
());
throw
$exception
;
}
}
public
function
getIdAuteur
(
$auteur
){
$request
=
$this
->
connexion
->
prepare
(
"select id_auteur from auteurs where nom_auteur=?"
);
$request
->
bindParam
(
1
,
$auteur
);
$request
->
execute
();
return
$request
->
fetch
();
}
public
function
getIdOeuvre
(
$oeuvre
){
$request
=
$this
->
connexion
->
prepare
(
"select id_oeuvre from oeuvres where nom_oeuvre=?"
);
$request
->
bindParam
(
1
,
$oeuvre
);
$request
->
execute
();
return
$request
->
fetch
();
}
}
?>
\ No newline at end of file
src/moteur_de_recherche/page_recherche.php
0 → 100644
View file @
b7719704
<!DOCTYPE html>
<html
lang=
"fr"
>
<head>
<meta
charset=
"utf-8"
/>
<title>
Recherche
</title>
</head>
<body>
<form
method=
"post"
action=
"traitement_recherche.php"
>
<p>
Que recherchez vous ?
</p>
<p>
<input
type=
"radio"
value=
"auteur"
name=
"choix_type_recherche"
id=
"ctr1"
/>
<label
for=
"ctr1"
>
Auteur
</label>
<input
type=
"radio"
value=
"citation"
name=
"choix_type_recherche"
id=
"ctr2"
checked=
"checked"
/>
<label
for=
"ctr2"
>
Citation
</label>
</p>
<input
type=
"search"
name=
"barre_recherche"
placeholder=
"Element recherché ..."
/>
<p>
<label
for=
"select_date"
>
Date :
</label>
<select
name=
"date"
id=
"select_date"
>
<option
value=
"-1"
name=
"date"
>
Peu importe
</option>
<?php
for
(
$i
=
2017
;
$i
>=
0
;
$i
--
){
?>
<option
value=
"
<?php
echo
$i
;
?>
"
name=
"date"
>
<?php
echo
$i
;
?>
</option>
<?php
}
?>
</select>
</p>
<p>
<input
type=
"submit"
value=
"Lancer la recherche !"
/>
</p>
</form>
<a
href=
"page_recherche_avancee.php"
target=
"_blank"
>
Recherche avancée
</a>
</body>
</html>
\ No newline at end of file
src/moteur_de_recherche/page_recherche_avancee.php
0 → 100644
View file @
b7719704
<!DOCTYPE html>
<html
lang=
"fr"
>
<head>
<meta
charset=
"utf-8"
/>
<title>
Recherche avancée
</title>
</head>
<body>
<form
method=
"post"
action=
"traitement_recherche_avance"
>
<label
for=
"auteur_id"
>
Auteur :
</label>
<p>
<input
type=
"search"
name=
"auteur"
id=
"auteur_id"
placeholder=
"Auteur recherché ..."
/>
</p>
<label
for=
"citation_id"
>
Citation :
</label>
<p>
<input
type=
"search"
name=
"citation"
id=
"citation_id"
placeholder=
"Citation recherchée ..."
/>
</p>
<label
for=
"oeuvre_id"
>
Oeuvre :
</label>
<p>
<input
type=
"search"
name=
"oeuvre"
id=
"oeuvre_id"
placeholder=
"Oeuvre recherchée ..."
/>
</p>
<label
for=
"date_id"
>
Date :
</label>
<p>
<select
name=
"date"
id=
"date_id"
>
<option
name=
"date"
value=
"-1"
>
Peu importe
</option>
<?php
for
(
$i
=
2017
;
$i
>=
0
;
$i
--
){
?>
<option
value=
"
<?php
echo
$i
;
?>
"
name=
"date"
>
<?php
echo
$i
;
?>
</option>
<?php
}
?>
</select>
</p>
<p>
<input
type=
"submit"
value=
"Lancer la recherche !"
/>
</p>
</form>
<a
href=
"page_recherche.php"
target=
"_blank"
>
Recherche basique
</a>
</body>
</html>
src/moteur_de_recherche/traitement_recherche.php
0 → 100644
View file @
b7719704
<?php
try
{
$bdd
=
new
PDO
(
"mysql:host=localhost;dbname=projet;charset=utf8"
,
"root"
,
""
);
}
catch
(
Exception
$e
){
die
(
"Erreur :"
.
$e
->
getMessage
());
}
$res
=
array
();
/*-----Auteur-----*/
if
(
$_POST
[
'choix_type_recherche'
]
==
'auteur'
){
if
(
$_POST
[
'date'
]
!=-
1
){
$req
=
$bdd
->
prepare
(
"select a.nom_auteur, o.date, o.nom_oeuvre, c.contenu
from citations c, oeuvres o, auteurs a
where c.id_oeuvre=o.id_oeuvre and o.id_auteur=a.id_auteur
and a.nom_auteur like ? and o.date like ?"
);
$req
->
execute
(
array
(
"%"
.
$_POST
[
'barre_recherche'
]
.
"%"
,
"%"
.
$_POST
[
'date'
]
.
"%"
));
$res
=
$req
->
fetchAll
();
}
else
{
$req
=
$bdd
->
prepare
(
"select a.nom_auteur, o.date, o.nom_oeuvre, c.contenu
from citations c, oeuvres o, auteurs a
where c.id_oeuvre=o.id_oeuvre and o.id_auteur=a.id_auteur
and a.nom_auteur like ?"
);
$req
->
execute
(
array
(
"%"
.
$_POST
[
'barre_recherche'
]
.
"%"
));
$res
=
$req
->
fetchAll
();
}
}
/*-----Citation----*/
else
{
if
(
$_POST
[
'date'
]
!=-
1
)
{
$req
=
$bdd
->
prepare
(
"select a.nom_auteur, o.date, o.nom_oeuvre, c.contenu
from citations c, oeuvres o, auteurs a
where c.id_oeuvre=o.id_oeuvre and o.id_auteur=a.id_auteur
and c.contenu like ? and o.date like ?"
);
$req
->
execute
(
array
(
"%"
.
$_POST
[
'barre_recherche'
]
.
"%"
,
"%"
.
$_POST
[
'date'
]
.
"%"
));
$res
=
$req
->
fetchAll
();
}
else
{
$req
=
$bdd
->
prepare
(
"select a.nom_auteur, o.date, o.nom_oeuvre, c.contenu
from citations c, oeuvres o, auteurs a
where c.id_oeuvre=o.id_oeuvre and o.id_auteur=a.id_auteur
and c.contenu like ?"
);
$req
->
execute
(
array
(
"%"
.
$_POST
[
'barre_recherche'
]
.
"%"
));
$res
=
$req
->
fetchAll
();
}
}
/*----Résultat----*/
if
(
count
(
$res
)
>
0
){
for
(
$i
=
0
;
$i
<
count
(
$res
);
$i
++
){
?>
<p>
<?php
echo
$res
[
$i
][
0
]
;
?>
a écrit :
<i>
<?php
echo
$res
[
$i
][
3
];
?>
</i>
; dans
<u>
<?php
echo
$res
[
$i
][
2
]
;
?>
</u>
en
<?php
echo
$res
[
$i
][
1
];
?>
</p>
<?php
}
}
else
{
?>
<p>
Il semblerait que Dave n'ait rien trouvé pour vous, méchant Dave.
</p>
<?php
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment