<?php
class osc extends SQLite3 {
function __construct() {
$this->open("./sql/oscop.db");
}
}
$db = new osc();
if (isset($_POST[\'submit\'])) {
$id = rand();
$title = $_POST[\'title\'];
$content = $_POST[\'content\'];
$sql = "INSERT INTO art(id, title, content) VALUES(\'".$id."\', \'".$title."\', \'".$content."\') ";
if (empty($title)) {
echo "<script>alert(\'maaf tidak boleh kosong\'); </script>";
header("Location: ./create.php");
} else {
$query = $db->exec($sql);
}
if (!empty($query)) {
header(\'Location: ./index.php\');
echo "<script>console.log(\'success\'); </script>";
} else {
echo $db->lastErrorMsg();
echo "<script>console.log(\'error\'); </script>";
}
}
?>