Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Posts posted by Lamez

  1. I am working on timed session for my project. So they have X minuets per pages to indicate some activity before the systems logs them out. Here is how I am going about this:

     

    At the login function: set time limit, store session time in a session variable.

     

    In main.php (included on every page): check time with expiredTime() function

     

    if this returns false, then call the updateTime() function, else logout.

     

    Here are my functions:

    function startTime($min){ //Starts the time clock (TC), should only be used in the loginAdmin and updateTime functions.
    $min *= 60;
    if(!isset($_SESSION['~TC:Min']) || $_SESSION['~TC:Min'] != $min)
    	$_SESSION['~TC:Min'] = $min;
    
    $_SESSION['~TC:Time'] = time() + $_SESSION['~TC:Min'];
    }
    function updateTime(){
    startTime($_SESSION['~TC:Min']); //No need to do the same thing twice. Resets the clock per page.
    }
    function expriedTime(){//True if time has expired; false otherwise.
     return time() > $_SESSION['~TC:Time'];
    }
    

  2. I have no idea where the error is.

     

    Here is the compiler error:

    Parse error: syntax error, unexpected T_INC, expecting ')' in C:\wamp\www\core\functions.php on line 336

     

    Here is line 336:

    for($i = 1; $i<$max; i++){

     

    Here is the entire function:

    function getPageList($max){
    $pageList = "";
    for($i = 1; $i<$max; i++){
    	$pageList .= '<a href="?page='.$i.'">Page '.$i.'</a>';
    	if($i > 1 && $i != $max)
    		$pageList .= ' | ';
    }
    return $pageList;		
    }

  3. I include it twice because when $footer = true then shows the footer. I got to thinking though, I could include it once then write a function. what it really does is call the footer include file.

     

    I think the getHomeValue pulls content from the DB, can't remember.

  4. As that may be true, it still does not matter what order they are in. The expression is evaluated as a whole.

     

     

    true || false = true

    false || false = false

    false || true = true

    true || true = true

     

    I don't see why the order they are called matters.

     

×
×
  • 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.