示例#1
0
     } elseif ($dbConnections->db_username == '') {
         //return an error message..and do nothing else!
         $error_messages = 'Please Enter the Database Username and then press the "Save / Test" button';
     } elseif ($dbConnections->db_password == '') {
         //return an error message..and do nothing else!
         $error_messages = 'Please Enter the Database Password and then press the "Save / Test" button';
     } else {
         //check it doesn't already exist
         if (file_exists("./db_connect/{$dbConnections->db_connection_name}.php")) {
             //return an error message..and do nothing else!
             $error_messages = 'This Database Connection Already Exists!';
         } else {
             //Generate the connection script
             $dbConnections->con_script();
             //build it!
             $dbConnections->write_db_connection_to_file();
             //change this so the db list shows the correct connection
             $db_connection_list = "{$dbConnections->db_connection_name}.php";
             // $dbConnections->select_list_connection_form_value=$_POST['db_connection_list'];
             //now load it
             require "./db_connect/{$dbConnections->db_connection_name}.php";
         }
     }
 } else {
     //not creating a new connection but loading or updating an existing one
     //check it exists
     if (!file_exists("./db_connect/{$dbConnections->select_list_connection_form_value}")) {
         //return an error message..and do nothing else!
         $error_messages = "ERROR! This Database Connection File ({$dbConnections->select_list_connection_form_value}) is Missing!";
     } else {
         //update the DB Connection by firstly generating the connection script