This repository has been archived on 2021-12-22. You can view files and clone it, but cannot push or open issues or pull requests.
blog-legacy/views/write.php

31 lines
1.0 KiB
PHP

<?php
if(isset($_POST["writeSubmit"])){
include_once("lib/users.php");
$user = isValid($_POST['login'], $_POST['password']);
if($user){
include_once("lib/articles.php");
if(newArticle($_POST["title"], $_POST["description"], $user, $_POST["content"]))
$content = "Article successfuly sent !";
else
$content = "We are unable to send your article !";
}else{
$content = "Not a valid user !";
}
}else
$content = "<form action=\"\" method=\"POST\">
<label for=\"title\">Title</label>
<input type=\"text\" name=\"title\" id=\"title\" /><br />
<label for=\"description\">Description</label>
<textarea name=\"description\" id=\"description\"></textarea><br />
<label for=\"content\">Content</label>
<textarea name=\"content\" id=\"content\"></textarea><br />
<label for=\"login\">Login</label>
<input type=\"text\" name=\"login\" id=\"login\" /><br />
<label for=\"password\">Password</label>
<input type=\"password\" name=\"password\" id=\"password\" /><br />
<input type=\"submit\" name=\"writeSubmit\" />
</form>";