Categories
Snippet Starters

AJAX

Nice example of a post request to another page and the returned data.

xhttp.onreadystatechange = function() 
{
  if (this.readyState == 4 && this.status == 200) 
  {
    alert(this.responseText);
  }
};
xhttp.open("POST", "doworkpage.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("parameter1=example&parameter2=moreexample"); 
Categories
Applications

Connection String Reference

Connection string file location relative to the applications install directory, and the example connection information we will use is exampleuser, exampledbname, examplepassword, and localhost.

WordPress
File: /wp-config.php
Example:

define('DB_NAME', 'exampledbname');
define('DB_USER', 'exampleuser');
define('DB_PASSWORD', 'examplepassword');
define('DB_HOST', 'localhost');

Drupal
File: /sites/default/settings.php
Example:

$db_url = 'mysql://exampleuser:examplepassword@localhost/exampledbname';

Joomla
File: /configuration.php
Example:

public $host = 'localhost';
public $user = 'exampleuser';
public $password = 'examplepassword';
public $db = 'exampledbname';

OpenCart
File: /config.php
File: /admin/config.php
Example:

define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'exampleuser');
define('DB_PASSWORD', 'examplepassword);
define('DB_DATABASE', 'exampledbname);

Magento
File: /app/etc/local.xml
Example:

<host><![CDATA[localhost]]></host>
<username><![CDATA[exampleuser]]></username>
<password><![CDATA[examplepassword]]></password>
<dbname><![CDATA[exampledbname]]></dbname>

Concrete5
File: /application/config/database.php
Example:

'connections' => array(
      'concrete' => array(
            'driver' => 'c5_pdo_mysql',
            'server' => 'localhost',
            'database' => 'exampledbname',
            'username' => 'exampleuser',
            'password' => 'examplepassword',
            'charset' => 'utf8'
     )

Zen Cart
File: /includes/configure.php
File: /admin/includes/configure.php
Example:

define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', 'exampleuser');
define('DB_SERVER_PASSWORD', 'examplepassword');
define('DB_DATABASE', 'exampledbname');

phpBB
File: /config.php
Example:

$dbhost = 'localhost';
$dbname = 'exampledbname';
$dbuser = 'exampleuser';
$dbpasswd = 'examplepassword';

TYPO3
File: /typo3conf/LocalConfiguration.php
Example:

'DB' => [
      'Connections' => [
            'Default' => [
                  'charset' => 'utf8',
                  'dbname' => 'exampledbname',
                  'driver' => 'mysqli',
                  'host' => 'localhost',
                  'password' => 'examplepassword',
                  'port' => 3306,
                  'user' => 'exampleuser',
            ],
      ],
],

Moodle
File: /config.php
Example:

$CFG->dbhost = 'localhost'; // eg 'localhost' or 'db.isp.com' or IP
$CFG->dbname = 'exampledbname'; // database name, eg moodle
$CFG->dbuser = 'exampleuser'; // your database username
$CFG->dbpass = 'examplepassword'; // your database password
$CFG->prefix = 'exampletableprefix_'; // prefix to use for all table names