doureng1083 2011-10-05 11:37
浏览 23

仅需要为注册会员显示证书(图像)的功能

I want to junrate a certificate(image) general code from my site registers members certificate will only show on his sites.for exmple abc.com is my registerd member and he placed that code on his site like bellow

img src="mysite.com?member=abc.com"

or any code (like facebook social plugin or like plugin of facebook etc) when its calling from abc.com the code will display the certificate(image) but when same code applies to another location like www.def.com the certificate(image) should not to display.

  • 写回答

1条回答 默认 最新

  • dongqing7789 2011-10-05 12:47
    关注

    You might want to do something like this:

    1 Create a php file on your server called certificate.php

    2 Allow your users to access it like this: <img src="http://www.yoursite.com/certificate.php?member=abc.com" />

    3 Check the $_SERVER variable for HTTP_REFERER

    4 See if that HTTP_REFERER contains the correct domain (abc.com)

    5 Show/or don't show the image

    $member = $_GET['member']; // Validate this field against an allowed list before continuing   
    $referal = parse_url($_SERVER['HTTP_REFERER']);
    $hostname = str_replace('www.', '', $referal['hostname']); // Remove www. part
    
    if ($hostname == $member)
    {
        // This request is coming from an abc.com website
    }
    else
    {
        // I don't this think is coming from abc.com website
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#网络安全#的问题:求ensp的网络安全,不要步骤要完成版文件
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥20 使用Photon PUN2解决游戏得分同步的问题
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序