Salve, ho questi due file:
admin.php
codice:
<?php
if(!isset($_SESSION['login']))
{
header("location: login.php");
}else
{
if($_SESSION["level_access"] == 1)
{
}else
{
header("location: index.php");
}
}?>
e questa e la pagina che non vuole fungere con il controllo della sessione.
ma in tutte le altre pagine funziona tranquillamente..
ma solo in questa:
post_del.php
codice:
<?php
session_start();
include("inc.php");
include("admin.php");
include("layout/template.php");
layout_header();
?>
<?php
if(empty($_GET["id"]))
{
echo '403';
}else
{
?>
<?php
try {
$query = "select * from post where id =:id";
$stmt = $db->prepare( $query );
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if($row > 0)
{
$id = $row['id'];
}else
{
$msg = "404";
}
}catch(PDOException $exception){
echo "Error: " . $exception->getMessage();
}
?>
<?php
if(isset($error)){ echo "<p class=\"info_error\">".$error."</p>";}
if(isset($msg)){ echo $msg;} else {
?>
<?php
try {
$query = "DELETE FROM post WHERE id = :id";
$stmt = $db->prepare( $query );
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT);
if($stmt->execute())
{
header("location: post.php");
}
else
{
echo 'Error';
}
}catch(PDOException $exception){
echo "Error: " . $exception->getMessage();
}
?>
<?php
}
}
layout_footer();
?>
idea perché questa pagina non prende bene il controllo dell'admin?
grazie mille,
e buona serata.