Example #1
0
<?php

require_once "authenticate.php";
require_once "response_get_by_id.php";
require_once "correct_user.php";
$info = get_info_res($_GET['id']);
correct_user($info['user_id']);
try {
    $dbh = new PDO('mysql:host=localhost;
    	dbname=textboard', 'admin', 'CCJYzgrbN0qsIsOa');
} catch (PDOException $e) {
    var_dump($e->getMessage());
    exit;
}
$stmt = $dbh->prepare("DELETE FROM responses WHERE id = :id");
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT);
$result = $stmt->execute();
if ($result) {
    $url = "/3ch/board.php?id=" . $info['thread_id'];
    header("Location: " . $url);
} else {
    echo "Error occured";
}
Example #2
0
<?php

require_once "authenticate.php";
require_once "response_get_by_id.php";
require_once "correct_user.php";
$result = get_info_res($_GET['id']);
correct_user($result['user_id']);
?>

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Edit Text</title>
	<link href="/3ch/stylesheets/reset.css" rel="stylesheet">
	<link href="/3ch/stylesheets/common.css" rel="stylesheet">
</head>
<body>
	<div class="header">
		<button type="button" onclick="location.href='/3ch/logout.php'">Log out</button>
		</br>
		++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</br>
	</div>

	<div class="content">
		<form action="response_edit_do.php" method="post">
			Currently:<?php 
echo $result['text'];
?>
</br>
		     New   :</br>
Example #3
0
<?php

require_once "authenticate.php";
require_once "response_get_by_id.php";
require_once "correct_user.php";
$info = get_info_res($_POST['response_id']);
correct_user($info['user_id']);
var_dump($info['user_id']);
try {
    $dbh = new PDO('mysql:host=localhost;
    	dbname=textboard', 'admin', 'CCJYzgrbN0qsIsOa');
} catch (PDOException $e) {
    var_dump($e->getMessage());
    exit;
}
$stmt = $dbh->prepare("UPDATE responses SET text = :text WHERE id = :id");
$stmt->bindParam(':id', $_POST['response_id'], PDO::PARAM_INT);
$stmt->bindParam(':text', $_POST['text'], PDO::PARAM_STR);
$result = $stmt->execute();
if ($result) {
    $url = "/3ch/board.php?id=" . $info['thread_id'];
    header("Location: " . $url);
} else {
    echo "Error occured";
}