Error "You can't access this file directly..."

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Error "You can't access this file directly..."
DivotMaker
CZ Newbie
DivotMaker has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Sep 02, 2004
0.00 posts per day
Posts: 21
Points: 976
   
I created a basic module that contains some info. On the index.php page, I have a table with some links. I would like to be able to have a link that opens another .php file in my same directory as the module's index.php file. I created the link, but when I click on it, I get the following error 'You can't access this file directly..."

Here's the code for the link in my index.php file:

."<tr><td><b><a href=\"modules/Tracks/clubmoto.php\">Club Moto Track Photos</a></b></td></tr>"



Here's my code for the page I want to open (clubmoto.php):


<?php

if (!eregi("modules.php", $_SERVER['SCRIPT_NAME'])) {
    die ("You can't access this file directly...");
}

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);

$index = 1;

include("header.php");
OpenTable();

echo "<center><table width = \"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"$bgcolor2\"><tr><td align=\"center\">"
."<b>Track Photos</b></tr></td>\n"
."<tr><td> ;;</td></tr>\n"
."<tr><td><img src=\"images/tracks/clubmoto/1.jpg\"><br><br></td></tr>\n"
."<tr><td><img src=\"images/tracks/clubmoto/2.jpg\"><br><br></td></tr>\n"
."<tr><td><img src=\"images/tracks/clubmoto/3.jpg\"><br><br></td></tr>\n"
."<tr><td><img src=\"images/tracks/clubmoto/4.jpg\"><br><br></td></tr>\n"
."</table></center>";

CloseTable();   


CloseTable();   
include("footer.php");

?>



Thank you.


Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
Try this one:

modules.php?name=Tracks&file=clubmoto




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: Error "You can't access this file directly..."
wolf
CZ Active Member
usa.gif indiana.gif
Occupation: Student; Flash, HTML, PHP developer
Age: 34
Gender: Male
Status: Offline
Joined: Jul 25, 2003
0.02 posts per day
Posts: 168
Points: 10,417
AIM Address Yahoo Messenger MSN Messenger 
I'm having the same problem.

Telli, what do you mean by "Try this one"? Where do we add "modules.php?name=DIRECTORY&file=FILE"?




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#4   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
He asked for the link to use to be able to view the other page inside of the module folder.

You have a module with index.php and clubmoto.php index is always default.

modules.php?name=MODULENAME&file=SECONDFILE




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum