duangao7133 2013-12-17 12:20
浏览 33
已采纳

如何通过图像发送身份验证标头?

I'm completely new to php but managed to find a script that will produce the HTTP/1.0 401 Unauthorized message box

This is the message box:

I've heard and seen that you can make this message box be sent through an image. How do i go about doing that?

When done, the steps should be:

I post image.jpg The authentication message shows up

I know it involves me having a website (example.com). Then on the website i have a folder (example.com/folder) and in that folder i have the image (example.com/folder/image.jpg). What php script do i put in the folder that will result in the image generating the authentication message?

  • 写回答

1条回答 默认 最新

  • dongmei1988 2013-12-17 13:30
    关注

    As said before in comments, it has nothing to do with PHP.

    The button in your example just set the image URL. But that URL is protected by HTTP Basic Authentication.

    To do this just create 2 files in the image folder : .htaccess and .htpasswd

    And add HTML and Javascript code like the one on the website :

    <img src="" id="downloadImg" alt=""/>
    <input type="button" value="Display Image" id="displayImage" onclick="document.getElementById('downloadImg').src='/protected-folder/image.jpg';"/>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 TMUXHS4412如何防止静电,
  • ¥30 Metashape软件中如何将建模后的图像中的植被与庄稼点云删除
  • ¥20 机械振动学课后习题求解答
  • ¥15 IEC61850 客户端和服务端的通讯机制
  • ¥15 MAX98357a(关键词-播放音频)
  • ¥15 Linux误删文件,请求帮助
  • ¥15 IBMP550小型机使用串口登录操作系统
  • ¥15 关于#python#的问题:现已知七自由度机器人的DH参数,利用DH参数求解机器人的逆运动学解目前使用的PSO算法
  • ¥15 发那科机器人与设备通讯配置
  • ¥15 Linux环境下openssl报错
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部