Help
Search
Login
Register
Home
Forum: web design and graphics community
Celestial Star Forum
>
Web Development
>
Coding
>
Quite Simple
Pages: [
1
]
2
« previous
next »
Print
Author
Topic: Quite Simple (Read 1900 times)
Hpa Dumbledore
Angeling
Posts: 18
Quite Simple
«
on:
August 31, 2006, 02:39:14 AM »
Hey I just found this great Tutorial :
I have some questions on it.
http://vitae.infinite9.net/index.php?Key=Tutorials&SubKey=DynamicInc
Can I change Switch "Key" to Switch "Action" ?
And intsead of includes does any other command works in it.
If yes, Then can I have the command to show image. And also which will redirect to my zip file. for example :
My url for image will be
http://mysite.com/images.php?Image=1
On the above given url it shows that I have made a page called images.php and the switch command is "Images" and the image I want to show is the case "1". So what will be the syntax for it in the followinng code :
<php>
And I want to do the same for my zip file like
http://mysite.com/download.php?Layout=32
Syntax :
<php>
Thanks
Logged
Blackstone
Administrator
Valkyrie Randgris
Posts: 821
Oh look! People!
Quite Simple
«
Reply #1 on:
August 31, 2006, 09:42:17 AM »
Yes, you can switch 'Key' to whatever you like, as long as that change is reflected in your URLs as well. Say for example you started with:
index.php?Key=images
You would have to have this:
index.php?action=images
instead. Make sense?
As for the second question, I'm not quite sure what you mean, but you could possibly use the 'header' function to redirect to a URL:
header('Location:
http://www.website.com
');
Logged
Hpa Dumbledore
Angeling
Posts: 18
Quite Simple
«
Reply #2 on:
September 01, 2006, 02:02:36 AM »
Thanks for the huge help but it does'nt answer my question, really!. Like you gave the command "header" whats the command to redirect to an image instead of a site ?
Logged
Panda-Sodomy
Angeling
Posts: 2
Quite Simple
«
Reply #3 on:
September 01, 2006, 04:09:40 AM »
My guess would be to change the header url to the url of the image perhaps? if that is what you mean.
Logged
Blackstone
Administrator
Valkyrie Randgris
Posts: 821
Oh look! People!
Quite Simple
«
Reply #4 on:
September 01, 2006, 10:56:31 AM »
Either, llike Panda said, change the header redirect to the image URL, or you could include a page that had the image embedded on it.
Logged
Lily
Skogul
Posts: 47
Quite Simple
«
Reply #5 on:
September 01, 2006, 05:04:39 PM »
if you ask me, i'd just direct it to the url of the image. i think it's so much less complicated.
Logged
Digital Lavender
x
ABC Board
x
Self-Assured
assie-chan
Retribution
Posts: 156
Quite Simple
«
Reply #6 on:
September 01, 2006, 08:03:09 PM »
Hello hpa! I wrote that tutorial, and I'm glad people are putting it to good use. Like Blackstone said, I would use headers, they would redirect the user to the file, but they would still see index.php?action=download001 in the address bar (or whatever you've named the Case as). To use the header method Blackstone mentioned, you'd use the following code:
Code:
<?php
switch&
#40;$action)
&
#123;
case
download001
&
#58;
header
&
#40;'Location: layout001.zip');
break;
&
#125;
?>
Logged
"If Xerxes was two men, and he was the only two men alive, I wouldnt allow him/them to have intercourse."
Hpa Dumbledore
Angeling
Posts: 18
Quite Simple
«
Reply #7 on:
September 02, 2006, 07:54:45 AM »
Oh my GOD!! Thanks that's a huge help
really It's great. Thanks and I will try this out ;)
Logged
assie-chan
Retribution
Posts: 156
Quite Simple
«
Reply #8 on:
September 02, 2006, 01:17:23 PM »
Ha ha ha, not a problem. I'm suprised anyone's even
thinking
about using it. I was sure normal includes would kick the pants off of that script. xD Seeing someone use it so quickly gives me the motivation to go rewrite the tutorial a bit. Mind if I use your idea to use it as a download script as well?
Logged
"If Xerxes was two men, and he was the only two men alive, I wouldnt allow him/them to have intercourse."
Hpa Dumbledore
Angeling
Posts: 18
Quite Simple
«
Reply #9 on:
September 04, 2006, 03:14:44 AM »
Oh!, Sure do!. I am so thankful that you wrote that tutorial. The reason I am switching to Dynamic Includes is that I want my web site to look like a professional one. :lol: . Well how do you do this part :
SubKey=DynamicInc
Like the subkey after the key=blahblah.
Logged
assie-chan
Retribution
Posts: 156
Quite Simple
«
Reply #10 on:
September 04, 2006, 11:30:58 AM »
Easy peasy.
This will be in your index.php file:
Code:
switch($Key)
{
default:
include "inc/main.inc";
break;
case Tutorials
include "inc/Tutorials.inc";
break;
}
Now, your TUTORIALS.INC file would be this (of course, the case name doesn't have to be Tutorial and the file doesn't have to be tutorial.inc, this is just an example):
Code:
switch($SubKey)
{
default:
include "inc/404.inc";
break;
case DynamicInc
include "inc/DynamicInc.inc";
break;
}
Now when you link using index.php?Key=Tutorials(remember that was the case name, change this if you changed "Tutorials" to something else)&SubKey=DynamicInc(the case name of the switch inside Tutorials.inc)
Not so hard, eh? If you get any problems with this, I can explain it in more detail ;)
Logged
"If Xerxes was two men, and he was the only two men alive, I wouldnt allow him/them to have intercourse."
fedekiller
Shelter
Posts: 204
Quite Simple
«
Reply #11 on:
September 04, 2006, 02:55:36 PM »
switch navigation is not efficient! u always have to edit it...
just use this code and will include the files like ?fd=foldername&page=pagename that will include folder/page.php or if u only want a page ?page=page and it will include page.php
u can delete the ' and / of the gets if u want
<php>
Logged
assie-chan
Retribution
Posts: 156
Quite Simple
«
Reply #12 on:
September 04, 2006, 08:21:34 PM »
Yeah, but if you're a geek and have the time on your hands to do switch navigation, the URI is much more search engine friendly, plus there's less chance of someone hacking, last time I checked there was a big debate going on with how safe dynamic inclusion really is.
Logged
"If Xerxes was two men, and he was the only two men alive, I wouldnt allow him/them to have intercourse."
Vangs
Administrator
Valkyrie Randgris
Posts: 525
Quite Simple
«
Reply #13 on:
September 05, 2006, 06:12:06 AM »
Dynamic inclusion, when used stupidly, is a serious security flaw. The best way to use dynamic inclusions is to create a folder and put all your included files in there, then use an if(file_exists()) to check to the folder for the file. If it doesn't then include an error file.
The security flaw with dynamic inclusions is that alot of people just include a file set in a query string variable. People can modify the url to link to an off-site file which then runs through their script exploiting anything they want.
As for the URLs being more search-engine friendly, how do you work that out? Both the way you and fedekiller described creates a query string with 2 variables in it. Search engines hate query strings, so they won't index a site with too many variables in their query string.
A simple technique to fix that problem is .htaccess mod_rewrite, it changes the urls to look like folders or whatever way you want, its
much
more search-engine friendly.
My recommendation, use dynamic includes if you will have alot of files, otherwise use switches.
Logged
Hpa Dumbledore
Angeling
Posts: 18
Quite Simple
«
Reply #14 on:
September 06, 2006, 06:19:59 AM »
Great :D thanks for all the help. And yeah, Dynamic inclusion are very safe because you never know whats the folder name or the file name and you cant access it without using the site's dynamic navigations. Plus it givens a professional look. Okey, to make it simple, I mean the image thing. How do you do these :
http://www.saruna.net/topsites/button.php?u=hpa
The above given is a dynamic naviagation url. if I use img tags to the url it will result as
I wanted to know how can I do these?
Logged
Pages: [
1
]
2
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General
=> New Members
=> Announcements
=> Support / Suggestions
-----------------------------
Contests
-----------------------------
=> Archive
===> Contests
===> Blend Challenges
===> SOTW
-----------------------------
Art Boards
-----------------------------
=> Creative mediums
=> Requests & offers
=> Tutorials
===> Celestial Star Tutorials
-----------------------------
Web Development
-----------------------------
=> Coding
=> Web Design
=> Advertisements / Affiliation
-----------------------------
Off-topic
-----------------------------
=> Entertainment
-----------------------------
Español (Spanish Only)
-----------------------------
=> General / Bienvenida
=> Anuncios / Ayuda
=> Código / Desarrollo web
Welcome,
Guest
Members login
Register for free
General
General
New members
Announcements
Support / Suggestions
Art boards
Creative mediums
Requests and offers
Tutorials
Celestial Star tutorials
Web development
Coding
Web design
Advertisements / affiliation
Off-topic
The non-sense
Ententainment
Loading...