-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathUser.php
More file actions
52 lines (51 loc) · 924 Bytes
/
Copy pathUser.php
File metadata and controls
52 lines (51 loc) · 924 Bytes
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
<?php
/**
* Grab all data from user provided credentials are met
*/
class GlobalUser
{
public function Data()
{
require 'db.php';
if (isset($_COOKIE['auth'])) {
$user_id = $_COOKIE['auth'];
$stmt = "SELECT * FROM users WHERE user_id = ?";
$prep = $conn->prepare($stmt);
$prep->execute([$user_id]);
$result = $prep->fetch();
if (!empty($result)) {
return $data = $result;
$conn = null;
}
else{
//echo "Please login";
header('location: login');
}
}
else{
header('location: login');
}
}
}
//$data = Global(new User)->Data();
$data = (new GlobalUser)->Data();
/**
*
*/
class User extends GlobalUser
{
public function username($data)
{
echo $data['username'];
}
public function email($data)
{
echo $data['email'];
}
public function balance($data)
{
echo $data['balance'];
}
}
$user = new User();
?>