|
|
#1 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Oct 2005
7 posts
Gave thanks: 0
Thanked 0 times
|
I've been using the PHP (Query Strings) 'index2.php?page=news' for some time. Now that I have transfered my files onto Surpass, it doesn't seem to work.
The Main Page has the content I have for news.php PHP Code:
|
|
|
|
|
|
#2 (permalink) |
|
after g, before i
Resident.
Joined in Jul 2004
Lives in N,BC,CA
8,087 posts
Gave thanks: 48
Thanked 131 times
|
I'll start off with saying that method of includes is deadly to use.. it can be exploited in a number of ways to do evil things to your website.
Second, it could be a case of register_globals() being disabled (a good thing) so you might want to use something like: PHP Code:
|
|
|
|
|
|
#3 (permalink) |
|
rocks your socks.
Resident.
Joined in Mar 2004
Lives in fear of Obama.
Hosted on Pass 7
13,156 posts
Gave thanks: 8
Thanked 35 times
|
ok, so instead of doing something like:
include ('yeah.html'); what would be better? I've noticed this in your own gallery: include("includes/home.php"); so I wonder what's wrong with doing it like that. |
|
|
|
|
|
#4 (permalink) |
|
after g, before i
Resident.
Joined in Jul 2004
Lives in N,BC,CA
8,087 posts
Gave thanks: 48
Thanked 131 times
|
There's nothing wrong with including files in the same directory, but when you're doing it dynamically, there's a chance that something naughty from a remote server could be included. Yes, the .html part will significantly reduce that, but it's still risky to the point I urge against it.
My recommendation for a dynamic include is to put the value through a switch statement... PHP Code:
|
|
|
|
|
|
#5 (permalink) |
|
rocks your socks.
Resident.
Joined in Mar 2004
Lives in fear of Obama.
Hosted on Pass 7
13,156 posts
Gave thanks: 8
Thanked 35 times
|
what about doing this?
require_once($_SERVER['DOCUMENT_ROOT'].'/functions.php'); I saw that on PHPFreaks.com. http://www.phpfreaks.com/tutorials/131/0.php Here's a question for you...what is this: -> I have trouble looking that up in search engines but I see it in codes all over the place. Like: Code:
$this->result_id=mysql_query($sql) or die("SQL Used: $sql<br>".mysql_error()."<br>");
$this->query_count++;
|
|
|
|
|
|
#6 (permalink) |
|
after g, before i
Resident.
Joined in Jul 2004
Lives in N,BC,CA
8,087 posts
Gave thanks: 48
Thanked 131 times
|
require_once($_SERVER['DOCUMENT_ROOT'].'/functions.php');
That's perfectly OK as it's not accepting user input. When $page can be set as 'http://evilsite.tld/evilscript' it's not a safe thing. The '->' is used in classes and objects. I haven't gotten into that as much in PHP as I have in JavaScript, so I can't go into deep details, but http://ca.php.net/class and http://ca.php.net/object should be of some help. |
|
|
|
|
|
#8 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Oct 2005
7 posts
Gave thanks: 0
Thanked 0 times
|
Well, I tried some on the methods (I'm still confused about the 'm00.php' and 'cow.html'). Where do you exactly put each file? (e.g. news.php, page.html, index2.php, etc.)
|
|
|
|
|
|
#9 (permalink) |
|
after g, before i
Resident.
Joined in Jul 2004
Lives in N,BC,CA
8,087 posts
Gave thanks: 48
Thanked 131 times
|
The values I used were for example... You would create your own cases where if say $page has the the value of 'news' and you wanted to load the page 'news.php' it would basically look like this:
PHP Code:
|
|
|
|