prepare('SELECT cc.*, c.title, c.content FROM client_contracts cc JOIN contracts c ON cc.contract_id = c.id WHERE cc.id = ?'); $stmt->execute([$client_contract_id]); $contract = $stmt->fetch(); if (!$contract) { die('Contract not found.'); } if ($_SESSION['user_type'] === 'client' && $contract['client_id'] !== $_SESSION['user_id']) { die('Access denied.'); } if ($_SESSION['user_type'] === 'coach') { // A coach can see any contract, for now. In a real app, you would check if the client belongs to the coach. } ?>
Signed on
The contract has not been signed yet.