Jump to content

Fatal errors


dean7

Recommended Posts

Hey ,

 

I've just started doing PHP again after a long time of sitting it out. I wasn't the best back then so I'm hoping to improve myself now. I've got a simple script in which it apparently has errors which I'm unsure of and Google didn't exactly help me with.

 

First of all, some odd reason when I try to include an file in my config file its saying no such file or directory even when there is.

 

<?php// connect to DB include ("../includes/functions.php"); $Username = "*****";$Password = "******";$Database = "******";$Server   = "localhost";

 

that is in the folder called includes.

 

And my main problem is about functions. I keep getting a fatal error saying "Unable to call undefined function"  in my config file which is:

 

$YourIp = yourip();

 

In my functions that is:

 

function yourip(){$client = @$_SERVER['HTTP_CLIENT_IP'];$foward = @$_SERVER['HTTP_X_FORWARDED_FOR'];$remote = $_SERVER['REMOTE_ADDR']; if (filter_var($client, FILTER_VALIDATE_IP)){$ip = $client;}elseif (filter_var($foward, FILTER_VALIDATE_IP)){$ip = $foward;}else{$ip = $remote;}return $ip;}

 

(Yes I had help from online with the IP function, but I've got other functions which are exactly the same error)

 

For what I thought that was all fine, but some reason it isnt.

 

Any help getting me pass these error will be grateful.

 

Thanks :)

Link to comment
https://forums.phpfreaks.com/topic/283815-fatal-errors/
Share on other sites

 

I have no idea what your directory structure is, but maybe:

include ("includes/functions.php");

Yeah I forgot to update this topic, but I changed that but apparently now I'm getting: Cannot redeclare safe() which is :

 

function safe($String){ return "'" .mysql_real_escape_string($String) . "'"; }

Link to comment
https://forums.phpfreaks.com/topic/283815-fatal-errors/#findComment-1457928
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.