Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    TrainReq
    Guest

    session check/query

    How do i make it to where if(empty($_SESSION['id'])) , run the following code:
    PHP Code:
    if($_SERVER['HTTP_REFERER'] =="http://www.site.com"){
    CODE
    }else{
    header("location: http://google.com");


  • #2
    New Coder
    Join Date
    Aug 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if (!isset($_SESSION['id'])) {
    code to run is session isn't set.
    }

  • #3
    TrainReq
    Guest
    doesn't work... it runs the query regardless rather/rather not the session is set

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,066
    Thanks
    2
    Thanked 319 Times in 311 Posts
    It is likely that sessions are not configured or are not working. Either check your web server log for errors or put the following two lines in after your first opening <?php tag in each file that you have -
    PHP Code:
    ini_set ("display_errors""1");
    error_reporting(E_ALL); 
    Also, if this code is checking for $_SESSION['id'], are you sure that it is being set. Posting your actual code will also help anyone help you find out why it is not working.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •