Results 1 to 5 of 5

Thread: HTML source uploading/viewing differently on two computers

  1. #1
    Pseudo-Mad Scientist Whiternoise's Avatar
    Join Date
    Apr 2006
    Location
    Surrey
    Posts
    4,274
    Thanks
    166
    Thanked
    386 times in 233 posts
    • Whiternoise's system
      • Motherboard:
      • DFI LANPARTY JR P45-T2RS
      • CPU:
      • Q6600
      • Memory:
      • 8GB DDR2
      • Storage:
      • 5.6TB Total
      • Graphics card(s):
      • HD4780
      • PSU:
      • 425W Modu82+ Enermax
      • Case:
      • Silverstone TJ08b
      • Operating System:
      • Win7 64
      • Monitor(s):
      • Dell 23" IPS
      • Internet:
      • 1Gbps Fibre Line

    HTML source uploading/viewing differently on two computers

    This has been baffling me for a while now, i've developed a site, tested it on my laptop and uploaded it. It worked fine in firefox and i wrote the code so it would be fairly cross-platform. I showed it to a friend to get some feedback who then said "well, where's the menu?"

    I had a look on my desktop and sure enough, no menu. I cleared the cache on my laptop, nuked all my history, cookies and so on and sure enough menu was still there. I played with the CSS to see if it was a browser issue - doubted it was, it's just a load of styled hyperlinks. So after a while i looked at the source on my desktop and noticed that it wasn't actually loading the menu at all. The php function seemed to be working fine (pulls menu items from a mysql database) and after a bit more fiddling i managed to get it to display the links.

    Now i've got a similar issue. On my login page, i forgot to add in "name" parameters for the form controls (which i subsequently fixed when i realised why my login script wasn't working). It's been fine on my latop, i can login and view the account area, etc. However, when i try it on any other computer, the login form is there, but the parameters are missing - so it thinks you haven't filled in the form (as no POST variables were sent - logical system response).

    What could be causing this? I wondered if it's because my laptop is a Mac, but i don't see why... (obviously it gets ten times more difficult when PHP is involved behind the scenes and it becomes impossible to work out why it's working fine on one computer but not another).

    Note: This is NOT a case of bad rendering on one browser to another, the source is physically not there on one computer but there on another.
    Last edited by Whiternoise; 20-07-2009 at 05:09 PM.

  2. #2
    Does he need a reason? Funkstar's Avatar
    Join Date
    Aug 2005
    Location
    Aberdeen
    Posts
    19,874
    Thanks
    630
    Thanked
    965 times in 816 posts
    • Funkstar's system
      • Motherboard:
      • Gigabyte EG45M-DS2H
      • CPU:
      • Intel Core2Quad Q9550 (2.83GHz)
      • Memory:
      • 8GB OCZ PC2-6400C5 800MHz Quad Channel
      • Storage:
      • 650GB Western Digital Caviar Blue
      • Graphics card(s):
      • 512MB ATI Radeon HD4550
      • PSU:
      • Antec 350W 80+ Efficient PSU
      • Case:
      • Antec NSK1480 Slim Mini Desktop Case
      • Operating System:
      • Vista Ultimate 64bit
      • Monitor(s):
      • Dell 2407 + 2408 monitors
      • Internet:
      • Zen 8mb

    Re: HTML source uploading/viewing differently on two computers

    There isn't some provy sitting in between you and where the site is hosted is there?

    I'm pretty sure you can set the cache timeout of pages from PHP, so you could set them to expire imediately.

    Just a thought, been a while since I've done this.

  3. #3
    Ah, Mrs. Peel! mike_w's Avatar
    Join Date
    Oct 2003
    Location
    Hertfordshire, England
    Posts
    3,326
    Thanks
    3
    Thanked
    9 times in 7 posts

    Re: HTML source uploading/viewing differently on two computers

    Quote Originally Posted by Funkstar View Post
    I'm pretty sure you can set the cache timeout of pages from PHP, so you could set them to expire imediately.
    Yup, you just need to set the appropriate header options (I can't recall the exact details, but it's certainly possible). Having said that, if the cache has been cleared, I would have thought that wouldn't be the problem. There again, I can't think what else it would be.
    "Well, there was your Uncle Tiberius who died wrapped in cabbage leaves but we assumed that was a freak accident."

  4. #4
    Gentoo Ricer
    Join Date
    Jan 2005
    Location
    Galway
    Posts
    11,048
    Thanks
    1,016
    Thanked
    944 times in 704 posts
    • aidanjt's system
      • Motherboard:
      • Asus Strix Z370-G
      • CPU:
      • Intel i7-8700K
      • Memory:
      • 2x8GB Corsiar LPX 3000C15
      • Storage:
      • 500GB Samsung 960 EVO
      • Graphics card(s):
      • EVGA GTX 970 SC ACX 2.0
      • PSU:
      • EVGA G3 750W
      • Case:
      • Fractal Design Define C Mini
      • Operating System:
      • Windows 10 Pro
      • Monitor(s):
      • Asus MG279Q
      • Internet:
      • 240mbps Virgin Cable

    Re: HTML source uploading/viewing differently on two computers

    You need to send proper http headers, otherwise browser and proxy caching breaks your dynamic content:
    Code:
        header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
    And if it keeps breaking, you can force fetching of your pages with:
    Code:
        header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
        header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
        header( "Cache-Control: no-cache, must-revalidate" );
        header( "Pragma: no-cache" );
    Quote Originally Posted by Agent View Post
    ...every time Creative bring out a new card range their advertising makes it sound like they have discovered a way to insert a thousand Chuck Norris super dwarfs in your ears...

  5. #5
    Pseudo-Mad Scientist Whiternoise's Avatar
    Join Date
    Apr 2006
    Location
    Surrey
    Posts
    4,274
    Thanks
    166
    Thanked
    386 times in 233 posts
    • Whiternoise's system
      • Motherboard:
      • DFI LANPARTY JR P45-T2RS
      • CPU:
      • Q6600
      • Memory:
      • 8GB DDR2
      • Storage:
      • 5.6TB Total
      • Graphics card(s):
      • HD4780
      • PSU:
      • 425W Modu82+ Enermax
      • Case:
      • Silverstone TJ08b
      • Operating System:
      • Win7 64
      • Monitor(s):
      • Dell 23" IPS
      • Internet:
      • 1Gbps Fibre Line

    Re: HTML source uploading/viewing differently on two computers

    Thanks guys, i've poked around and it seems not to be happening any more!

    One other question though, i've sorted out a script that allows users to upload an image to the server - maximum of 250kb, etc. The code gives it a random filename with the correct extension and files it under:

    users/userID/images/filename

    Now, the script checks first to see if the directory exists, and if it doesn't, then it creates it with a chmod so that only the server and groups can read/execute - i.e. i don't want people to be able to just dial in the filename to get the image. What's the best way to display images to users afterwards? I was originally going with a database approach - as blobs - but i decided it would be easier to store it in the filesystem. At the moment i was thinking i'd have to load each image into a buffer of some sort, display the image and then clear the buffer after the page has loaded. Would this be an efficient enough approach? I thought it wouldn't be more taxing than having to query the database for each image, although that would avoid any issues of security. At the moment it's fairly secure on the basis that directory listing is disabled and unless you know the random string and the extension you can't access the file.


    EDIT:

    Ok, found a pretty good solution:
    page loads normally
    loop through images that need to be shown (file locations and types (jpg or png) are in a database)
    image location and type is put in a session variable
    other php file uses GD methods (imagecreate, depending on filetype, different functions are called)
    php file is called in an html image tag
    session variable unset
    keep looping

    This way the files are accessed by the server, not from a URL so the permissions still work and better yet, the user never even finds out the address of the image because it's called as <img src="myimagescript.php" />. It took me a while to realise i could exploit $_SESSION as a way to invisibly pass the file location to the image script, but it seems to work and all the variables are conveniently unset on each pass of the loop so nothing hangs around in the session array.
    Last edited by Whiternoise; 23-07-2009 at 04:22 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Anyone ever ordered from Eclipse Computers
    By cotswoldcs in forum SHOPPING AND CLASSIFIEDS
    Replies: 25
    Last Post: 24-02-2009, 06:57 PM
  2. Replies: 1
    Last Post: 15-03-2007, 08:42 AM
  3. Replies: 0
    Last Post: 15-03-2007, 12:09 AM
  4. Replies: 0
    Last Post: 12-03-2007, 10:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •