98 lines
3.3 KiB
PHP
98 lines
3.3 KiB
PHP
<?php
|
|
require_once 'core/classes.php';
|
|
headStart();?>
|
|
<!DOCTYPE html>
|
|
<html data-bs-theme="dark">
|
|
<head>
|
|
<?php
|
|
|
|
$placeprice = 10;
|
|
|
|
require_once 'core/classes.php';
|
|
require_once 'core/classes/user.php';
|
|
if(isset($_SESSION['user'])) {
|
|
$user = new User($con, $_SESSION['user']);
|
|
$loggedIn = true;
|
|
} else {
|
|
$loggedIn = false;
|
|
}
|
|
$getitstarted = new PartyStarter;
|
|
$getitstarted->header();
|
|
|
|
if(!isset($_GET["id"])) {
|
|
header("Location: ?id=".$_SESSION['user']);
|
|
} else {
|
|
$id = (int)$_GET["id"];
|
|
}
|
|
|
|
$q = $con->prepare("SELECT * FROM games WHERE id = :id");
|
|
$q->bindParam(':id',$id,PDO::PARAM_INT);
|
|
$q->execute();
|
|
$item = $q->fetch();
|
|
$itemUser = new User($con, $item['creator']);
|
|
if(!$item) {
|
|
header('location: /error?err=404');
|
|
exit;
|
|
}
|
|
|
|
if($item['creator'] !== $_SESSION['user']) {
|
|
header('location: /error?err=403');
|
|
exit;
|
|
}
|
|
|
|
if($loggedIn == true) {
|
|
if($_POST['submit'] ?? "No" == "Update place" || isset($_FILES['userfile']['name']) || isset($_POST['name']) || isset($_POST['description']) || isset($_POST['playerlimit']) && $_POST['playerlimit'] >= 1 ) {
|
|
$q = $con->prepare("UPDATE games SET name=:name, description=:description, creator=:creator, players=:playerlimit, state='pending' WHERE id=:placeid");
|
|
$q->bindParam(':name',$_POST['name']);
|
|
$q->bindParam(':description',$_POST['description']);
|
|
$q->bindParam(':playerlimit',$_POST['playerlimit']);
|
|
$q->bindParam(':creator',$_SESSION['user'],PDO::PARAM_INT);
|
|
$q->bindParam(':placeid',$_GET['id'],PDO::PARAM_INT);
|
|
$q->execute();
|
|
header("Location: /place?id=".$_GET['id']);
|
|
exit;
|
|
}
|
|
}
|
|
|
|
|
|
?>
|
|
</head>
|
|
<title><?php echo $pagename; ?> | <?php echo $sitename; ?></title>
|
|
<body>
|
|
<main class="container d-flex flex-column min-vh-100">
|
|
<br>
|
|
<br>
|
|
|
|
<div class="card">
|
|
<h5 class="card-header">Edit place <b><?php echo $item['name']; ?></b></h5>
|
|
<div class="card-body">
|
|
<form action="" method="post">
|
|
<div class="mb-3">
|
|
<label for="formFile" class="form-label">Roblox Place File <small>(Must be .rbxl, since .rbxlx is in xml therefore larger by default)</small></label>
|
|
<input class="form-control" type="file" name="file" id="formFile" required="">
|
|
</div>
|
|
|
|
<div class="input-group mb-3">
|
|
<span class="input-group-text" id="basic-addon1">Place name</span>
|
|
<input type="text" class="form-control" name="name" placeholder="Lorem ipsum dolor sit amet." aria-describedby="basic-addon1" required="">
|
|
</div>
|
|
|
|
<div class="input-group mb-3">
|
|
<span class="input-group-text">Description</span>
|
|
<textarea class="form-control" style="height: 6rem" required="" name="description" placeholder="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sed mauris quis enim efficitur feugiat in sodales odio. Cras vehicula consectetur tellus. Nulla aliquet nulla a libero ultricies dignissim. Nullam sollicitudin orci eu massa dignissim eleifend. Maecenas hendrerit ex odio, quis euismod arcu egestas et. Duis nibh eros, volutpat ac purus non, sodales rutrum leo. Donec tempus erat sit amet blandit accumsan. Donec vel laoreet tellus." ></textarea>
|
|
</div>
|
|
|
|
<div class="input-group flex-nowrap mb-3">
|
|
<span class="input-group-text" id="addon-wrapping">Player limit</span>
|
|
<input type="number" class="form-control" placeholder="1 to 50 players" name="playerlimit" required="">
|
|
</div>
|
|
<input type="submit" name="submit" class="btn btn-info" value="Update place">
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
<?php $getitstarted->footer(); ?>
|
|
</main>
|
|
</body>
|
|
</html>
|