amars Posted January 6, 2011 Share Posted January 6, 2011 is there anything wrong with this statement: it just won't execute: session_start(); if ($_SESSION['dstatus']==F) { header("Location: http://www.orgpict.com/downloadform.php"); exit; } Quote Link to comment https://forums.phpfreaks.com/topic/223575-is-this-statement-correct/ Share on other sites More sharing options...
Pikachu2000 Posted January 6, 2011 Share Posted January 6, 2011 If you're trying to see if the sessin var is a boolean FALSE, use === FALSE, if you want to see if its value is the string 'F', use == 'F' Quote Link to comment https://forums.phpfreaks.com/topic/223575-is-this-statement-correct/#findComment-1155680 Share on other sites More sharing options...
amars Posted January 6, 2011 Author Share Posted January 6, 2011 yes. i want to check if it's string 'F'. But for some reason session variables don't seem to be accessible on this page. It's the same domain with only a minor change. i started my sessions here: http://domain.com/downloads.php this is the page i land on from above: http://domain.com/dcheck.php?file=2_fcf.xls will the session be lost because of this? Quote Link to comment https://forums.phpfreaks.com/topic/223575-is-this-statement-correct/#findComment-1155685 Share on other sites More sharing options...
denno020 Posted January 6, 2011 Share Posted January 6, 2011 as Pikachu2000, you need to wrap F in quotes, single or double, your choice. Just so long as session_start() is on every page that you want session variables, then they will work while the browser is kept open.. Denno Quote Link to comment https://forums.phpfreaks.com/topic/223575-is-this-statement-correct/#findComment-1155688 Share on other sites More sharing options...
Maq Posted January 6, 2011 Share Posted January 6, 2011 yes. i want to check if it's string 'F'. But for some reason session variables don't seem to be accessible on this page. It's the same domain with only a minor change. i started my sessions here: http://domain.com/downloads.php this is the page i land on from above: http://domain.com/dcheck.php?file=2_fcf.xls will the session be lost because of this? As long as you have session_start on each page it should exist. Did you change it to read 'F'? Try echoing out your session variable to see what the value actually is. If you ever receive a blank page, try turning on error reporting by placing these 2 lines directly after your opening <?php tag: ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/223575-is-this-statement-correct/#findComment-1155689 Share on other sites More sharing options...
amars Posted January 6, 2011 Author Share Posted January 6, 2011 My bad. I didn't put the single quotes. Thanks for pointing that out. But my problem stem from a different place. I found this posted here: http://php.net/manual/en/book.session.php "Variations from Http://, Https:// and http://www. will throw off session data." and indeed, this page was missing the www so session vars were inaccessible. Thanks for all your help guys. Quote Link to comment https://forums.phpfreaks.com/topic/223575-is-this-statement-correct/#findComment-1155694 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.