/    Sign up×
Community /Pin to ProfileBookmark

New query to bug you!!!

Hello.
Sorry to bother you again !!!
Not sure if I was meant to start a new thread about this, sorry — but seeming as it’s a new question I felt it appropriate.
Basically, just wondering if this is possible (and how!), i want to have a page that will load others, by this i mean I want a “sales.php” which can then have say, “sales.php?id=toys” and it would load “toys.html” in the header/footer. The toys.html and other .html files that I want would be in the “sales” directory. How can I do this? I saw something like it with skydan’s post – but there was never a fix for this, but I see a secure way at the end that wasn’t fixed.
That he had just the specific id’s and filenames that could be loaded, and that one specific directory that could only be loaded from. Tehre would literally only be about 6 id’s and .html files – so i could list them, to secure this “sales.php”.
How do you suggest I do this?

Many thanks in advance.

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@olafDec 11.2003 — switch ($id) {

case "toys':

$header = "toys.htm";

break;

case "sales":

$header = "sales.htm";

break;

}

use the $heade variable in yout frame set.
Copy linkTweet thisAlerts:
@TeachauthorDec 11.2003 — Hi there, and thanks.

Can I not use something like this: http://forums.web-developer.com/showthread.php?threadid=22479&pagenumber=3

the first post there.

Thanks.
Copy linkTweet thisAlerts:
@olafDec 12.2003 — why???

you want to use different files in different cases...
Copy linkTweet thisAlerts:
@ZibingsDec 12.2003 — I think Olaf did provide you with a good solution here. Considering everything you've asked for, adding another variable to your query line (and of course to Olaf's switch statement) will help you get the result you want.

page.php?id=sales&dir=sales <-- new variables $dir


At the top of your page:
[code=php]
if ( isset($id) || !empty($id) )
{
switch ( $id )
{
case ....
default:
$page = "page.html"; //<-- "security" in case someone tries to play around with the script
}
}

if ( isset($dir) || !empty($dir) )
{
switch ( $dir )
{
case ...
default:
$dir = "sales";
}
}

$location = "./".$dir."/".$page.".html";
[/code]


Same thing, a little "dirty" so to speak, but it would give you what you wanted, just like Olaf said.
Copy linkTweet thisAlerts:
@TeachauthorDec 12.2003 — Hi there and thanks. That indeed is what i'm looking for except the "dir" thing, although that seems a little insecure to say what "skydan" was trying to do on that post I put on the first post of this thread.

How can i use that to achieve that with itgiving the actual only directory it can load from and specific files?

Thank you.
Copy linkTweet thisAlerts:
@ZibingsDec 13.2003 — Change this:

[code=php]
$location = "./".$dir."/".$page.".html";
[/code]


to:

[code=php]
$location = "./dirname/".$page.".html";
[/code]


and take out all the code that dealt with the $dir variable.
×

Success!

Help @Teach spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...