Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-07-2012, 05:16 PM   PM User | #16
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
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?
dan-dan is offline   Reply With Quote
Old 06-07-2012, 06:06 PM   PM User | #17
Mooseman
Regular Coder

 
Mooseman's Avatar
 
Join Date: Sep 2010
Posts: 118
Thanks: 7
Thanked 3 Times in 3 Posts
Mooseman is an unknown quantity at this point
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!
Mooseman is offline   Reply With Quote
Old 06-07-2012, 07:31 PM   PM User | #18
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
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"
dan-dan is offline   Reply With Quote
Old 06-07-2012, 07:40 PM   PM User | #19
Mooseman
Regular Coder

 
Mooseman's Avatar
 
Join Date: Sep 2010
Posts: 118
Thanks: 7
Thanked 3 Times in 3 Posts
Mooseman is an unknown quantity at this point
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-07-2012 at 11:01 PM..
Mooseman is offline   Reply With Quote
Old 06-07-2012, 07:48 PM   PM User | #20
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
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"
dan-dan is offline   Reply With Quote
Users who have thanked dan-dan for this post:
Mooseman (06-07-2012)
Old 06-07-2012, 07:53 PM   PM User | #21
Mooseman
Regular Coder

 
Mooseman's Avatar
 
Join Date: Sep 2010
Posts: 118
Thanks: 7
Thanked 3 Times in 3 Posts
Mooseman is an unknown quantity at this point
Works perfectly now! Thank you!
Mooseman is offline   Reply With Quote
Old 06-07-2012, 07:59 PM   PM User | #22
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
No worries
dan-dan is offline   Reply With Quote
Reply

Bookmarks

Tags
iframe, parameter, php

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:58 AM.


Advertisement
Log in to turn off these ads.