-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate.php
71 lines (57 loc) · 3.19 KB
/
create.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
require_once ('vendor/autoload.php');
require_once('src/models/functions.php');
$dbCreds = databaseCredentials('.env');
$driver = new \Aternos\Model\Driver\Mysqli\Mysqli($dbCreds['host'], 3306, $dbCreds['user'], $dbCreds['password'], "", $dbCreds['database']);
\Aternos\Model\Driver\DriverRegistry::getInstance()->registerDriver($driver);
require_once ("src/models/classes/User.php");
session_start();
$userQuery = User::select(["id" => $_SESSION['authenticated']]);
if (!isset($_SESSION['authenticated'])) {
header("Location: login");
} else if ((!$userQuery[0]->roleID) > 0) {
header("Location: codes/403");
}
session_abort();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php require_once('src/models/functions.php'); echo getPageName(basename($_SERVER['PHP_SELF'])) ?></title>
<script src="https://kit.fontawesome.com/d1393c407a.js" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="stylesheet" href="src/styling/main.css">
<link rel="stylesheet" href="src/styling/articleWriter.css">
</head>
<?php include_once 'src/models/navbar.php' ?>
<body>
<div class="container">
<h1>Article writer</h1>
<form action="src/validation/articleCreate.php" method="post" class="left">
<p id="size" class="visually-hidden">what?</p>
<label for="title" class="h3">Title</label> <br>
<?php session_start(); if (isset($_SESSION['message'])) { echo $_SESSION['message'] . '<br>'; unset($_SESSION['message']);} ?>
<textarea name="title" id="title" placeholder="Why Aternos is amazing..." required></textarea> <br>
<label for="summary" class="h3">Summary</label> <br>
<textarea name="summary" id="summary" placeholder="Because Aternos is free..." required></textarea> <br>
<label for="content" class="h3">Content</label> <br>
<textarea name="content" id="content" placeholder="Its amazing because..." required></textarea> <br>
<br>
<button class="btn btn-primary" type="submit">Submit</button>
</form>
<div class="right">
<h2>Remember:</h2>
<ul>
<li>Keep it civil</li>
<li>Use proper grammar</li>
<li>No other hosts</li>
<li>Only facts</li>
<li>Use Markdown; <a href="https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax"> guide</a></li>
</ul>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
</body>
</html>