1.4.3.1 - full-image.php URL encode

Recently I find error on access log when visitor access my site by using iPad, the URL parameter seems URL encoded like following:

http://www.hkdigit.net/pic/zp-core/full-image.php?a=press%2F1-july-march&i=hkdigit-20110701-150601.jpg&q=100&wmk=!&dsp=Protected%20view

If I decode the URL, the photo display normally.

http://www.hkdigit.net/pic/zp-core/full-image.php?a=press/1-july-march&i=hkdigit-20110701-150601.jpg&q=100&wmk=!&dsp=Protected view

Question: Does the full-image.php support URL encode parameter?

Regards,
Chris Lee

Comments

  • URL decoding is handled by browsers, so Zenphoto is not involved. However, the link you posted is not proper. It would appear that the extended link has been URL encoded. Only the "file path" part should be urlencoded, query options should be html encoded which would not change the "?" into "%3f".

    Can you describe how this link was generated?
  • Hi sbillard,

    I am not sure how the link was generated, I add email notify code on 404.php,so I know what's wrong:

    Beside is the latest error I got, the client using iPad.

    On Mon Aug 6 2012 4:49:00 am HKT, 37.106.2.195 tried to load :

    http://www.hkdigit.net/pic/zp-core/i.php?a=shopping/apple-store&i=hkdigit-20110925-131518.jpg

    User Agent = Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5

    http://www.google.com/search?um=1&hl=en&safe=active&client=safari&tbo=d&tbm=isch&sa=X&ei=fNseUPflCM7S4QSN2YHgDw&ved=0CD8QBSgA&q=hong+kong+malls&spell=1&biw=1024&bih=690

    ---

    Below is the code snippet added to 404.php

    <?php
    $ip = $_SERVER['REMOTE_ADDR'];
    $requri = $_SERVER['REQUEST_URI'];
    $servname = $_SERVER['SERVER_NAME'];
    $combine = $ip . " tried to load " ;
    $url = $servname . $requri ;
    $httpref = $_SERVER['HTTP_REFERER'];
    $httpagent = $_SERVER['HTTP_USER_AGENT'];
    $today = date("D M j Y g:i:s a T");
    $message2 = "On $today, $combine:\n
    http://$url\n
    User Agent = $httpagent \n
    $httpref ";

    $message2 .= $errmsg;

    $to = "xxx@example.com";
    $subject = "404 Error Report";
    $from = "From:xxx@example.com\r\n";
    mail($to, $subject, $message2, $from);
    ?>

    Any hints?
  • Set the define `DEBUG_404` to true in `global_definitions.php`. This will cause 404 errors to be logged in the debug log. There will be significantly more informtion recorded there than you currently have.
  • Hi Sbillard,

    DEBUG_404 already set to true, below is the latest error I got.

    {Mon, 06 Aug 2012 01:39:49 GMT}
    Backtrace: USER NOTICE: Zenphoto processed a 404 error on /pic/zp-core/full-image.php%3Fa%3Dshopping%252Fapple-store%26i%3Dhkdigit-20110921-075409.jpg%26q%3D100%26wmk%3D!%26dsp%3DProtected%2520view. See the debug log for details. in /home/hklb/public_html/hkdigit.net/pic/zp-core/functions.php on line 2038
    trigger_error called
    from debug404 (functions.php [2038])
    from index.php [100]
    {Mon, 06 Aug 2012 01:39:49 GMT}
    404 error: album=zp-core/full-image.php; image=; theme=hkdigit
    {Mon, 06 Aug 2012 01:39:49 GMT}
    $_SERVERarray(34) {
    ["DOCUMENT_ROOT"]=>
    string(34) "/home/hklb/public_html/hkdigit.net"
    ["GATEWAY_INTERFACE"]=>
    string(7) "CGI/1.1"
    ["HTTP_ACCEPT"]=>
    string(3) "*/*"
    ["HTTP_ACCEPT_ENCODING"]=>
    string(12) "gzip,deflate"
    ["HTTP_CONNECTION"]=>
    string(10) "Keep-alive"
    ["HTTP_FROM"]=>
    string(26) "googlebot(at)googlebot.com"
    ["HTTP_HOST"]=>
    string(15) "www.hkdigit.net"
    ["HTTP_REFERER"]=>
    string(62) "http://www.orbitalsystems.net/apple-store-hong-kong-ifc&page=2"
    ["HTTP_USER_AGENT"]=>
    string(72) "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
    ["PATH"]=>
    string(13) "/bin:/usr/bin"
    ["PHPRC"]=>
    string(10) "/home/hklb"
    ["QUERY_STRING"]=>
    string(116) "album=zp-core/full-image.php?a=shopping%2Fapple-store&i=hkdigit-20110921-075409.jpg&q=100&wmk=!&dsp=Protected%20view"
    ["REDIRECT_QUERY_STRING"]=>
    string(116) "album=zp-core/full-image.php?a=shopping%2Fapple-store&i=hkdigit-20110921-075409.jpg&q=100&wmk=!&dsp=Protected%20view"
    ["REDIRECT_STATUS"]=>
    string(3) "200"
    ["REDIRECT_UNIQUE_ID"]=>
    string(24) "UB8gZbisrTAAAGjIRF4AAAA2"
    ["REDIRECT_URL"]=>
    string(115) "/pic/zp-core/full-image.php?a=shopping%2Fapple-store&i=hkdigit-20110921-075409.jpg&q=100&wmk=!&dsp=Protected%20view"
    ["REMOTE_ADDR"]=>
    string(12) "66.249.73.92"
    ["REMOTE_PORT"]=>
    string(5) "50937"
    ["REQUEST_METHOD"]=>
    string(3) "GET"
    ["REQUEST_URI"]=>
    string(139) "/pic/zp-core/full-image.php%3Fa%3Dshopping%252Fapple-store%26i%3Dhkdigit-20110921-075409.jpg%26q%3D100%26wmk%3D!%26dsp%3DProtected%2520view"
    ["SCRIPT_FILENAME"]=>
    string(48) "/home/hklb/public_html/hkdigit.net/pic/index.php"
    ["SCRIPT_NAME"]=>
    string(14) "/pic/index.php"
    ["SERVER_ADDR"]=>
    string(14) "184.172.181.65"
    ["SERVER_ADMIN"]=>
    string(32) "webmaster@example.com"
    ["SERVER_NAME"]=>
    string(15) "www.hkdigit.net"
    ["SERVER_PORT"]=>
    string(2) "80"
    ["SERVER_PROTOCOL"]=>
    string(8) "HTTP/1.1"
    ["SERVER_SIGNATURE"]=>
    string(60) "Apache Server at www.hkdigit.net Port 80
    "
    ["SERVER_SOFTWARE"]=>
    string(6) "Apache"
    ["UNIQUE_ID"]=>
    string(24) "UB8gZbisrTAAAGjIRF4AAAA2"
    ["PHP_SELF"]=>
    string(14) "/pic/index.php"
    ["REQUEST_TIME"]=>
    int(1344217189)
    ["argv"]=>
    array(1) {
    [0]=>
    string(116) "album=zp-core/full-image.php?a=shopping%2Fapple-store&i=hkdigit-20110921-075409.jpg&q=100&wmk=!&dsp=Protected%20view"
    }
    ["argc"]=>
    int(1)
    }
  • Another debug log by googlebot spider

    {Mon, 06 Aug 2012 05:21:53 GMT}
    Backtrace: USER NOTICE: Zenphoto processed a 404 error on /pic/zp-core/i.php%3Fa%3Dshopping/apple-store%26i%3Dhkdigit-20110922-080548.jpg%26s%3D640%26cw%3D%26ch%3D%26q%3D85%26wmk%3D!. See the debug log for details. in /home/hklb/public_html/hkdigit.net/pic/zp-core/functions.php on line 2038
    trigger_error called
    from debug404 (functions.php [2038])
    from index.php [100]
    {Mon, 06 Aug 2012 05:21:53 GMT}
    404 error: album=zp-core/i.php; image=; theme=hkdigit
    {Mon, 06 Aug 2012 05:21:53 GMT}
    $_SERVERarray(33) {
    ["DOCUMENT_ROOT"]=>
    string(34) "/home/hklb/public_html/hkdigit.net"
    ["GATEWAY_INTERFACE"]=>
    string(7) "CGI/1.1"
    ["HTTP_ACCEPT"]=>
    string(3) "*/*"
    ["HTTP_ACCEPT_ENCODING"]=>
    string(12) "gzip,deflate"
    ["HTTP_CONNECTION"]=>
    string(10) "Keep-alive"
    ["HTTP_FROM"]=>
    string(26) "googlebot(at)googlebot.com"
    ["HTTP_HOST"]=>
    string(15) "www.hkdigit.net"
    ["HTTP_USER_AGENT"]=>
    string(19) "Googlebot-Image/1.0"
    ["PATH"]=>
    string(13) "/bin:/usr/bin"
    ["PHPRC"]=>
    string(10) "/home/hklb"
    ["QUERY_STRING"]=>
    string(97) "album=zp-core/i.php?a=shopping/apple-store&i=hkdigit-20110922-080548.jpg&s=640&cw=&ch=&q=85&wmk=!"
    ["REDIRECT_QUERY_STRING"]=>
    string(97) "album=zp-core/i.php?a=shopping/apple-store&i=hkdigit-20110922-080548.jpg&s=640&cw=&ch=&q=85&wmk=!"
    ["REDIRECT_STATUS"]=>
    string(3) "200"
    ["REDIRECT_UNIQUE_ID"]=>
    string(24) "UB9UcbisrTAAACt8PawAAAA0"
    ["REDIRECT_URL"]=>
    string(96) "/pic/zp-core/i.php?a=shopping/apple-store&i=hkdigit-20110922-080548.jpg&s=640&cw=&ch=&q=85&wmk=!"
    ["REMOTE_ADDR"]=>
    string(12) "66.249.73.92"
    ["REMOTE_PORT"]=>
    string(5) "56762"
    ["REQUEST_METHOD"]=>
    string(3) "GET"
    ["REQUEST_URI"]=>
    string(124) "/pic/zp-core/i.php%3Fa%3Dshopping/apple-store%26i%3Dhkdigit-20110922-080548.jpg%26s%3D640%26cw%3D%26ch%3D%26q%3D85%26wmk%3D!"
    ["SCRIPT_FILENAME"]=>
    string(48) "/home/hklb/public_html/hkdigit.net/pic/index.php"
    ["SCRIPT_NAME"]=>
    string(14) "/pic/index.php"
    ["SERVER_ADDR"]=>
    string(14) "184.172.181.65"
    ["SERVER_ADMIN"]=>
    string(32) "webmaster@example.com"
    ["SERVER_NAME"]=>
    string(15) "www.hkdigit.net"
    ["SERVER_PORT"]=>
    string(2) "80"
    ["SERVER_PROTOCOL"]=>
    string(8) "HTTP/1.1"
    ["SERVER_SIGNATURE"]=>
    string(60) "Apache Server at www.hkdigit.net Port 80
    "
    ["SERVER_SOFTWARE"]=>
    string(6) "Apache"
    ["UNIQUE_ID"]=>
    string(24) "UB9UcbisrTAAACt8PawAAAA0"
    ["PHP_SELF"]=>
    string(14) "/pic/index.php"
    ["REQUEST_TIME"]=>
    int(1344230513)
    ["argv"]=>
    array(1) {
    [0]=>
    string(97) "album=zp-core/i.php?a=shopping/apple-store&i=hkdigit-20110922-080548.jpg&s=640&cw=&ch=&q=85&wmk=!"
    }
    ["argc"]=>
    int(1)
    }
  • acrylian Administrator, Developer
    Actually iPads use a proper web browser with mobile Safari. I have no idea why it should not work there and otherwise does. I have no iPad to test so no idea.
  • Well, here is what I can tell you based on the above information:

    First, your theme is a little unusual in that it is using the "full image" in protected view for the image page display. I suppose there is nothing wrong with that, just that it is not expected.

    The HTML on the page is correct--properly urlencoded. So the wrong URL encoding is happening somewhere else, maybe not even part of Zenphoto. If it were part of Zenphoto then your pages would never show the image.

    The above entries all seem to be coming from googlebot. Maybe your site map is not correct?
  • Hi acrylian, sbillard,

    In case you don't have iOS device, you use use Apple Safari 5 on Windows for testing:

    After startup the Safari 5, change the User Agent to:

    Safari iOS 4.3.3 - iPhone

    Ref: http://postimage.org/image/bx6k8agx9/

    Then use Google Image Search:

    http://images.google.com/

    On the search bar, input

    site:hkdigit.net/pic

    Ref: http://postimage.org/image/fhdo72uej/

    When google display the search result, click second image:

    Ref: http://postimage.org/image/heznwwobd/

    Google display cached thumbnail, mouse over to the top of the page, click "Full Size Image" button

    Ref: http://postimage.org/image/iqtfhtheb/

    Then it will show 404 error:

    Ref: http://postimage.org/image/lvvc4pr5z/

    Check the browser address bar, the URL seems cannot decode well:

    http://www.hkdigit.net/pic\index.php?album=weather&amp;image=hkdigit-20120725-082936.jpg

    Ref: http://postimage.org/image/smh6vosa5/

    It does not happen on Firefox browser.

    Any hints?

    Regards,
    Chris Lee
  • acrylian Administrator, Developer
    I am on Mac and tested with Safari 6 with iPad and iPhone user agent. While iPad works iPhones does not. I fear this is nothing we can do about this as that is an internal display of Google that does the wrong encoding. The link itself is correct.
Sign In or Register to comment.