Jump to content

Internal Sever Error?


Recommended Posts

I seem to be getting an internal server error every time I include a specific page to any file. I can't seem to fix it.

Here is the specific page I'm talking about:

 

<?php
#permissions.php

#Start Session
session_start();

Require_Once('include/connect.php');

$DB = new mysql();

$DB->Connect('localhost', 'tpfrpg', 'casey', 'tpfrpg_main');

/**********************************************
SQL TEST FILE FOR HOW TO USE THE CONNECTION
    Regular commands such as mysql_*(.....)
won't work. 
  $sql = "SELECT id, echo FROM `tests` WHERE `id` = '1'";
  $query = $DB->Query($sql);


  $newsrow = $DB->FetchRow($query);
  $id = $newsrow[0];
  $echo = $newsrow[1];
  
  echo "<b>Row</b><br /><br />ID: $id<br />
  Echo: $echo<br><br />";


  $num = $DB->FetchNum($query);
  echo "Number of rows: $num";
**********************************************/

#Set LoggedIn Variable
if(Session_Is_Registered("UserName") && Session_Is_Registered("PassWord"))
{
$LoggedIn = True;
}
else
{
$LoggedIn = False;
}

#Require Station File
Require_Once('include/station.php');

#If Permission Is Set To One
if($Permission == 1)
{
#If The User Is Not Logged In
if($LoggedIn == False)
{
	#Require Header File
	myHeader(1,"Error -");

	#Display Error Message
	echo("<center><b>Error:</b><br />
	It seems that you are not logged in to the RPG, please login.<br />
	<b>Options</b><br />
	<a href='login.php?Redirect=$curPageURL'>Login to your account!</a><br />
	<a href='register.php'>Register a new account</a><br />");

	#Require Footer File
	myFooter(1);

	#Exit Page
	exit();
}
}
#If Permission Is Set To Two
elseif($Permission == 2)
{
#If The User Is Not Logged In
if($LoggedIn == False)
{
	#Require Header File
	myHeader(1,"Error -");

	#Display Error Message
	echo("<center><b>Error:</b><br />
	It seems that you are not logged in to the RPG, please login.<br />
	<b>Options</b><br />
	<a href='login.php?Redirect=$curPageURL'>Login to your account!</a><br />
	<a href='register.php'>Register a new account</a><br />");

	#Require Footer File
	myFooter(1);

	#Exit Page
	exit();
}

#Get User Power From The DB
$UPowerQuery = $DB->Query("SELECT * FROM `Users` WHERE	`UserName` = '$_SESSION[userName]'");
$U_Power = $DB->FetchArray($UPowerQuery);

#User Power Variable
$User_Power = $U_Power["User_Power"];

#If User Group Is Webmaster
If($User_Group == "Webmaster")
{
	$Permission_Needed = 5;
}
#If User Group Is Administrator
elseif($User_Group == "Administrator")
{
	$Permission_Needed = 4;
}
#If User Group Is Super Moderator
elseif($User_Group == "Super Moderator")
{
	$Permission_Needed = 3;
}
#If User Group Is Beta Tester
elseif($User_Group == "Beta Tester")
{
	$Permission_Needed = 2;
}
else
{
	#Require Header File
	myHeader(1,"Error -");

	#Display Error Message
	echo('<center><b>Error:</b><br />Invalid parameter in Permissions File.</center>');

	#Require Footer File
	myFooter(1);		

	#Exit Page
	exit();
} 

#If The User Does Not Have Enough Permission
if($User_Power < $Permission_Needed)
{
	#Require Header File
	myHeader(1,"Permission Error -");	

	echo('<center><b>Error:</b><br />Sorry, $_SESSION["UserName"], you must be a $User_Group to access this page.<br /></center>');


	#Require Footer File
	myFooter(1);

	#Exit Page
	exit();
}
}
#If Permission Is Set To Three
elseif($Permission == 3)
{		
#If The User Is Logged In
if($LoggedIn == True)
{
	#Require Header File
	myHeader(1,"Error -");

	#Display Error Message
	echo("<center><b>Error:</b><br />
	It seems that you are currently logged in to the RPG, please logout to view this page.<br />
	<b>Options</b><br />
	<a href='logout.php'>Log out from your account.</a><br />");

	#Require Footer File
	myFooter(1);

	#Exit Page
	exit();
}	
}
?>

Can any one please help me?

 

Link to comment
https://forums.phpfreaks.com/topic/113827-internal-sever-error/
Share on other sites

I checked the error log and after I went to the login page & the register page(which are the pages that give me the Internal Server Errors) and I saw this:

[Wed Jul  9 13:17:41 2008] [error] [client 65.42.87.95] Premature end of script headers: /home/tpfrpg/public_html/register1.php

[Wed Jul  9 13:17:37 2008] [error] [client 71.196.110.244] (2)No such file or directory: File does not exist: /home/tpfrpg/public_html/register.php

[Wed Jul  9 13:17:16 2008] [error] [client 71.196.110.244] Premature end of script headers: /home/tpfrpg/public_html/login.php

 

If you guys need to see the code for the register and login file tell me.

Link to comment
https://forums.phpfreaks.com/topic/113827-internal-sever-error/#findComment-585655
Share on other sites

Here it is:

<?php
#station.php

define("INC_PATH", "include/" ); 
function myHeader($h, $t) {

if (!isset($t)){ 
$Page_Title = "Home -";
}
elseif (isset($t)){
$Page_Title = $t;
}
if ($h == 1){ 
require INC_PATH."header.php";
}
elseif ($h == 0){
echo "";
}
}

function myFooter($f) {
	if ($f == 1){
require INC_PATH."footer.php";
}
	if ($f == 0){
echo "";
}
}


?>

Link to comment
https://forums.phpfreaks.com/topic/113827-internal-sever-error/#findComment-585908
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.