-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserClass.php
60 lines (45 loc) · 1.03 KB
/
UserClass.php
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
<?php
class User{
//Variables
public $Auth=false;
public $email;
public $pseudo;
public $id;
public $Error=false;
public $admin=false;
//constructeur récupère les infos de logs si ok
public function __construct()
{
//verifier s'il y a une connection
if(isset($_SESSION['Auth'])&&!empty($_SESSION['Auth']))
{
$this->Auth = true;
$this->pseudo = $_SESSION['Auth']['pseudo'];
$this->email = $_SESSION['Auth']['email'];
$this->id = $_SESSION['Auth']['id'];
$this->admin = $_SESSION['Auth']['admin'];
}else{
$this->Auth = false;
$this->Error = true;
}
}//end constructeur
//récupère les informations de connection
public function getAuth($champ="")
{
//si on demande un champ
if(!empty($champ) && isset($champ))
{
$retour = $this->$champ;
}else if(!isset($_SESSION['Auth'])&&empty($_SESSION['Auth']))
{
$this->Auth = false;
$retour = $this->Auth;
$this->Error = true;
}else
{
$retour = $this->Auth;
}
return $retour;
}//end get auth
}
?>