Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6151193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:44:12+00:00 2026-05-23T19:44:12+00:00

on the site when an image is required the link is like this <img

  • 0

on the site when an image is required the link is like this

<img src="getimage.php?id=<?php echo $name ?>" " width="280px" height="70px">

Then on getimage.php it gets the id and from that finds the right picture and displays it.

$id = $_GET['id'];

This works perfectly. How would I find out where the request came from. So on which page this line below was on

<img src="getimage.php?id=<?php echo $name ?>" "width="280px" height="70px">

So ultimately I can know if the image requested is for index.php or about.php etc

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:44:13+00:00Added an answer on May 23, 2026 at 7:44 pm

    You can add an additional parameter to the image URL that specifies from which page it was requested:

    <img src="getimage.php?id=<?php echo urlencode($name); ?>&page=<?php echo urlencode($page); ?>" "width="280px" height="70px">
    

    Works exactly like how you did it with the id parameter.

    The benefit is, this does not rely on some headers browsers send (or not) like the HTTP Referer, something you have no control over from server-side.

    To obtain the page the image-link is generated on, you can use something like this:

    $page = basename(__FILE__);
    

    See basename PHP Manual and __FILE__ PHP Manual.

    Additionally, the code makes use of the urlencode PHP Manual function to ensure that the attribute doesn’t break.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to match a image url like this: http://site.com/site.com/files/images/img (5).jpg Something like this
Below is an image from a site that hase user photo's, they link to
I have background image for a site header with fixed width. Now I am
What are the best practices on image handling on a php driven web site
I use simple_html_dom to get site's images. But sometimes, the image's link are not
I am creating a facebook like to put on my site. This component will
I'm working on a django app for a site that requires an image gallery.
I have an existing site that requires a background image on the home page.
I have a site with an image uploader, and whenever a user tries to
So anytime someone visits this page: http://www.site.com/page/image_(.*).png They get redirected to the cdn url,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.