dean7 Posted November 11, 2013 Share Posted November 11, 2013 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 Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted November 11, 2013 Share Posted November 11, 2013 I have no idea what your directory structure is, but maybe: include ("includes/functions.php"); Quote Link to comment Share on other sites More sharing options...
dean7 Posted November 11, 2013 Author Share Posted November 11, 2013 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) . "'"; } 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.