<?php include_once "../class/User.php"; $regUser = new User(); $usname = $_GET["regUname"]; $paword = $_GET["regPass"]; $firstName = $_GET["regFname"]; $lastName = $_GET["regLname"]; $position = $_GET["regPosition"]; $stat = $_GET["regStatus"]; if ($stat == "ผู้ดูแลระบบ") { $stat = "Administrator"; $regUser->setValues($usname, $paword, $firstName, $lastName, $position, $stat); $regUser->addUser(); } else { if ($stat == "เจ้าหน้าที่พัสดุ") { $stat = "Officer"; $regUser->setValues($usname, $paword, $firstName, $lastName, $position, $stat); $regUser->addUser(); } else { } }
//** CoddingDate : 13/08/2556 //** Credit : นัฐวุฒิ เผือกทอง //****************************************************************// //****************************************************************// //*************** Check Session **************** session_start(); include_once "../class/User.php"; $user = new User(); if (!$user->getSession()) { header("location: ../page/main.php"); } //********************************************** include_once "../class/User.php"; $updateUser = new User(); $userId = $_GET["userId"]; $firstName = $_GET["upFname"]; $lastName = $_GET["upLname"]; $position = $_GET["upPosition"]; $stat = $_GET["upStatus"]; if ($stat == "1") { $stat = "Administrator"; $updateUser->setValues(null, null, $firstName, $lastName, $position, $stat); $updateUser->editUser($userId); } else { if ($stat == "2") { $stat = "Officer"; $updateUser->setValues(null, null, $firstName, $lastName, $position, $stat); $updateUser->editUser($userId); } else { } }
class User { protected $login; protected $password; protected $email; protected $rating = 0; protected $isLogged; public function login() { echo "You Logged in"; $this->isLogged = true; } public function logout() { echo "You Logged out"; $this->isLogged = false; } public function setValues($l, $p, $e, $r) { $this->login = $l; $this->password = $p; $this->email = $e; $this->rating = $r; } } $john = new User(); $john->setValues('John', '123', '*****@*****.**', '10'); $mike = clone $john; $mike->setValues('Mike', '456', '*****@*****.**', '9'); var_dump($john == $mike);