I've been looking at articles online about solutions to encrypting id's in a url. I've tried the basic encode decode but the problem i'm having when decoding it on the next page where I do a select where id = decoded id. It won't grab the proper user still from the table.
My link:
My link:
<a href="sendContract.inc.php?id=<?php echo
encrypt($customer_id) ?>"> View Contract </a>
sendContract.inc.php page:
$customer_id = $_GET['id'];
$decryped_id = base64_decode($customer_id);
$sql = "SELECT *
FROM bookings
LEFT JOIN customers
USING (customer_id)
WHERE customer_id = '".$decryped_id."'
";
UPDATE: Now that I understand to that urlencode needed to be used, it works in the URL properly. The page is displaying a customers contract. And it's only unique to them. The contract link gets sent by email which is just a link with their customer_id (which is now encoded, decoded). I'm wondering what else can I do to secure their link and info? The contract is displayed as a PDF in the link (using tcpdf).