Need to eliminate GOTO in PHP script but dont know how

Posted by DomingoSL on Stack Overflow See other posts from Stack Overflow or by DomingoSL
Published on 2010-05-31T02:40:05Z Indexed on 2010/05/31 2:42 UTC
Read the original article Hit count: 393

Filed under:

Hello i have this code:

<?php
include("/LIB/error.php");
session_start();
if (isset($_POST['Submit1'])) {
if (!isset($_SESSION['token'])) {goto dale;}

    if((time() - $_SESSION['token']) < 5) {
        error('Debes esperar 5 segundos para poder enviar otra informacion.');
    } else { 
        dale:
        $_SESSION['token'] = time();
        include("/LIB/HeadSQL.php");
        include("/LIB/comprueba.php");

    }
}

?>

I want to eliminate the GOTO instruction (because as you know is supported only in the last versions of php) in order to make more compatible my code, but i really cant figure out how to change the flow of the code without the GOTO. Thanks for your help.

© Stack Overflow or respective owner

Related posts about php