Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'masterManagers.php';
- class loginManagers extends masterManagers {
- function getLogin($aUser) {
- $statement = $this->con->prepare("SELECT * FROM login WHERE username = ? AND password = ?");
- $statement->bindValue(1, $aUser->username); $statement->bindValue(2, $aUser->password);
- $statement->execute(); return $statement->fetch(PDO::FETCH_OBJ);
- }
- function newUser($aUser) {
- $statement = $this->con->prepare("INSERT INTO login(username, password, rank) VALUES(?,?,?)");
- $statement->bindValue(1, $aUser->username); $statement->bindValue(2, $aUser->password);
- $statement->bindValue(3, $aUser->rank); $statement->execute();
- }
- function getUserById($aId) {
- $statement = $this->con->prepare("SELECT * FROM login WHERE id = ?");
- $statement->bindValue(1, $aId);
- $statement->execute();
- return $statement->fetchColumn(PDO::FETCH_OBJ);
- }
- function getIdRank($aUser){
- $statement = $this->con->prepare("SELECT id, rank FROM login WHERE username = ?");
- $statement->bindValue(1, $aUser->username); $statement->execute();
- return $statement->fetch(PDO::FETCH_NUM);
- }
- function getAll() {
- $statement = $this->con->prepare("SELECT * FROM login");
- $statement->execute();
- return $statement->fetchAll(PDO::FETCH_OBJ);
- }
- function delUser($aId) {
- $statement = $this->con->prepare("DELETE FROM login WHERE id = ?");
- $statement->bindValue(1, $aId); $statement->execute();
- header("Location: ../index.php");
- }
- function editUser($aUser) {
- $statement = $this->con->prepare("UPDATE login SET username = ? AND password = ? WHERE id = ?");
- $statement->bindValue(1, $aUser->username); $statement->bindValue(2, $aUser->password);
- $statement->bindValue(3, $aUser->id); $statement->execute();
- header("Location: ../index.php");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement