Jump to content

[SOLVED] Fatal error: Call to undefined function when function IS defined


hellonoko

Recommended Posts

I am receiving the following error:

 

Fatal error: Call to undefined function checkloggedin() in /home2/sharingi/public_html/REPOSITORY/index.php on line 7

 

checkLoggedIn() is included in a config.php file that is included on line 6 and is defined.

 

I made no changes to this previously working script.

 

Any ideas?

 

 

Link to comment
Share on other sites

also, I take it the function checkLoggedIn() is located in another PHP file? Is this PHP file being included correctly in index.php? If not then it wont be able to find the function.

 

To check this you need to change:

 

include "functions.php";

 

to

 

require "functions.php";

 

If the file isn't being included correctly the script will then tell you.

Link to comment
Share on other sites

Yup. Just before an admin did something on the server that fixed it. But now I have broken it again.

 

Here is the code:

 

<?php

// logon script
error_reporting( E_ALL);

include_once("http://www.sharingizcaring.com/flashupload2/config.php");

checkLoggedIn("yes");

////////////////////////////////////////////////
///////////////////////////////////////////////

$username = "sharingi_music";
$password = "music";
$hostname = "localhost";

$db_connect = mysql_connect( $hostname , $username, $password) or die ("Unable to connect to database");

mysql_select_db( "sharingi_music" , $db_connect);

/////////////////////////////////////////////////
////////////////////////////////////////////////

include 'http://www.sharingizcaring.com/menu.php';


//displays how many uploads each user has so far

//include '../count2.php';

$view_files = $_GET['user'];
echo $view_files;

   	$arr = array();

   	foreach (glob("*.*") as $filename) 
   	{
      	$arr[$filename] = filemtime($filename);
    	//echo $filename . " was last modified on " . date('M d Y, h:i:m', filemtime($filename)) . "<br>";    
   	}

   ///
   
   //asort($arr);
   //echo "<br>";

//foreach($arr as $key => $value) 
   	//{
    //	echo "$key was last modified on " . date('M d Y, h:i:m', $value) . "<br>";
   	//}

///

   	arsort($arr);

$olddate = 0;
$date = 0;

echo '<table width="100%"  align="center" border="0">';
echo "<tr>";
echo '<td bgcolor="#FFFFFF">';

   	foreach($arr as $key => $value) 
{
     
	if ( $key !== "filelist3.php" && $key !== "index.php" )
	{

		$date = date("d", filemtime($key));

		$display_date = date ( "l F jS", filemtime($key));



		if ( $date !== $olddate )
		{
			$date_id = date ( "dmY", filemtime($key));

			echo "<br><br>";
			echo "<span class=date_font>$display_date</span><br>";
			//echo "<span class=\"date_font\"><a href=\"#\" onClick=\"toggle_it('$date_id')\">".$display_date."</a></span><br>";

			//echo "<br><br>";
		}
		else
		{
			echo "<br>";

		}




		print "<object type=\"application/x-shockwave-flash\" data=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key&b_colors=,,". player_color().",&\" width=\"17\" height=\"17\"";
         	print "<param name=\"movie\" value=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key&b_colors=,,".player_color().",&\"</object>";

         	//print "<img src=\"noflash.gif\" width=\"17\" height=\"17\" alt=\"\" />";
         	print "<span class=small_font><a href=\"http://www.sharingizcaring.com/REPOSITORY/$key\" class=".color()."> $key</a></span>";

		$date = date("d", filemtime($key));

		///////////////////////////////////////////////////////

		$result = mysql_query("SELECT USER FROM songs WHERE SONG = '$key'");

		while ($row = mysql_fetch_row($result))
		{
			echo "<span class=small_font> - from: </span>";
			echo "<span class=small_font_user>".$row[0]."</span>";
		}
	}



$olddate = $date;



}

echo '</table>';

///////////////////////////////////
mysql_close ( $db_connect);
////////////////////////////////////


echo "</td>";
echo "</tr>";
echo "</table>";

function color()
{

	$color =  rand( 1,7);

	if ($color == 1)
	{
		return "red";
	}
	if ($color == 2)
	{
		return "green";
	}
	if ($color == 3)
	{
		return "blue";
	}
	if ($color == 4)
	{
		return "yellow";
	}
	if ($color == 5)
	{
		return "babyblue";
	}
	if ($color == 6)
	{
		return "purple";
	}
	if ($color == 7)
	{
		return "grey";
	}
}

function player_color()
{
	$color = rand(1,7);

	if ($color == 1)
	{
		return "FF0000";
	}
	if ($color == 2)
	{
		return "00FF00";
	}
	if ($color == 3)
	{
		return "0000FF";
	}
	if ($color == 4)
	{
		return "FFFF00";
	}
	if ($color == 5)
	{
		return "00FFFF";
	}
	if ($color == 6)
	{
		return "FF00FF";
	}
	if ($color == 7)
	{
		return "999999";
	}
}
?>

</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.