This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Feature Request: Modify MySQL Server display on Errors


  1. kwbrayton
    Member

    Just happened to call up a form today against the MySQL Server that had been taken down for maintenance. When the MachForms attempted to connect to the server, it throw the following error message:

    Could not connect: Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (10060)PHP Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (10060) in D:\Inetpub\Public\mf\includes\db-core.php on line 11

    My concern about this message is that this message displays both the DB_HOST value and the location of the db-core-php file. These seem like useful bits for hackers. It might be nice to be able to suppress revealing all this detail by turning off error reporting and/or crafting less revealing messages.

    As an example, I've replace the function connect_db() in db-core.php with this code:

    function connect_db(){
    		$link = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    /* or die('Could not connect: ' . mysql_error()); */
                    if(!$link)
                    {
                            echo "ERROR: Cannot connect to database. Please try again later!";
                            exit;
                    }
    		mysql_select_db(DB_NAME) or die('Could not select database');
    		mysql_query("SET NAMES utf8");
    		return $link;
    	}
    Posted 15 years ago #
  2. yuniar

    Thanks for the feedback on this. We should get this cleaned within the next update.


    MachForm Founder

    Posted 15 years ago #

RSS feed for this topic

Reply