Test Setup Failed
Push — master ( a87e27...976b69 )
by Ankit
02:24
created

database.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
  // Define database connection constants
3
  define('DB_HOST', 'localhost');
4
  define('DB_USER', 'root');
5
  define('DB_PASSWORD','');
6
  define('DB_NAME', 'openchat');
7
  define('URL', URL());
8
9 View Code Duplication
   function URL()
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
  {
11
    $http = "http://";
12
    $host = $_SERVER['SERVER_NAME'];
13
    $port = $_SERVER['SERVER_PORT'];
14
    $fol = "";
15
    if(@$_SERVER['SERVER_ADDR']!=NULL)
16
    {
17
        $fol = explode('/', $_SERVER['PHP_SELF'])[1];
18
    }
19
    $url = $http.$host.":".$port."/".$fol;
20
    return $url;
21
  }
22
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
23