Jump to content

??? Fatal error: Cannot redeclare showerror() previously declared


drranch

Recommended Posts

??? Need help with the following error message  ???
Fatal error: Cannot redeclare showerror() (previously declared in D:\inetpub\vhosts\etest.com\httpdocs\connect\db.inc:12) in D:\inetpub\vhosts\etest.com\httpdocs\connect\db.inc on line 10

The above message is confusing me, ... This message is pointing to a function I created :-\ here is the code

1<?php
2
3
4  $hostName = "localhost";
5  $databaseName = "etest";
6  $username = "sam";
7  $password = "shhh";
8
9
10    function showerror()
11  {
12  die("Error " . mysql_errno() . " : " . mysql_error());
13  }
14
15  function mysqlclean($array, $index, $maxlength, $connection)
16  {
17    if (isset($array["{$index}"]))
18    {
19        $input = substr($array["{$index}"], 0, $maxlength);
20        $input = mysql_real_escape_string($input, $connection);
21        return ($input);
22    }
23    return NULL;
24  }
25
26  function shellclean($array, $index, $maxlength)
27  {
28    if (isset($array["{$index}"]))
29    {
30      $input = substr($array["{$index}"], 0, $maxlength);
31      $input = EscapeShellArg($input);
32      return ($input);
33    }
34    return NULL;
35  }
36?>




::)  Oh man I've renamed the function only to receive the same message.  I renamed the file and received the same message :'( I removed the function from the file and ran the script again and this is the message received....

Fatal error: Cannot redeclare mysqlclean() (previously declared in D:\inetpub\vhosts\etest.com\httpdocs\connect\test.php:10) in D:\inetpub\vhosts\etest.com\httpdocs\connect\test.php on line 10

I'm thinking there is something on my HOST provider's server (like cache????) that may be causing these messages. I could be crazy though :o

I checked mysqlclean and nothing else in any of the included files have been declared as mysqlclean.... :-\
Yeah ...
I ran the code like you suggested and I did get a lot of functions, but this looks most interesting.......

[user] => Array
        (
            [0] => authenticateuser
            [1] => registerlogin
            [2] => unregisterlogin
            [3] => sessionauthenticate
            [4] => showerror
            [5] => mysqlclean
            [6] => shellclean
        )
Ok its time for me to get educated...What is driving this list???
that list is grabbed by get_defined_functions(), which grabs all currently defined functions in the PHP script.  not too sure what to tell you, if you put that line at the top of your php file.  are you including any other scripts before calling the exit() line?

those are all the custom functions defined by the user at that point of script execution.  if you're not including anything in that file itself, it could be an auto-appendage?  what code is on the file that spits out that list?
I put the script you provided on line three of the script I orginally posted.......

Yeah all of those are related to different pages on my site, but it still doesn't get me any closer to why the already defined error message is showing. 

I checked and rechecked for already defined items and theres nothing. :o But then again I may be crazy and not the gods.....

So I sent an email to my HOST support tech...mmmm...waiting....waiting...waiting......we will see if that gets me any where. 

In the mean time I will search all files on my site to see if I can find an already defined item.


try running:

[code]<?php
phpinfo();
?>[/code]

and also:

[code]<?php
echo ini_get('auto_prepend_file');
?>[/code]

and see if anything returns.  the only way i can think of these being defined before you yourself include anything (or define anything) is if a file is automatically prepended to all scripts.
nothing was returned and everything looks good in the phpinfo file....

OBTW - thanks for the education on the defined functions listing ...I reviewed and reviewed it and its making sense... ;D but I haven't found where they have been defined....

It will have to wait for now.  Your one smart cookie.  Thanks for your help!  I'll follow up with resolution once I can get back at it.



:o

Welp I figured it out.  I was calling my database on the page that opens after I authenticate the logged in user.  I should have had only the authentication.inc file at the top of this page and session_start() and my defined function of sessionAuthenticate().  Wam Bam thank you mam!

I learned a lot and my new motto is...

There is no failure, only feed back....

Thanks again Joe Haily and akitchin for holding my hand as I walk through my darkness of PHP ;)

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.