redirect after submit
parent
a008fca80a
commit
2065845939
|
@ -9,56 +9,62 @@ $id=$_GET['id'];
|
|||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>ThreadR - Boards</title>
|
||||
%STYLESHEET%
|
||||
<link rel="icon" type="image/png" href="%CONTENT_DIR%/img/favicon-32x32.png" sizes="32x32" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
<body>
|
||||
%NAVBAR%
|
||||
<div class="container">
|
||||
<div class="item-1">
|
||||
<h1><center>
|
||||
<?php
|
||||
$pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
|
||||
$error = false;
|
||||
$error_message = "";
|
||||
if (!$error) {
|
||||
$statement = $pdo->prepare("SELECT * FROM boards WHERE id=:id");
|
||||
$statement->execute(array("id"=>$id));
|
||||
$result = $statement->fetch();
|
||||
echo $result['name'];
|
||||
}
|
||||
if (!$result) {
|
||||
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
|
||||
}
|
||||
?>
|
||||
<head>
|
||||
<title>ThreadR - Boards</title>
|
||||
%STYLESHEET%
|
||||
<link rel="icon" type="image/png" href="%CONTENT_DIR%/img/favicon-32x32.png" sizes="32x32" />
|
||||
<?php
|
||||
if ($_GET['action']=='submit') {
|
||||
echo "<meta http-equiv='refresh' content='5;URL=%CONTENT_DIR%/board/?id=$id' name='viewport' content='width=device-width, initial-scale=1.0' />";
|
||||
} else {
|
||||
echo "<meta name='viewport' content='width=device-width, initial-scale=1.0' />"
|
||||
}
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
%NAVBAR%
|
||||
<div class="container">
|
||||
<div class="item-1">
|
||||
<h1><center>
|
||||
<?php
|
||||
$pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
|
||||
$error = false;
|
||||
$error_message = "";
|
||||
if (!$error) {
|
||||
$statement = $pdo->prepare("SELECT * FROM boards WHERE id=:id");
|
||||
$statement->execute(array("id"=>$id));
|
||||
$result = $statement->fetch();
|
||||
echo $result['name'];
|
||||
}
|
||||
if (!$result) {
|
||||
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
|
||||
}
|
||||
?>
|
||||
</center></h1>
|
||||
</div>
|
||||
<div class="item-2">
|
||||
<?php
|
||||
include("./board.php");
|
||||
?>
|
||||
</div>
|
||||
<div class="item-3">
|
||||
<?php
|
||||
if(isset($_GET['action'])) {
|
||||
if($_GET['action']=='post') {
|
||||
include("./post.php");
|
||||
} elseif($_GET['action']=='submit') {
|
||||
$user_id=$_SESSION[user_id];
|
||||
$title=$_POST['title'];
|
||||
$content=$_POST['content'];
|
||||
include("./submit.php");
|
||||
} elseif($_GET['action']=='edit') {
|
||||
include("./edit.php");
|
||||
}
|
||||
} else {
|
||||
include("./default.php");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<div class="item-2">
|
||||
<?php
|
||||
include("./board.php");
|
||||
?>
|
||||
</div>
|
||||
<div class="item-3">
|
||||
<?php
|
||||
if(isset($_GET['action'])) {
|
||||
if($_GET['action']=='post') {
|
||||
include("./post.php");
|
||||
} elseif($_GET['action']=='submit') {
|
||||
$user_id=$_SESSION[user_id];
|
||||
$title=$_POST['title'];
|
||||
$content=$_POST['content'];
|
||||
include("./submit.php");
|
||||
} elseif($_GET['action']=='edit') {
|
||||
include("./edit.php");
|
||||
}
|
||||
} else {
|
||||
include("./default.php");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue