changed config.php and added delete function for administrator
This commit is contained in:
parent
99535db4ee
commit
a121e53503
10 changed files with 21 additions and 20 deletions
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
$heading = "Delete";
|
||||
$username = "MatheApp";
|
||||
$password = "password";
|
||||
$config = require('config.php');
|
||||
$db = new Database($config['database'], $username, $password);
|
||||
$db = new Database($config['database'], $config['username'], $config['password']);
|
||||
|
||||
session_start();
|
||||
$db->delete($_SESSION['username']);
|
||||
|
|
|
|||
9
controllers/deleteUser.php
Normal file
9
controllers/deleteUser.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
$config = require('config.php');
|
||||
$db = new Database($config['database'], $config['username'], $config['password']);
|
||||
|
||||
session_start();
|
||||
if (isset($_POST['delete'])){
|
||||
$db->delete($_POST['username']);
|
||||
header("Location: /profile");
|
||||
}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
$heading = "Game";
|
||||
$username = 'MatheApp';
|
||||
$password = 'password';
|
||||
$config = require('config.php');
|
||||
$db = new Database($config['database'], $username, $password);
|
||||
$db = new Database($config['database'], $config['username'], $config['password']);
|
||||
session_start();
|
||||
if(!isset($_SESSION["username"])){
|
||||
header("Location: /");
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
$heading = "Login";
|
||||
$username = "MatheApp";
|
||||
$password = "password";
|
||||
$config = require('config.php');
|
||||
$db = new Database($config['database'], $username, $password);
|
||||
$db = new Database($config['database'], $config['username'], $config['password']);
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
$db->login([$_POST["username"], $_POST["password"]]);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
$heading = "profile";
|
||||
$username = "MatheApp";
|
||||
$password = "password";
|
||||
$config = require('config.php');
|
||||
$db = new Database($config['database'], $username, $password);
|
||||
$db = new Database($config['database'], $config['username'], $config['password']);
|
||||
|
||||
session_start();
|
||||
if(!isset($_SESSION["username"])){
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
<?php
|
||||
$heading = "Register";
|
||||
require 'Validator.php';
|
||||
$username = 'MatheApp';
|
||||
$password = 'password';
|
||||
$config = require('config.php');
|
||||
$db = new Database($config['database'], $username, $password);
|
||||
$db = new Database($config['database'], $config['username'], $config['password']);
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
$db->register($_POST);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
$username = 'MatheApp';
|
||||
$password = 'password';
|
||||
$config = require('config.php');
|
||||
$db = new Database($config['database'], $username, $password);
|
||||
$db = new Database($config['database'], $config['username'], $config['password']);
|
||||
$data = json_decode(file_get_contents("php://input"), true);
|
||||
$db->query("UPDATE user SET level= :level, xp= :xp, coins= :coins WHERE username = :user", [
|
||||
"level" => $data["level"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue