任何使用PHP隐藏或加密URL的原因

时间:2014-02-03 17:13:51

标签: php

我使用下面的代码打开一个窗口,然后从该窗口捕获照片,但我的代码显示地址栏中的完整URL,这是一个安全漏洞。我该如何处理这个问题,请给出一些建议/指导。 newenquiry.tpl.php 文件中的代码Java脚本

<script type="text/javascript">
function popup_letter(url) {
         var width  = 700;
         var height = 450;
         var left   = (screen.width  - width)/2;
         var top    = (screen.height - height)/2;
         var params = 'width='+width+', height='+height;
         params += ', top='+top+', left='+left;
         params += ', directories=no';
         params += ', location=no';
         params += ', menubar=no';
         params += ', resizable=no';
         params += ', scrollbars=no';
         params += ', status=no';
         params += ', toolbar=no';
         newwin=window.open(url,'windowname5', params);
         if (window.focus) {
             newwin.focus()
         }
     return false;
}

相同文件中激活上述JS的代码newenquiry.tpl.php

<td>Take Instant Photo<!--<a href="capture.php" target="blank"><img src="images/capture35.png" title="Capture Image"></a> ?pid=117&action=print_bonafiedcertificate&id  -->

    <a href="javascript:void(0)" onclick="popup_letter('?pid=8&action=print_bonafiedcertificate')" ><img src="images/capture35.png" name="capture" title="Capture Image" border="0" alt="Capture Photo" /></a>

    </td>

此代码位于 newenquiry.inc.php ,我在其中调用包含捕获图像代码的文件 -

if($action=='print_bonafiedcertificate'){
    header("Location:capture.php");
    exit();
//echo '<META HTTP-EQUIV="Refresh" Content="0; URL=capture.php">';
//include_once('capture.php');  
}
else{
$es_enquiry = new es_enquiry();
if($Submit == 'Submit')
{
  $vlc    = new FormValidation();   
  if (empty($_POST['reg_no'])) {
  :
  :

请给出一些方法来解决这个问题

1 个答案:

答案 0 :(得分:0)

通常有很多方法可以捕获URL,例如集成在浏览器中的一些开发人员工具,Tamper数据(Firefox扩展)等等。你不应该依赖它(出于安全原因)。

如果某些用户只能使用该URL,则应在此页面上验证身份验证。

如果每次付款时应使用一次URL,则可以使用一次性票证。

如果不符合您的具体情况,请说明您的需求。