class.user.php
Gesponsorde koppelingen
PHP script bestanden
Code (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
66
67
68
69
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
<?php
/**
*
* @date 15 Aug 2012,
* @package Login System
*
*/
Class User {
/**
* @param int $user_id,
* @param string $username,
* @param string $password
*/
private
$user_id,
$username,
$password;
/**
* @param int $user_id,
* @return void
*/
public function setUserId($user_id) {
$this->user_id = (int) $user_id;
}
/**
* @param string $username,
* @return void
*/
public function setUsername($username) {
$this->username = (string) $username;
}
/**
* @param string $password,
* @return void
*/
public function setPassword($password) {
$this->password = (string) $password;
}
/**
* @return int $user_id
*/
public function getUserId() {
return (int) $this->user_id;
}
/**
* @return string $username
*/
public function getUsername() {
return (string) preg_replace('/[^0-9\p{L}]$/u', '', $this->username);
}
/**
* @return string $password
*/
public function getHashedPassword() {
$hash = new Hash($this->password, strtolower($this->username));
return $hash->getHashedPassword();
}
}
?>
/**
*
* @date 15 Aug 2012,
* @package Login System
*
*/
Class User {
/**
* @param int $user_id,
* @param string $username,
* @param string $password
*/
private
$user_id,
$username,
$password;
/**
* @param int $user_id,
* @return void
*/
public function setUserId($user_id) {
$this->user_id = (int) $user_id;
}
/**
* @param string $username,
* @return void
*/
public function setUsername($username) {
$this->username = (string) $username;
}
/**
* @param string $password,
* @return void
*/
public function setPassword($password) {
$this->password = (string) $password;
}
/**
* @return int $user_id
*/
public function getUserId() {
return (int) $this->user_id;
}
/**
* @return string $username
*/
public function getUsername() {
return (string) preg_replace('/[^0-9\p{L}]$/u', '', $this->username);
}
/**
* @return string $password
*/
public function getHashedPassword() {
$hash = new Hash($this->password, strtolower($this->username));
return $hash->getHashedPassword();
}
}
?>