weixin_33736649 2014-09-12 11:33 采纳率: 0%
浏览 14

URL安全PHP / Ajax

I'm working on this application that reads confidential documents stored in the Blob of my Oracle 11g Database. What I have implemented so far is a php page that queries for all available blobs in the table and prints href's like this:

<html>
<head>
</head>
<body>
<?php
$i = 1;
echo "Welcome User!</br>";
$conn = OCILogon("abc","abc","abc_server");
$qry = "select id from some_table order by ID";
$stmt = ociparse ($conn,$qry);

OCIDefineByName($stmt,"ID",$id);

OCIExecute($stmt);

while ( $row = OCI_Fetch_Array($stmt, OCI_ASSOC+OCI_RETURN_LOBS) ) {

print "<a href = 'readMe.php?id=$id' target='_blank'>Document $i</a></br>";
$i = $i+1;
}
?>
</body>
</html>

readMe.php

<?php
session_start();


$id = $_GET[id];
$conn = OCILogon("abc","abc","abc_server");

$qry = "select doc_file,doc_name from some_table where ID =".$id;

//echo $qry;

$stmt = ociparse ($conn,$qry);

OCIDefineByName($stmt,"DOC_FILE",$blobFile);
OCIDefineByName($stmt,"DOC_NAME",$blobFileName);

OCIExecute($stmt);

while ($row = OCI_Fetch_Array($stmt, OCI_ASSOC+OCI_RETURN_LOBS)) 
{
$a = $row['DOC_FILE'];
}
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $blobFileName . '"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
print $a;
?>

The problem is that it produces this URL:

http://999.999.999.888/Some_work/ReadBlob/readMe.php?id=47

That is, the ID of every document in the browser. How can I avoid this? I tried using $_POST but it didn't open the document. ANy help would be highly appreciated.

  • 写回答

0条回答 默认 最新

      报告相同问题?

      悬赏问题

      • ¥80 关于海信电视聚好看安装应用的问题
      • ¥15 vue引入sdk后的回调问题
      • ¥15 求一个智能家居控制的代码
      • ¥15 ad软件 pcb布线pcb规则约束编辑器where the object matpcb布线pcb规则约束编辑器where the object matchs怎么没有+15v只有no net
      • ¥15 虚拟机vmnet8 nat模式可以ping通主机,主机也能ping通虚拟机,但是vmnet8一直未识别怎么解决,其次诊断结果就是默认网关不可用
      • ¥20 求各位能用我能理解的话回答超级简单的一些问题
      • ¥15 yolov5双目识别输出坐标代码报错
      • ¥15 这个代码有什么语法错误
      • ¥15 给予STM32按键中断与串口通信
      • ¥15 使用QT实现can通信