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?>




Link to comment
Share on other sites

::)  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.... :-\
Link to comment
Share on other sites

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???
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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.


Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.



Link to comment
Share on other sites

: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 ;)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.