Confirm which contract to open

Asked

Viewed 48 times

1

Opa galera I need help, I have the login system done already and I already have a couple registered users, I want each user to have a contract that in case I already have the two contracts digitized, I want that when the fulanodetal user see the contrato1 and fulanodetal2 see the contrato2

My code is

<?php
session_start();
include('verifica_login.php');
?>

<h2>Olá, <?php echo $_SESSION['usuario'];?></h2>

<h2><a href="logout.php">Sair</a></h2>

I have a folder called Contracts I want each user to have access to his contract in word or pdf, each user will have equal contract name of the user will only be able to access if he is logged in, do not know how to make the confirmation by the panel to verify that the user.doc is equal that is logged in the panel.php

  • saved the contract with an identifier for each user, for example, fulanodetal.pdf is easy to identify, does not mean q is the most correct but functional form

  • But the panel can not put this because it will be in the same contract the two users

  • Example panel it takes the user who is logged in and hits the information that is in the panel

  • then it is a contract for each or one for all?

  • For each user is a different contract

  • Why the contract is already ready I just need the customer when you want to see the contract he enter by the login of it

  • is what I said then: Usuario1 has Contrato1.pdf Usuario2 has Contrato2.pdf

  • This is just what I need to confirm so I don’t know how to confirm in the.php panel

  • I want the user1 to appear when logged in to the.php panel

  • If you can direct the user to another php confirming user to select contracts

  • Or put the name of the contract in the userName in the user.doc case and then make a check that the user name is compatible with the document name if it neither enters nor error

  • That’s right I’m telling you, put the file name with something that is unique to the user so you can check

  • Have some example of check on top of the panel?

  • I couldn’t find a way to validate if you could help me

Show 9 more comments

1 answer

0


Complete code

<!DOCTYPE html> 
<html>
<head>
<title>Contrato</title>
</head>

</html>


<?php
session_start();
include('verifica_login.php');
include('conexao.php');
if($_SESSION['cpf']){

    $download = $_GET['download'];
    if( is_file( 'Contratos/'.$download)){
        $filename = 'Contratos/'.$download;

        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        $type = finfo_file($finfo, $filename);
        header('Content-type: '.$type);
        readfile($filename);
    }else{
        echo "arquivo nao encontrado";
    }

}else{
    echo "Você não está logado. Faça o login para efetuar o download.";
}

?>

So it worked using inside meucontrato.php

> <a href="download.php?download=<?php echo
> $_SESSION['documentopdf']?>.pdf"><b>Abrir meu Contrato</b></a>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.