Block a user if another user is already inside

0

I have a website, which is already finished, but in one of the sections I need to limit the entry to only one user, that is, when there is one user inside that section, no other user can enter it until the first one entered. has left.

As I have seen, this can be done with traffic lights , but I can not find a clear way to solve my problem.

I leave here a fragment of the code.

<td class="ColIzq">
    <?if($permisos->escritura && $ult_est['id']!='1' && $ult_est['id']!='5'){?>     
        <?
            $ListOpe = new ListaOperadores();
            $id_op_csme = $ListOpe->operador_csme($_SESSION['usuario_login']);
            $semaphore_max = 1;
            $semaphore_perm = 0666;
            $semaphore_autorelease = 1;
            $nowait = true;

            $sem_id = sem_get($id_op_csme, $semaphore_max, $semaphore_perm, $semaphore_autorelease);
        ?>

        <?if(sem_acquire($sem_id, $nowait)){?>
            <a href="<?echo $appDir."/Llamadas/_wf_incidencia.php"?>?<?php echo 'id_sede='.$Sede->get_Id().'&id_inc='.$var->Incidencia->get_Id(); ?>" ><input type="button" value="&nbsp;<?_translate("Nueva actuaci&oacute;n")?>&nbsp;" /></a>
        <?}else{?>
            <a href="<?echo $appDir."/Llamadas/_wf_incidencia.php"?>?<?php echo 'id_sede='.$Sede->get_Id().'&id_inc='.$var->Incidencia->get_Id(); ?>" ><input type="button" onclick="simperform()" value="&nbsp;<?_translate("Nueva actuaci&oacute;n")?>&nbsp;" /></a>
        <?}?>

The idea is that when someone is inside that button called New Acting no one else can enter.

    
asked by Angel Arias 31.10.2018 в 13:05
source

0 answers