You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
648 B
PHP
28 lines
648 B
PHP
<?php
|
|
// Initialize the session
|
|
session_start();
|
|
|
|
// Check if the user is already logged in, if yes then redirect him to welcome page
|
|
if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] == false){
|
|
header("location: ../index.php");
|
|
exit;
|
|
}
|
|
|
|
// Include config file
|
|
require_once("../model/db.php");
|
|
$what = key($_POST);
|
|
|
|
$item = $_POST[$what];
|
|
|
|
$id = $_SESSION["id"];
|
|
|
|
|
|
$conn = $pdo;
|
|
try {
|
|
$sql = "UPDATE list SET rating='$item' WHERE user_id = '$id' AND beer_id = '$what'";
|
|
$stmt = $conn->prepare($sql);
|
|
$stmt->execute();
|
|
} catch (PDOException $e) {
|
|
echo "Error in list: Not Found";
|
|
}
|
|
header("location: ../beer.php?id=$what"); |