parent
abd5c8c380
commit
58c349be1b
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
class User{
|
||||
public int $id;
|
||||
public string $username;
|
||||
public string $passwd;
|
||||
public string $hidenPasswd;
|
||||
public string $img;
|
||||
public string $email;
|
||||
|
||||
function __construct(int $id, string $pseudo, string $password, string $image, string $mail) {
|
||||
$this->id = $id;
|
||||
$this->username = $pseudo;
|
||||
$this->passwd = $password;
|
||||
$this->hidenPasswd = hidenPassWd($password);
|
||||
$this->img = $image;
|
||||
$this->email = $mail;
|
||||
}
|
||||
|
||||
public function updateUsername(string $newUsername){
|
||||
if(isset($newUsername)){
|
||||
$this->username = $newUsername;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateEmail(string $newEmail) {
|
||||
if(isset($newEmail)){
|
||||
$this->email = $newEmail;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function modifyImage(string $image){
|
||||
if(isset($image)){
|
||||
$u->img = $image;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$u = new User('Testeur', 'motDepasse', '../images/imageProfil.png', 'testeur.compte@wikifantasy.com'); /*Test*/
|
||||
|
||||
function hidenPassWd(string $passwd){
|
||||
if(strlen($passwd) >= 16) return str_repeat('*', 16);
|
||||
return str_repeat('*', strlen($passwd));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
Loading…
Reference in new issue