Repository navigation
Expand file tree
/
Copy pathAuthentification.php
More file actions
80 lines (67 loc) · 1.41 KB
/
Copy pathAuthentification.php
File metadata and controls
80 lines (67 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
Class Authentification
{
private $_login;
private $_mdp;
//Méthode permettant de savoir si authentification valide
//
public function AuthentificationValide($login, $mdp, $type)
{
//Se connecter a la base
//
require_once("Database.php");
Database::connect();
//Authentification Resposnable
//
if ($type=="responsable"){
//Tester si responsable valide
//
$sql="SELECT * FROM responsable WHERE login='$login' AND pass='$mdp'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
//Présent
//
if($count == 1){
return true;
}
else{
return false;
}
}
//Authentification Admin
//
if ($type=="admin"){
//Tester si admin valide
//
$sql="SELECT * FROM admin WHERE login='$login' AND pass='$mdp'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
//Présent
//
if($count == 1){
return true;
}
else{
return false;
}
}
return false;
}
public function getSport($login){
require_once("Database.php");
Database::connect();
$sql = "SELECT sport FROM responsable WHERE login='$login'";
$result=mysql_query($sql);
$ret=mysql_fetch_assoc($result);
$ret=$ret["sport"];
return $ret;
}
public function getMail($login){
$sql = "SELECT mail FROM responsable WHERE login='$login'";
$result=mysql_query($sql);
$ret =mysql_fetch_assoc($result);
$ret["login"];
return $ret;
}
}
?>