-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserClass.php
65 lines (56 loc) · 1.61 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
61
62
63
64
65
<?php
require_once 'include/php/connect.php';
class User {
public $id;
public $name;
public $age;
public $email;
protected $pass;
public $mobile;
public $profession;
public $city;
public $pincode;
function _constructor() {
$id = null;
}
function newUser($name, $age, $email, $pass, $mobile, $profession, $city, $pincode) {
$this->name = $name;
$this->age = $age;
$this->email = $email;
$this->pass = $pass;
$this->mobile = $mobile;
$this->profession = $profession;
$this->city = $city;
$this->pincode = $pincode;
}
function insertUser() {
$GLOBALS['db']->insert('users','name, age, email, password, mobile, profession, city, pincode',"'$this->name', '$this->age', '$this->email', '$this->pass', '$this->mobile', '$this->profession', '$this->city', '$this->pincode'");
}
function getUserFromUserName($user) {
$result = $GLOBALS['db']->select('*','users','email',$user);
$row = $result->fetch_assoc();
$this->id = $row['id'];
$this->name = $row['name'];
$this->age = $row['age'];
$this->email = $row['email'];
$this->pass = $row['password'];
$this->profession = $row['profession'];
$this->city = $row['city'];
$this->pincode = $row['pincode'];
}
function getUser($userId) {
$result = $GLOBALS['db']->select('*','users','id',$userId);
$row = $result->fetch_assoc();
$this->id = $row['id'];
$this->name = $row['name'];
$this->age = $row['age'];
$this->email = $row['email'];
$this->pass = $row['password'];
$this->profession = $row['profession'];
$this->city = $row['city'];
$this->pincode = $row['pincode'];
}
function getName() {
return $this->name;
}
}