note 129956 added to reserved.variables.server
| From: | naglpaul417@gmail.com | Date: | Fri, 10 Jan 2025 10:33:33 +0000 |
| Subject: | note 129956 added to reserved.variables.server | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221769@lists.php.net to get a copy of this message | ||
<?php
$dsn = 'mysql:host=mysql;dbname=trackstar';
$user = 'root';
$password = 'htlkrems';
try {
$dbh = new PDO($dsn, $user, $password);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//Ich hole mir alle Issues aus der Datenbank, wenn ich ein neues Issue erstellen will (egal,
ob Cancel oder Save)
//Wenn mittels 'delete' die jeweilige project_id reinkommt, lösche ich genau
diesen Eintrag
if(isset($_GET['delete'])){
$del = $dbh->prepare("DELETE FROM projects WHERE project_id = :id");
$del->bindParam(':id', $_GET['delete']);
$del->execute();
$countDeletedRows = $del->rowCount();
}
//überprüfe ich, ob der save button auch wirklich gedrückt wurde, wenn //nicht
erstelle ich es nicht
if(isset($_GET['submit'])){
if($_GET['submit'] == "save"){
$current = date("Y-m-d H:i:s");
$create = $dbh->prepare("INSERT INTO issues (category, description,
created_at, project_id) VALUES (:category, :description, :created_at, :project_id)");
$create->bindParam(':category', $_GET['category']);
$create->bindParam(':description', $_GET['description']);
$create->bindParam(':created_at', $current);
$create->bindParam(':project_id',
$_GET['newIssueProjectId']);
$create->execute();
}
if($_GET['submit'] == "update"){
$current = date("Y-m-d H:i:s");
$create = $dbh->prepare("UPDATE projects SET title = :title, description =
:description WHERE project_id = :updatedProject");
$create->bindParam(':title', $_GET['title']);
$create->bindParam(':description', $_GET['description']);
$create->bindParam(':updatedProject',
$_GET['updatedProject']);
$create->execute();
}
}
$sth = $dbh->query("SELECT * FROM projects");
$projects = $sth->fetchAll(PDO::FETCH_ASSOC);
#$sth->execute();
#var_dump($projects);
} catch (PDOException $e) {
echo 'Verbindung fehlgeschlagen: ' . $e->getMessage();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Trackstar Project</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous">
</head>
<body>
<div class="container bg-light vh-100 d-flex align-items-center
justify-content-center">
<div class="row d-flex">
<div class="col-12">
<h1 class="text-secondary">Ihre Einträge</h1>
</div>
<div class="col-12">
<!--Tabelle für die Projekte habe ich erstellt-->
<table class="table table-striped border border-dark">
<thead class="bg-light">
<tr>
<th scope="col">project_id</th>
<th scope="col">title</th>
<th scope="col">description</th>
<th scope="col">created_at</th>
<th scope="col">user_id</th>
<th scope="col">issues</th>
<th scope="col">delete</th>
<th scope="col">update</th>
</tr>
</thead>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 193.170.70.27)
----
Manual Page -- https://php.net/manual/en/reserved.variables.server.php
Edit -- https://main.php.net/note/edit/129956
Del: integrated -- https://main.php.net/note/delete/129956/integrated
Del: useless -- https://main.php.net/note/delete/129956/useless
Del: bad code -- https://main.php.net/note/delete/129956/bad+code
Del: spam -- https://main.php.net/note/delete/129956/spam
Del: non-english -- https://main.php.net/note/delete/129956/non-english
Del: in docs -- https://main.php.net/note/delete/129956/in+docs
Del: other reasons-- https://main.php.net/note/delete/129956
Reject -- https://main.php.net/note/reject/129956
Search -- https://main.php.net/manage/user-notes.php