Hi,
I have this code:
<? if(basename($_SERVER['PHP_SELF'])=="index.php?S=1&Folder=1")
include("modules/links.php");
else {
echo "this folder/category has 0 links";
}
?>
In the code above I would like to say, if I am on the first page (HOME has .../index.php?S=1&Folder=1) than the links.php file should be included, but on all other sites only the message should come. But somehow this code above is not working properly - it always shows the message (this folder/category...)
Thanks for help
Ananda
How to make include this file or include that file?
Moderator: General Moderators
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Do the following:
And see what the output is. Do this match index.php?S=1&Folder=1 ??
Why not just try:
Code: Select all
echo basename($_SERVER['PHP_SELF'];Why not just try:
Code: Select all
if((isset($_GET['S'] AND $_GET['S']==5)) AND (isset($_GET['Folder']) AND $_GET['Folder']==1)){
//include file
}else{
//echo error
}-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Opps sorry i missed the closing ) from the end.
Code: Select all
echo basename($_SERVER['PHP_SELF']);thanks,
i get the index.php and not index.php?S=1&Folder=1
so now it is logical...
But how can I sort out the first page?
This code you send me:
if((isset($_GET['S'] AND $_GET['S']==5)) AND (isset($_GET['Folder']) AND $_GET['Folder']==1))
include("modules/links.php");
else
{
echo "this folder/category has 0 links";
}
it is also not working... any ideas?`
i get the index.php and not index.php?S=1&Folder=1
so now it is logical...
But how can I sort out the first page?
This code you send me:
if((isset($_GET['S'] AND $_GET['S']==5)) AND (isset($_GET['Folder']) AND $_GET['Folder']==1))
include("modules/links.php");
else
{
echo "this folder/category has 0 links";
}
it is also not working... any ideas?`
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Code: Select all
print_r($_SERVER);