www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > PHP

    PHP Discussion and technical support for using and deploying PHP based websites.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 08-24-2009, 03:35 AM
    trickyserge trickyserge is offline
    Registered User
     
    Join Date: Nov 2008
    Posts: 6
    Recursion Problem

    first of all am using CakePhp but i dont think it matters anyway
    on the index page am checking for the session but am having a redirection problem when my function checks for the session and redirects here is the code

    <?php

    $log = 0;
    $flag = 0 ;

    function index(){
    if($flag == 0)
    $this->checkSession();
    }

    function checkSession()
    {
    if (!$this->Session->check('User'))
    {
    $log = 0;
    $flag = 1;
    $this->redirect('/helps/');
    exit();
    }
    else
    $log = 1;
    $flag = 0;
    }

    ?>
    Reply With Quote
      #2  
    Old 08-24-2009, 10:11 AM
    SrWebDeveloper's Avatar
    SrWebDeveloper SrWebDeveloper is offline
    Registered User
     
    Join Date: Jul 2009
    Location: Falls Church, Va.
    Posts: 105
    I don't know anything about CakePHP, but looking at your code $flag is not a global variable, and is lost inside the scope of the function. You either need to pass $flag as an argument, create a constant which is global, or use "global $flag;" in your function so $flag is now available in the function scope. If none of these work, I cannot comment further if CakePHP changes the way PHP normally works!

    -jim
    Reply With Quote
      #3  
    Old 08-24-2009, 11:17 AM
    JunkMale's Avatar
    JunkMale JunkMale is offline
    Registered User
     
    Join Date: Jan 2009
    Location: it is nice where I live.
    Posts: 493
    And can you use forum code tags when posting, it makes reading code easier for the people who are going to help you.

    AND!!! Like I say to everyone using a helper or framework, go to the vendors site, your going to get your answer quicker.
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 12:19 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.