Jump to content

cookies + file includes


tawevolution

Recommended Posts

Hey. What I am looking to do is if you have a cookie called "auth" with the contents "ok", then I want a file to be included called admin_sidebar.php, otherwise I want just sidebar.php to be included in the page.

This is what I have so far, but it doesnt seem to work (lets say I have already got the cookie)

[code]<?php
$auth = $_COOKIE['auth'];

header("Cache-Control:no-cache");

if( ! $auth == "ok" )
{
    $fileinclude = "sidebar.php";

}else{
              $fileinclude = "admin_sidebar.php";
              exit();
            }
?>[/code]

This is at the very top of the page (so no white space or anything). Any ideas (or other alternatives to see if a cookie says ok, if it does include admin_sidebar.php down the page, if not sidebar.php)

Evo
Link to comment
https://forums.phpfreaks.com/topic/25835-cookies-file-includes/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.