Fix MOTD
It now won't require there to be at least one entry in the motd table. I also tidied up the motd class
This commit is contained in:
@@ -54,7 +54,7 @@ $motd = $motdfetcher->getMOTD();
|
||||
<input type="text" name="title" value="<?= $motd['title'] ?>" class="boxinput" style="width:66%;"><br>
|
||||
|
||||
<p class="subtitle no-chin">Innhold</p>
|
||||
<textarea name="content" style="width:100%" rows="8" class="boxinput"><?= implode($motd["content"], "\n") ?></textarea>
|
||||
<textarea name="content" style="width:100%" rows="8" class="boxinput"><?= implode("\n", $motd["content"]) ?></textarea>
|
||||
|
||||
<div style="margin-top: 2em;">
|
||||
<hr class="ruler">
|
||||
@@ -63,4 +63,6 @@ $motd = $motdfetcher->getMOTD();
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
||||
</body>
|
||||
|
||||
<?php print_r($motd); ?>
|
||||
|
@@ -25,15 +25,11 @@ if(!$userManager->isAdmin($uname)){
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = 'UPDATE motd SET title=:title, content=:content';
|
||||
$statement = $pdo->prepare($query);
|
||||
|
||||
$statement->bindParam(':title', $_POST['title'], PDO::PARAM_STR);
|
||||
$statement->bindParam(':content', $_POST['content'], PDO::PARAM_STR);
|
||||
|
||||
$statement->execute();
|
||||
$motdfetcher = new \pvv\side\MOTD($pdo);
|
||||
$motdfetcher->setMOTD($_POST['title'], $_POST['content']);
|
||||
|
||||
header('Location: .');
|
||||
?>
|
||||
|
||||
<a href=".">Om du ikke ble automatisk omdirigert tilbake klikk her</a>
|
||||
<a href=".">Om du ikke ble automatisk omdirigert tilbake klikk her</a>
|
||||
|
Reference in New Issue
Block a user