hellonoko Posted October 21, 2008 Share Posted October 21, 2008 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 https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/ Share on other sites More sharing options...
GKWelding Posted October 21, 2008 Share Posted October 21, 2008 The ANSWER is in the error, the function is checkLoggedIn() and you're calling checkloggedin().... Function are CASE SENSITIVE. Link to comment https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/#findComment-670654 Share on other sites More sharing options...
hellonoko Posted October 21, 2008 Author Share Posted October 21, 2008 I wondered about that. In the index.php it is checkLoggedIn() and in the actual function it is checkLoggedIn() It is correct and identical in both places. Why would PHP error reporting be showing it as all lower case? Link to comment https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/#findComment-670656 Share on other sites More sharing options...
GKWelding Posted October 21, 2008 Share Posted October 21, 2008 Can you post the sections of code the rror is referring to plus a few lines either side? Link to comment https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/#findComment-670667 Share on other sites More sharing options...
GKWelding Posted October 21, 2008 Share Posted October 21, 2008 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 https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/#findComment-670670 Share on other sites More sharing options...
hellonoko Posted October 21, 2008 Author Share Posted October 21, 2008 All better. Talked to someone on the server and now it works. Not sure what would cause it but something in with PHP not my code. Thanks! Link to comment https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/#findComment-670674 Share on other sites More sharing options...
GKWelding Posted October 21, 2008 Share Posted October 21, 2008 your include file path will have been set wrong in the php.ini file in that case. Link to comment https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/#findComment-670677 Share on other sites More sharing options...
hellonoko Posted October 21, 2008 Author Share Posted October 21, 2008 This is really strange now. It has broken again. I added in two lines $view_files = $_GET['user']; echo $view_files; And the error is back. Link to comment https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/#findComment-670679 Share on other sites More sharing options...
GKWelding Posted October 21, 2008 Share Posted October 21, 2008 same function causing the error? can you post the contents of index.php and maybe i can help? Link to comment https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/#findComment-670683 Share on other sites More sharing options...
hellonoko Posted October 21, 2008 Author Share Posted October 21, 2008 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 https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/#findComment-670692 Share on other sites More sharing options...
GKWelding Posted October 21, 2008 Share Posted October 21, 2008 change: include_once("http://www.sharingizcaring.com/flashupload2/config.php"); to require_once "config.php"; and try it again. if it outputs an error then post it here and i'll take another look. Link to comment https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/#findComment-670697 Share on other sites More sharing options...
hellonoko Posted October 21, 2008 Author Share Posted October 21, 2008 Same error. Link to comment https://forums.phpfreaks.com/topic/129366-solved-fatal-error-call-to-undefined-function-when-function-is-defined/#findComment-671115 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.