Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    PHP Code:
    $url = (isset ($_GET['url']) && file_exists($_GET['url'])) ? "files/" strtolower($_GET['track']) : "http://example.com/404.html"
    You're using both 'url' and 'track'. Is that the problem?

  2. #17
    Regular Coder Mooseman's Avatar
    Join Date
    Sep 2010
    Posts
    123
    Thanks
    7
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by dan-dan View Post
    You're using both 'url' and 'track'. Is that the problem?
    The real parameter is 'track', I was changing it back for posting.

    Do you see any errors with the code I posted? Thank you!

  3. #18
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    Think I made a boo boo with that one. I didn't include the full path to the file_exists() call.
    Try:
    PHP Code:
    $url = (isset ($_GET['track']) && file_exists("files/" $_GET['track'])) ? "files/" strtolower($_GET['track']) : "http://example.com/404.html"

  4. #19
    Regular Coder Mooseman's Avatar
    Join Date
    Sep 2010
    Posts
    123
    Thanks
    7
    Thanked 3 Times in 3 Posts
    It works! The only thing left is that I am still having to make the parameter exampleFile.html, and not just exampleFile. Since all filenames will be html, there is no override needed. Thank you!
    Last edited by Mooseman; 06-08-2012 at 12:01 AM.

  5. #20
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    This should do it

    PHP Code:
    $url = (isset ($_GET['track']) && file_exists("files/".strtolower($_GET['track']).".html")) ? "files/".strtolower($_GET['track']).".html" "http://example.com/404.html"

  6. Users who have thanked dan-dan for this post:

    Mooseman (06-07-2012)

  7. #21
    Regular Coder Mooseman's Avatar
    Join Date
    Sep 2010
    Posts
    123
    Thanks
    7
    Thanked 3 Times in 3 Posts
    Works perfectly now! Thank you!

  8. #22
    Regular Coder dan-dan's Avatar
    Join Date
    Aug 2009
    Location
    England
    Posts
    483
    Thanks
    22
    Thanked 79 Times in 78 Posts
    No worries


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

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