inherit
RIP- Proboards Legend
39218
Conquester777 Conquester777
0
Oct 11, 2005 6:36:29 GMT -8
Conquester777
CirclesAreFun
4,008
March 2005
cq777
|
Post by Conquester777 on Jul 25, 2005 2:20:21 GMT -8
whatever you want buddy (not reading what others have written) you can name the file abcdef, abcdef.html, or abcdef.php. if you use the above url ( www.domainnamehere.com/index.php?page=abcdef ) you can just do include('$page'); or include('$page.php'); (asmuing I used the include function correctly)
|
|
inherit
RIP- Proboards Legend
39218
Conquester777 Conquester777
0
Oct 11, 2005 6:36:29 GMT -8
Conquester777
CirclesAreFun
4,008
March 2005
cq777
|
Post by Conquester777 on Jul 25, 2005 2:24:05 GMT -8
okay to anwser the new question 1) YOU DONT HAVE TO USE THE $_GET COMMAND. Like I said in my last post, the variable in the URL will automatically be created as $page. Unless you have some uber old version of php running on the server. 2) I have no idea what case or switch or break or all that mean... Okay wait, I can guess. BUt they arn't needed. Please do this: <? include $page.'.php'; ?> because it does exactly the same as the code you're using in your last post... except... my version is obviously WAY better. lastly, if it cannot find the page, ummm... make sure it's there it should tell you what page it's trying to request as well. oh wait, lastly this time, if you wanna move around folders... you hafta go ~something like~ username/public_html/pages/index.php or something to include index.php at it's full. not yourdomainname.com/index.php just so you know. if oyu have any troubles please PM me as my method should work flawlessly Without all that stupid coding other people have told you to do.
|
|
inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 25, 2005 2:31:48 GMT -8
include... to the best of myt knowledge includes a file into a page... It doesn't act like opening a different page. Any help? I know how to move around folders.... P.S. just so you don't need to let me know something like that....
|
|
inherit
RIP- Proboards Legend
39218
Conquester777 Conquester777
0
Oct 11, 2005 6:36:29 GMT -8
Conquester777
CirclesAreFun
4,008
March 2005
cq777
|
Post by Conquester777 on Jul 25, 2005 13:26:16 GMT -8
I dunno, I just throw in advice whenever. Didn't know if you knew it or not.
And including and opening are the same thing.
Besides, using the script I gave you will give you the desired result so what's the problem?
|
|
squalleh
inherit
-148647
0
Dec 2, 2024 13:10:17 GMT -8
squalleh
0
January 1970
GUEST
|
Post by squalleh on Jul 25, 2005 14:55:51 GMT -8
Wow, Conq, I feel bad for -anybody- that wishes to be taught PHP by you. The way you're doing this is equivalent to being a Bank Manager, opening the vault door, and welcome robbers in, telling them to "please take whatever you like". First of all, you have Register Globals enabled. HUGE no-no right there. That's the biggest and most well known PHP security threat. With that, if you have a form, somebody could so easily perform injections you don't need so much as an ounce of intelligence to do so. Second is you're just taking that global and including it no matter what. Now somebody could come along, go to: "index.php?page=/home/boo/etc/.htpasswd", and with a bit of luck/skill of getting the correct directories, they now have access to your htpasswd file. Great bloody way to show somebody how to include files Conq.
|
|
inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 25, 2005 23:37:41 GMT -8
what Squall Leonhart said..... I thought it was wrong... but hey, P.S. Conquester 77 your going to have to change that thing in you sig... that say you can teach PHP. Um...... the line is still open.... i still need help.... and is there someone? Find out if someone posts some advice..... Please, coomon! Someone gootta know some PHP stuff... I mean seriously even a link to a tut would be nice. Or ann explanation to why the other one posted didn't work!
|
|
inherit
RIP- Proboards Legend
39218
Conquester777 Conquester777
0
Oct 11, 2005 6:36:29 GMT -8
Conquester777
CirclesAreFun
4,008
March 2005
cq777
|
Post by Conquester777 on Jul 25, 2005 23:54:11 GMT -8
:/
I didn't realise you guys needed security.
I was going for pure simplicity. What works works.
|
|
inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 26, 2005 2:44:54 GMT -8
really... oh sorry... i just generally thought that everyone presumed that when i wanted a code for a website i actually need it to be safe.....
**wakes head with brick while reciting 'common sense'**
Anyway, HELP, help please
|
|
squalleh
inherit
-148651
0
Dec 2, 2024 13:10:17 GMT -8
squalleh
0
January 1970
GUEST
|
Post by squalleh on Jul 26, 2005 4:27:55 GMT -8
:/ I didn't realise you guys needed security. I was going for pure simplicity. What works works. "Going for security" would be validating the GET information against pre-hard-defined settings. An array containing all known pages, for example. The pointers I mentioned, Conq, weren't "going for security". They were "going for not giving out precious information to any idiot that just puts in a local address". Bit of a difference, you see, as the latter should be seen to in any and every script, no matter the complexity or simplicity; no matter the term of use, no matter what.
|
|
inherit
EXOH
27575
0
Nov 12, 2007 22:40:30 GMT -8
J. Meeter
i do my crosswords in pen
8,249
July 2004
modernxxromance
|
Post by J. Meeter on Jul 26, 2005 17:23:26 GMT -8
Goku, don't listen to Conquester777... Seriously.
|
|
inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 26, 2005 17:41:10 GMT -8
yeah... i guessed thatr, but can someone please help me.... just going back to the original problem....
CCWorld's code doesn't work for me, it just gives errors.
|
|
inherit
22517
0
Apr 30, 2009 18:49:13 GMT -8
Bradley
Has a new webhost. :) Needs to transfer a lot of stuff. :-/
5,246
April 2004
ccworldwebmaster
|
Post by Bradley on Jul 26, 2005 18:15:15 GMT -8
yeah... i guessed thatr, but can someone please help me.... just going back to the original problem.... CCWorld's code doesn't work for me, it just gives errors. That's because you're a newbie and not using it right. I'm going to take some time and walk you slowly trough this. 1. Create a file named index.php. Also create a folder named pages and create files named home.php, page1.php, page2.php and error.php inside the folder. 2. Type the following code in the index.php file: <html> <head> <title>YOUR SITE NAME HERE</title> </head> <body> <h1>YOUR SITE NAME AGAIN</h1> <div align="center"> <a href="index.php?page=home">Home</a> :: <a href="index.php?page=page1">Page 1</a> :: <a href="index.php?page=page2">Page 2</a> :: <a href="index.php?page=werwerwer">werwerwer (not a really page, will load error page)</a> </div> <?php
// declare and set variables $page = $_GET['page']; $inc;
// check for no value of page and set to home if($page === null){ $page = "home"; }
// use switch statement for page variable and // for each possible page add a case section switch ($page) { // for the home page case "home": // file to include with home page code and/or text $inc = "pages/home.php"; // prevent the code from running into the next case break; case "page1": $inc = "pages/page1.php"; break; case "page2": $inc = "pages/page2.php"; break; // for anything else entered display error or main default: $inc = "pages/error.php"; break; }
// include the file into the current page require($inc);
?> </body> </html> 3. Now type the following code in the home.php file which is in the pages folder: <p> This is the home page. Be happy now. Weeeeee!!!!11!1 </p> 4. Now type the following code in the page1.php file which is in the pages folder: <p> This is the first page. 1 and 1 and 1 and 1 and not 2! </p> 5. Now type the following code in the page2.php file which is in the pages folder: <p> This is the second page. 2 and 2 and 2 and 2 and not 1! </p> 6. Now type the following code in the error.php file which is in the pages folder: <p> This is the error page. Bad person. You shouldn't be here. </p> 7. Now load the index.php page in a browser and see what you did.
|
|
inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 26, 2005 23:48:38 GMT -8
newbie........ **coughs loudly**.... I know quite a bit of PHP, it's just i can't find a tut on this, and i can't figure it out. Anyway, thanks...... **makes all files and checks them** **boots PHP, Apache and mySQL** - one click boots all! **tests** Results: Negitive... THIS IS WHAT IS SHOWS when i go to test it YOUR SITE NAME AGAIN Home :: Page 1 :: Page 2 :: werwerwer (not a really page, will load error page) Notice: Undefined index: page in c:\*****\www\index.php on line 16 Notice: Undefined variable: inc in c:\*****\index.php on line 17 This is the home page. Be happy now. Weeeeee!!!!11!1 P.S. i have taken out the routes And so i test out the other pages by clicking the links.... and i get YOUR SITE NAME AGAIN Home :: Page 1 :: Page 2 :: werwerwer (not a really page, will load error page) Notice: Undefined variable: inc in c:\***\www\index.php on line 17 THIS IS WHERE THE OTHER TEXT GOES P.S. i used *** for the route Also, i don't think you understand what i mean.... i want it to be like a normal page but when i click a link it doesn't go to jsdnksajd.com/jskndsa/asdbhask it instead goes to asjdhbkasjd.com/index.php?page=pagename . The code acts as if it's like a frame or iframe with JS or HTML and so instead of loading normal pages, it instead just include() the file, while what i was look for is so that it loads a different page, kind of thing.... EG, lok here at support.proboards.com/index.cgi? and then go to support.proboards/index.cgi?board=programming . The two don't look like menu's they look totally different. If there is something i am missing please say. Also .CGI What is the extension for.... and is it just a thing with CGI files, or can it also be done with PHP liek some othersites
|
|
inherit
22517
0
Apr 30, 2009 18:49:13 GMT -8
Bradley
Has a new webhost. :) Needs to transfer a lot of stuff. :-/
5,246
April 2004
ccworldwebmaster
|
Post by Bradley on Jul 27, 2005 0:04:32 GMT -8
What version of PHP and Apache are you running? CGI stands for Common Gateway Interface. Most people use Perl to write CGI scripts. The index.php file contains the layout and stuff you want on every page. the pages/page#.php contains the content for just that page. That's about as much as I can understand of your last paragraph.
|
|
inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 28, 2005 16:40:49 GMT -8
yeah.... thanks.... i have worked it out myself!
Anyway i am using EasyPHP V8. (the nwewest version), the reason for this is because it's small and works......
|
|