dongmei8071 2018-11-02 14:38
浏览 41

如何防止在javascript中暴露值? [重复]

I need a small help, We have an external javascript file where we are calling our PHP API through ajax but the problem is its all exposed via right-click on website and anyone can see our API and all the parameters we are passing so anyone can see and call API and might change our system.

Is there any way we can protect so only our code only run our PHP API not outside or we can hide this calling procedure of ajax in js.

Hope to be able to explain my point. If anything is unclear please let me know I will try to example again.

Example

UpdatingPaymentAPi.php

 <?php
   $_REQUEST['CustomerId'];
   $_Request['amount'];
   $_Request['purchaseCurrency'];

   //here we will do process


?>

Js file

  $.ajax({
   url:"UpdatingPaymentAPi.php",
   type:post,
    data:{CustomerId:1,Amount:100,PurchaseCurrency:1},
    success:function(response){
    }

  });

so here API can see in source code user can see api name and all paramters and can call externally hope you are able to understand my point

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器