Advertisement
Guest User

con

a guest
Jan 8th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. <?php  
  2.        
  3.         /*
  4.         $servername = "localhost";
  5.         $username = "id7460254_root";
  6.         $password = "123456";
  7.         $dbname = "id7460254_jesusmestre"; //bd_mestre user do godady
  8.         */
  9.            
  10.         $dbhost     = "localhost";
  11.         $dbname   = "jesusmestre";
  12.         $dbuser     = "m3stre";
  13.         $dbpass     = "j3susmestre";
  14.         $dbport = "3306";
  15.  
  16.         if (strlen($dbport) < 4) { $dbport = 3306; }
  17.         if (!function_exists('gethostname')) {
  18.             $hostname = `hostname`;
  19.             $hostnamearray = explode('.', $hostname);
  20.             $hostname = $hostnamearray[0];
  21.         }
  22.         else $hostname = gethostname();
  23.         // Check to see if mysqli is available
  24.         if (!extension_loaded('mysqli') or $_POST['config'] == "mysql") {
  25.             $dbhost = $dbhost.':'.$dbport;
  26.             // Create connection
  27.             $con = @mysql_connect($dbhost,$dbuser,$dbpass);
  28.             // Check connection
  29.             if (mysql_error()) {
  30.                 die("Failed to connect to MySQL using the PHP mysql extension: " . mysql_error());
  31.             }          
  32.         }
  33.         else {
  34.             // Create connection
  35.             $con = @mysqli_connect($dbhost,$dbuser,$dbpass,$dbname,$dbport);
  36.             // Check connection
  37.             if (mysqli_connect_errno()) {
  38.                 die ("Failed to connect to MySQL using the PHP mysqli extension: " . mysqli_connect_error());
  39.             }          
  40.            
  41.    }
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement