0
Welcome Guest! Login
0 items Join Now

Script For Image

    • Leckenby's Avatar
    • Leckenby
    • Elite Rocketeer
    • Posts: 714
    • Thanks: 0

    Script For Image

    Posted 16 years 11 months ago
    • I need a script for different images to be displayed to different users.
      For example:
      I want IP 217.23.228.61 to see one image, while the rest to see a different image

      Kind of like:
      IF computer IP = 217.23.228.61 THEN {
      IMG SRC = “static_image.jpg”
      }
      ELSE {
      IMG SRC = "static_image2.jpg" }

      I know that will be nothing like what is needed, but I hope you get the idea of what I mean
    • Dan L's Avatar
    • Dan L
    • Elite Rocketeer
    • Posts: 1453
    • Thanks: 0

    Re: Script For Image

    Posted 16 years 11 months ago
    • James, there's a great resource for web developers everywhere, loads of us use it every day to solve problems like this. There really isn't anything it doesn't have!

      Since you asked to nicely, I'll share it with you and all my fellow RocketTheme chums:

      www.google.com

      Don't say I don't ever give you anything ;) :D
    • Toolbox Digital | Dribbble | Forrst
    • GollumX's Avatar
    • GollumX
    • Elite Rocketeer
    • Posts: 2817
    • Thanks: 0

    Re: Script For Image

    Posted 16 years 11 months ago
    • lol, yup, google would be the place to go with this one. AFAIK, php can't figure this on it's own. Apache (or one of it's modules) does it via htaccess, but whether php can read from or influence the htaccess file, I know not. There are minds here who know more about this.. maybe Mathew or phlux0r, so hopefully they happen upon this post.
    • Say no to Internet Explorer 6.
      twitter.com/mark_up
  • Re: Script For Image

    Posted 16 years 11 months ago
    • i guess what you need blogg_x is
       
       $_SERVER['REMOTE_ADDR']; 
       

      what youll generally do is to avoid this from returning something by just asking brutally within a script like
       
        $ip = $_SERVER['REMOTE_ADRR'] ;
       
        if($ip != 'whateveryoudontwantittobe') 
          {
            echo 'path to image' ;
          }else{
            echo 'pathtoimage for that unique user' ;
         }
       

      the usual thing to do is store this in a function, or better still in a class with variable., if youll have a lot more to do with this, may be ip detect, for statistics, etc

      and then call the function every time you need to load an image. An advantage of this is that, just like declaring a raw $_GET in a script, you might get errors on certain server configurations
    • Last Edit: 16 years 11 months ago by .
    • No money to extend membership :(
    • GollumX's Avatar
    • GollumX
    • Elite Rocketeer
    • Posts: 2817
    • Thanks: 0

    Re: Script For Image

    Posted 16 years 11 months ago
    • GollumX wrote:
      lol, yup, google would be the place to go with this one. AFAIK, php can't figure this on it's own. Apache (or one of it's modules) does it via htaccess, but whether php can read from or influence the htaccess file, I know not. There are minds here who know more about this.. maybe Mathew or phlux0r, so hopefully they happen upon this post.
      Apparently I don't really know much at all :-[
    • Say no to Internet Explorer 6.
      twitter.com/mark_up
  • Re: Script For Image

    Posted 16 years 11 months ago
    • opps i guess me to, well just lots on my mind, i dont know what is the right array variable any way for server

      i guess REMOTE_ADRR will give you the server address and not that of the user, why not try using

      REMOTE_HOST instead, but again, there might be problems if the php is not configured probably, e.g register globals ON, or not being able to perform host name lookups,
    • No money to extend membership :(
  • Re: Script For Image

    Posted 16 years 11 months ago
    • Yeah i just quickly skipped to the php manual and i thing REMOTE_ADRR should work! but use with caution

      uk.php.net/reserved.variables
    • No money to extend membership :(
    • Dan L's Avatar
    • Dan L
    • Elite Rocketeer
    • Posts: 1453
    • Thanks: 0

    Re: Script For Image

    Posted 16 years 11 months ago
    • Ok I was being sarcastic of course, but my point was that the first thing I typed into Google came back with the answer in the first hit. Go figure.

      Maybe James was too busy writing some more cracking testimonials for himself :D :D :D :D :D :D :D :D
    • Toolbox Digital | Dribbble | Forrst
    • Leckenby's Avatar
    • Leckenby
    • Elite Rocketeer
    • Posts: 714
    • Thanks: 0

    Re: Script For Image

    Posted 16 years 11 months ago
    • Thanks, im testing that script now, and Dan that was just temp while I got my testimonial from a client :P
    • Dan L's Avatar
    • Dan L
    • Elite Rocketeer
    • Posts: 1453
    • Thanks: 0

    Re: Script For Image

    Posted 16 years 11 months ago

Time to create page: 0.055 seconds