tawevolution Posted November 1, 2006 Share Posted November 1, 2006 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 More sharing options...
Orio Posted November 1, 2006 Share Posted November 1, 2006 Try this:[code]<?phpif(isset($_COOKIE['auth']) && $_COOKIE['auth']=="ok") include("admin_sidebar.php");else include("sidebar.php");exit;?>[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/25835-cookies-file-includes/#findComment-117980 Share on other sites More sharing options...
tawevolution Posted November 2, 2006 Author Share Posted November 2, 2006 ah, but this wont work is I want the included file 1/2 way down the page. will it? Link to comment https://forums.phpfreaks.com/topic/25835-cookies-file-includes/#findComment-118361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.