Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- $servername = "localhost";
- $username = "id7460254_root";
- $password = "123456";
- $dbname = "id7460254_jesusmestre"; //bd_mestre user do godady
- */
- $dbhost = "localhost";
- $dbname = "jesusmestre";
- $dbuser = "m3stre";
- $dbpass = "j3susmestre";
- $dbport = "3306";
- if (strlen($dbport) < 4) { $dbport = 3306; }
- if (!function_exists('gethostname')) {
- $hostname = `hostname`;
- $hostnamearray = explode('.', $hostname);
- $hostname = $hostnamearray[0];
- }
- else $hostname = gethostname();
- // Check to see if mysqli is available
- if (!extension_loaded('mysqli') or $_POST['config'] == "mysql") {
- $dbhost = $dbhost.':'.$dbport;
- // Create connection
- $con = @mysql_connect($dbhost,$dbuser,$dbpass);
- // Check connection
- if (mysql_error()) {
- die("Failed to connect to MySQL using the PHP mysql extension: " . mysql_error());
- }
- }
- else {
- // Create connection
- $con = @mysqli_connect($dbhost,$dbuser,$dbpass,$dbname,$dbport);
- // Check connection
- if (mysqli_connect_errno()) {
- die ("Failed to connect to MySQL using the PHP mysqli extension: " . mysqli_connect_error());
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement