我一直在网上查看关于加密网址中id的解决方案的文章.我已经尝试过基本的编码解码,但是我在下一页解码它时遇到的问题我做了一个选择,其中id = decode id.它不会从表中获取正确的用户.
我的链接:
My link:
<a href="sendContract.inc.php?id=<?php echo
encrypt($customer_id) ?>"> View Contract </a>
Run Code Online (Sandbox Code Playgroud)
sendContract.inc.php页面:
$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."'
";
Run Code Online (Sandbox Code Playgroud)
更新:现在我理解需要使用的urlencode,它可以在URL中正常工作.该页面显示客户合同.它只对他们来说是独一无二的.合同链接通过电子邮件发送,该电子邮件只是与其customer_id的链接(现在已对其进行编码,解码).我想知道我还能做些什么来保护他们的链接和信息?合同在链接中显示为PDF(使用tcpdf).