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

config/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
   function URL()
10
  {
11
    $http = "http://";
12
    @$host = $_SERVER['SERVER_NAME'];
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
13
    @$port = $_SERVER['SERVER_PORT'];
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
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
23