otuatail Posted February 5, 2010 Share Posted February 5, 2010 Fatal error: Call to undefined function isrobot_x() in /home/fhlinux190/d/des-otoole.co.uk/user/htdocs/index.php on line 49 This function does exsist. in http://www.des-otoole.co.uk if(isRobot_x($Browser) == 1) exit; function isRobot($Browser) { $Robot = 0; if(strpos($Browser, W3C) !== false) $Robot = "1"; if(strpos($Browser, MICROSOFT) !== false) $Robot = "1"; if(strpos($Browser, YAHOO) !== false) $Robot = "1"; if(strpos($Browser, ASK) !== false) $Robot = "1"; if(strpos($Browser, GOOGLE) !== false) $Robot = "1"; return $Robot; } function isRobot_x($Browser) { $Robot = 0; if(strpos($Browser, MAJESTIC) !== false) $Robot = "1"; if(strpos($Browser, SNAPBOT) !== false) $Robot = "1"; if(strpos($Browser, VOYAGER) !== false) $Robot = "1"; if(strpos($Browser, CFETCH) !== false) $Robot = "1"; if(strpos($Browser, HOUXOU) !== false) $Robot = "1"; if(strpos($Browser, TWICELER) !== false) $Robot = "1"; if(strpos($Browser, MSNBOT) !== false) $Robot = "1"; if(strpos($Browser, GOOGLEMAPS) !== false) $Robot = "1"; if(strpos($Browser, YANGA) !== false) $Robot = "1"; if(strpos($Browser, ALEXA) !== false) $Robot = "1"; if(strpos($Browser, PUREBOT) !== false) $Robot = "1"; return $Robot; } PLEASE HELP Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted February 5, 2010 Share Posted February 5, 2010 Do you actually include the file anywhere that has the function in it? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 5, 2010 Share Posted February 5, 2010 Posting a couple of pieces of code out of context does not provide enough information for anyone to determined why the function definition is not being seen. Some possible causes - 1) The function definition is in an include file and the include is failing. 2) You are including the file using a URL instead of a file system path, so the code in the file is not even present in the current scope. 3) Short open tags are being used, so the code containing the definition is not being seen as code. 4) There are no php tags at all around the code. 5) The function definitions are conditional (they are inside a conditional statement or inside of some other function definition and won't exist until that conditional statement is true or the outside function is called. 6) There is a non-printing character either in the function definition name or in the function call. Have you deleted and retyped both? Short answer: Cannot even begin to help you without seeing the whole code responsible for causing the function definition to exist. Quote Link to comment Share on other sites More sharing options...
otuatail Posted February 5, 2010 Author Share Posted February 5, 2010 Yes I am including the code. Other functions work The page Line 48 - 50 <? include ("functions.php"); $accept = $_SERVER["HTTP_ACCEPT"]; $Browser = $_SERVER['HTTP_USER_AGENT']; $RemoteAddress = $_SERVER['REMOTE_ADDR']; //172.55.44.33 $domain = $_SERVER['HTTP_HOST']; //des-otoole.co.uk ? if (!isset($_GET['counter'])) $_GET['counter'] = ""; if (!isset($_GET['Event_Log'])) $_GET['Event_Log'] = ""; if (!isset($_SESSION['current_page'])) $_SESSION['current_page'] = ''; if (!isset($_SESSION['K9'])) $_SESSION['K9'] = ''; $_SESSION['Event_Log'] = "YES"; if($_GET["counter"] != "") $_SESSION['Event_Log'] = "NO"; if(isIE7($Browser) == 1) // $Browser = "MSIE 7.0-WebDAV-MiniRedir/5.1.2600"; { mailto("MSIE 7"); //header('Location: 666.php'); exit; } connectDB(1); $sql = "SELECT * FROM `config`"; $query = mysql_query($sql) or die(mysql_error()); $rs = mysql_fetch_array($query); $Construction = $rs['Construction']; $Robot = $rs['Robot']; $IP = $rs['IP']; $dbLog = $rs['dbLog']; $page = "Home"; $IsMe = IsMe($RemoteAddress , $IP); if($Construction == 'Y' && $IsMe == 'N') { include('UnderConstruction.php'); exit; } $_SESSION['K9_X'] = "0"; if(isRobot_x($Browser) == 1) exit; $_SESSION['K9'] = "0"; $_SESSION['K9'] = isRobot($Browser); if($Robot == 'Y') // Default to robot $_SESSION['K9'] = 1; if(ipband2("91.121.64.0","91.121.127.255",$RemoteAddress) == 1) // Unusual visitor. reported on website groups $_SESSION['K9'] = 1; if($_SESSION['Event_Log'] == 'YES' && $_SESSION['current_page'] == "" && $_SESSION['K9'] == 0) hitcounter(); $Total_Hits = get_hit_counter(); if($_SESSION['current_page'] <> 'index.php') { StoreData($page); // Only if Event_Log = 'YES' and Flag 'dbLog' = 'Y' if($_SESSION['K9'] == 0 || $dbLog == 'N') mailto($page); } $_SESSION['current_page'] = 'index.php'; if($_SESSION['K9'] == 0 && $Robot == 'N') { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <META HTTP-EQUIV="imagetoolbar" CONTENT="no"> <LINK rel="stylesheet" href="style.css" type="text/css"> <TITLE>Home</TITLE> </HEAD> <BODY> <div id="side-menu"> <!-- <a onmouseover="document.images[0].src='images/Family-H.gif'" onmouseout="document.images[0].src='images/Family.gif'" href="Family.php" rel="nofollow"><IMG src="images/Family.gif" alt=""></a> <br> --> <a onmouseover="document.images[0].src='images/Testimony-H.gif'" onmouseout="document.images[0].src='images/Testimony.gif'" href="Testimony.php"><IMG src="images/Testimony.gif" alt=""></a> <br><br> <a onmouseover="document.images[1].src='images/Contact-H.gif'" onmouseout="document.images[1].src='images/Contact.gif'" href="Contact.php" rel="nofollow"><IMG src="images/Contact.gif" alt=""></a> </div> <div id="me"> <div> <div id="001"> <img src="MalawiPics/MalawiMe.jpg" alt=""><br> <span style="color:green">Malawi 2009</span> </div> </div> <br> <span class="Info"> Visitors since April 2006 <?=display_hits($Total_Hits)?> excluding web robots</span> </div> <div id="w3c"> <br><br><br><br> <IMG src="images/w3c.gif" alt=""> <IMG src="images/css.gif" alt=""> <br><br><br> </div> </BODY> </HTML> <?} else { //echo("File error"); include('robot.html'); }?> The included file LINE 114 <? /********************************************** * functions.inc 25-08-2007 Desmond O'Toole. * * Include file for general functions MAIN * * 3.1.0 * **********************************************/ session_start(); include ("config.php"); function connectDB($db) { // echo $DB; switch ($db) { case 1: $host = hostname; $user = username; $pass = password; $data = database; break; case 2: $host = hostname1; $user = username1; $pass = password1; $data = database1; break; case 3: $host = hostname2; $user = username2; $pass = password2; $data = database2; break; case 4: $host = hostname10; $user = username10; $pass = password10; $data = database10; break; } $link = mysql_connect($host, $user, $pass) or die("Houston we have problem"); $database = @mysql_select_db ($data, $link); } function IsMe($A,$B) { if($A == $B) return 'Y'; else return 'N'; } function RevEng($val,$code) { $val= substr($val , -4); // if $code = 1; $val -= 1240; return $val; } function TOD() { $stamp = time(); $response = "Evening"; $Time = date('H',$stamp); // $Time = "11"; if($Time < 18) $response = "Afternoon"; if($Time < 12) $response = "Morning"; return $response; } function codec() { $stamp1 = time(); $stamp2 = strtotime("1 January 2006"); $stamp3 = $stamp1 - $stamp2 + 100000000; $stamp3 = substr($stamp3 , -6); return $stamp3; } function query_db($query) { $results = @mysql_query ($query); return $results; } function isIE7($browser) { $IE7 = 0; if(strpos($browser, "Microsoft") !== false) $IE7 = 1; return $IE7; } function isRobot($Browser) { $Robot = 0; if(strpos($Browser, W3C) !== false) $Robot = "1"; if(strpos($Browser, MICROSOFT) !== false) $Robot = "1"; if(strpos($Browser, YAHOO) !== false) $Robot = "1"; if(strpos($Browser, ASK) !== false) $Robot = "1"; if(strpos($Browser, GOOGLE) !== false) $Robot = "1"; return $Robot; } function isRobot_x($Browser) { $Robot = 0; if(strpos($Browser, MAJESTIC) !== false) $Robot = "1"; if(strpos($Browser, SNAPBOT) !== false) $Robot = "1"; if(strpos($Browser, VOYAGER) !== false) $Robot = "1"; if(strpos($Browser, CFETCH) !== false) $Robot = "1"; if(strpos($Browser, HOUXOU) !== false) $Robot = "1"; if(strpos($Browser, TWICELER) !== false) $Robot = "1"; if(strpos($Browser, MSNBOT) !== false) $Robot = "1"; if(strpos($Browser, GOOGLEMAPS) !== false) $Robot = "1"; if(strpos($Browser, YANGA) !== false) $Robot = "1"; if(strpos($Browser, ALEXA) !== false) $Robot = "1"; if(strpos($Browser, PUREBOT) !== false) $Robot = "1"; return $Robot; } function Log666() { $browser = $_SERVER["HTTP_USER_AGENT"]; $IP = $_SERVER['REMOTE_ADDR']; $stamp = time(); $date = date("d-m-Y H:i:s",$stamp); $val = $date . ", " . $IP . ", " . $browser . "\r\n"; $fh = fopen("666.txt","a"); fwrite($fh,$val); fclose($fh); } function mailto($page) { if (!isset($_SESSION['K9'])) $_SESSION['K9'] = ""; if (!isset($_SESSION['Atack'])) $_SESSION['Atack'] = ""; if (!isset($_SESSION['Event_Log'])) $_SESSION['Event_Log'] = ""; connectDB(1); $sql = "SELECT * FROM `config`"; $query = mysql_query($sql) or die("Houston we have problem"); $file = $_SERVER['SCRIPT_FILENAME']; $rs = mysql_fetch_array($query); $do = $rs['EmailRep']; if ($_SESSION['K9'] == "1") $page .= " ROBOT"; if ($_SESSION['Atack'] == "1") $page .= " ATACK"; if($_SESSION['Event_Log'] <> 'NO' && $do == 'Y' && $_SESSION['current_page'] == "") { $browser = $_SERVER["HTTP_USER_AGENT"]; $IP = $_SERVER['REMOTE_ADDR']; $to = "otuatail@aol.com"; // $to = "pd_otoole@hotmail.com"; $from = "Site_Access" . "@des-otoole.co.uk"; $subject = $page; $name="Unknown"; $stamp = time(); $val = date("d-m-Y H:i:s",$stamp); $headers = "From: $name <$from>\r\n"; $message = "Message sent from Main-Site IP Address \r\n" . $file . "'\r\n'" . $IP . "'\r\n\r\n Time: " . $val . " UK Local time\r\n\r\n Page: " . $page ."\r\nBrowser = " . $browser; // ini_set("sendmail_from", "root@des-otoole.co.uk"); $success = mail($to,$subject, $message, $headers, '-froot@des-otoole.co.uk'); } } function mailto_login($page) { connectDB(1); $sql = "SELECT * FROM `config`"; $query = mysql_query($sql) or die("Houston we have problem"); $rs = mysql_fetch_array($query); $do = $rs['EmailRep']; if ($_SESSION['K9'] == "1") $page .= " ROBOT"; if ($_SESSION['Atack'] == "1") $page .= " ATACK"; if($_SESSION['Event_Log'] <> 'NO' && $do == 'Y') { $browser = $_SERVER["HTTP_USER_AGENT"]; $IP = $_SERVER['REMOTE_ADDR']; $to = "otuatail@aol.com"; $from = $page . "@des-otoole.co.uk"; $subject = "Main-Site Site Access"; $name="Unknown"; $stamp = time(); $val = date("d-m-Y H:i:s",$stamp); $headers = "From: $name <$from>\r\n"; $message = "Message sent from Main-Site IP Address " . $IP . "\r\n\r\n Time: " . $val . "\r\n\r\n Page: " . $page ."\r\nBrowser = " . $browser; // ini_set("sendmail_from", "root@des-otoole.co.uk"); $success = mail($to,$subject, $message, $headers, '-froot@des-otoole.co.uk'); } } function Report() { $stamp = time(); $IP = $_SERVER['REMOTE_ADDR']; // $stamp -= 3600; $val = date("d-m-Y H:i:s",$stamp); $fh = fopen("hitlog.txt","a"); fwrite($fh,$val . "\nIP=" . $IP . "\nRobot=" . $_SESSION['Robot'] . "\nPage =" . $_SESSION['current_page'] . "\n\n"); fclose($fh); } function StoreData($Page) { connectDB(1); $IP = $_SERVER['REMOTE_ADDR']; $hit = 'N'; if ($_SESSION['current_page'] == "") $hit = 'Y'; if ($_SESSION["K9"] == "1") $hit = 'R'; if ($_SESSION["Atack"] == "1") // Apears not to be used Des 13/03/2009 $hit = 'A'; $_SESSION["K208"] = ipband2("208.80.193.000","208.80.195.255",$IP); // 208.80.195.29 ? $Stranger = ipband2("91.121.64.0","91.121.127.255",$IP); // Unusual visitor. reported on website groups if ($Stranger == 1) { $hit = 'A'; $_SESSION['K9'] = 1; } if ($_SESSION["K208"] == 1) { $hit = '?'; $_SESSION['K9'] = 1; } $sql = "SELECT * FROM `config`"; $query = mysql_query($sql) or die("Houston we have problem"); $rs = mysql_fetch_array($query); $do = $rs['dbLog']; if($_SESSION['Event_Log'] == 'YES') { $browser = $_SERVER["HTTP_USER_AGENT"]; $stamp = time(); $Date = date('Y-m-d',$stamp); $Time = date('H:i:s',$stamp); $IP = $_SERVER['REMOTE_ADDR']; $DateTime = date("Y-m-d H:i:s", $row['Stamp']); //$sql = "INSERT INTO `EventLog` VALUES ('','" . $stamp . "','" . $Date . "','" . $Time . "','" .$IP . "','" . $Page . "','" . $browser . "','" . $hit . "')"; $sql = "INSERT INTO `EventLog` VALUES ('','" . $stamp . "','" . $DateTime . "','" .$IP . "','" . $Page . "','" . $browser . "','" . $hit . "')"; $query = mysql_query ($sql); $result = @mysql_affected_rows($sql); } } function StoreData_login($Pwd1,$Pwd2) { connectDB(1); $browser = $_SERVER["HTTP_USER_AGENT"]; $stamp = time(); $Date = date('Y-m-d',$stamp); $Time = date('H:i:s',$stamp); $IP = $_SERVER['REMOTE_ADDR']; $sql = "INSERT INTO `FailedLog` VALUES ('','" . $Date . "','" . $Time . "','" . $IP . "','" . $Pwd1 . "','" . $Pwd2 . "','" . $browser . "')"; $query = mysql_query ($sql); $result = @mysql_affected_rows($sql); } function get_hit_counter() { /* $sql = "SELECT * FROM `config`"; $query = mysql_query($sql) or die("Houston we have problem"); $rs = mysql_fetch_array($query); $cnt = $rs['Count']; return $cnt; */ $sql = "SELECT count(*) As Total FROM `EventLog` WHERE Hit = 'Y'"; $query = mysql_query($sql) or die("Bad Count"); $rs = mysql_fetch_array($query); $cnt = $rs['Total'] + 20; return $cnt; } function hitcounter() { connectDB(1); $sql = "SELECT * FROM `config`"; $query = mysql_query($sql) or die("Houston we have problem"); $rs = mysql_fetch_array($query); $do = $rs['HitCounter']; $cnt = $rs['Count']; if($_SESSION['Event_Log'] <> 'NO' && $do == 'Y') { $cnt++; $sql = "UPDATE `config` SET Count = '" . $cnt . "'"; $query = mysql_query ($sql); Report(); } } function Sunday() { $day = 86400; $stamp = time(); $sunday = date('w',$stamp); $stamp -= $day * $sunday; return ($stamp); } function Saturday() { $day = 86400; $stamp = time(); $sunday = date('w',$stamp); $sunday = 6 - $sunday; $stamp += $day * $sunday; return ($stamp); } function display_hits($hits) { $output = ""; $str = str_pad($hits,5,'0',STR_PAD_LEFT); for($i=0; $i<strlen($str); $i++) { switch($str[$i]) { case '0': $output = $output . "<img src='images/0.gif' alt=''>"; break; case '1': $output = $output . "<img src='images/1.gif' alt=''>"; break; case '2': $output = $output . "<img src='images/2.gif' alt=''>"; break; case '3': $output = $output . "<img src='images/3.gif' alt=''>"; break; case '4': $output = $output . "<img src='images/4.gif' alt=''>"; break; case '5': $output = $output . "<img src='images/5.gif' alt=''>"; break; case '6': $output = $output . "<img src='images/6.gif' alt=''>"; break; case '7': $output = $output . "<img src='images/7.gif' alt=''>"; break; case '8': $output = $output . "<img src='images/8.gif' alt=''>"; break; case '9': $output = $output . "<img src='images/9.gif' alt=''>"; break; default : } if ($i < strlen($str)-1) $output = $output . "<img src='images/spacer.gif' alt=''>"; } echo($output); } function ipband($L, $H, $T) { list($L1, $L2, $L3, $L4) = split('[.]', $L); list($H1, $H2, $H3, $H4) = split('[.]', $H); list($T1, $T2, $T3, $T4) = split('[.]', $T); $Low = "0." . $L1 . "." . $L2 . "." . $L3; // RRL Shift $High = "0." . $H1 . "." . $H2 . "." . $H3; $Test = "0." . $T1. "." . $T2 . "." . $T3; $Low = ip2long($Low ); $High = ip2long($High); $Test = ip2long($Test); if ($Test < $Low || $Test > $High) { return -1; // Failed } $Low = "0." . $L2 . "." . $L3 . "." . $L4; // Mask top $High = "0." . $H2 . "." . $H3 . "." . $H4; $Test = "0." . $T2 . "." . $T3 . "." . $T4; $Low = ip2long($Low ); $High = ip2long($High); $Test = ip2long($Test); if ($Test < $Low || $Test > $High) { return -2; // Failed } return 1; // Passed } function ipband2($L, $H, $T) { $result = "1"; $L = ip2string($L); $H = ip2string($H); $T = ip2string($T); if($T < $L || $T > $H) $result = "0"; return $result; } function ip2string($IP) { //$IP = "100.101.102.103"; $sp = split('[.]', $IP); for($i = 0; $i<4; $i++) { while(strlen($sp[$i]) < 3) { $sp[$i] = "0" . $sp[$i]; } } return $sp[0] . $sp[1] . $sp[2] . $sp[3]; } function table_colour($ID) { $val = ($ID % 2 == 0) ? "bgcolor=#69E97E" : "bgcolor=#15B62F"; // First = ID=1 echo($val); } function abdo($ID,$k) { $l = $k; $start = 4; $len = strlen($ID); $r = rand(2102350 , 9889879); $t = time(); $package = "1" . $t . $r; $package[$l] = $len; for($p = 0; $p < $len; $p++) { $package[$p + $start] = $ID[$p]; $q++; } return $package; } function fateor($package,$k) { $l = $k; $start = 4; $pos = $package[$l]; $ID = ""; for($p = 0; $p < $pos; $p++) { $ID .= $package[$p + $start]; } return $ID; } ?> This is driving me nuts now. Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted February 5, 2010 Share Posted February 5, 2010 In that case, follow all of PFMaBiSmAd's steps to see what the problem is, because you can almost guarantee one of those will be the issue Quote Link to comment Share on other sites More sharing options...
otuatail Posted February 5, 2010 Author Share Posted February 5, 2010 WHAT Quote Link to comment Share on other sites More sharing options...
otuatail Posted February 5, 2010 Author Share Posted February 5, 2010 Cant get simpler. Fatal error: Call to undefined function iscrap() in /home/fhlinux190/d/des-otoole.co.uk/user/htdocs/index.php on line 8 <? include ("functions.php"); $accept = $_SERVER["HTTP_ACCEPT"]; $Browser = $_SERVER['HTTP_USER_AGENT']; $RemoteAddress = $_SERVER['REMOTE_ADDR']; $domain = $_SERVER['HTTP_HOST']; isCrap(); ?> <?php //session_start(); function isCrap() { echo "Help"; } ?> Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 5, 2010 Share Posted February 5, 2010 Change include() to require() and see if it can actually find and open the file. Quote Link to comment Share on other sites More sharing options...
otuatail Posted February 5, 2010 Author Share Posted February 5, 2010 it is finding it. The original code has over 50 functions. I add one more and it cant find it. If I coment it out on the page, everything works. This has woeked for years. All I did was add one more function. I changed the extension to php from inc because it was vunerable to being opened. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted February 5, 2010 Share Posted February 5, 2010 it is finding it. The original code has over 50 functions. I add one more and it cant find it. If I coment it out on the page, everything works. This has woeked for years. All I did was add one more function. I changed the extension to php from inc because it was vunerable to being opened. If a) It can open, b) it can parse. Then doesn't it defy your own logic? Turn error reporting to E_ALL|E_STRICT|E_COMPILE_ERROR and use require(). That should prove your problem. Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 5, 2010 Share Posted February 5, 2010 And yet you still do include functions.php include ("functions.php"); Perhaps you still have functions.php on your server, but do all your changes to functions.inc? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.