Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
Config.php April 06, 2013 10:01AM |
Registered: 11 years ago Posts: 33 Rating: 0 |
Language: PHP<?php // Connection';s Parameters $db_host="localhost"; $db_name="database_name"; $username="database_username"; $password="database_password"; $db_con=mysql_connect($db_host,$username,$password); $connection_string=mysql_select_db($db_name); // Connection mysql_connect($db_host,$username,$password); mysql_select_db($db_name); ?>
Language: PHP<?php $conf[';db_hostname';] = "localhost"; $conf[';db_username';] = "username"; $conf[';db_password';] = "password"; $conf[';db_name';] = "sample"; ?>
Language: PHP<?php // MySQL connect information. $c_username = ""; // database username $c_password = ""; // database password $c_host = ""; // database host $c_database = ""; // database name // connecting to the database $connection = mysql_connect($c_host, $c_username, $c_password) or die ("It seems this site';s database isn';t responding."); mysql_select_db($c_database) or die ("It seems this site';s database isn';t responding."); ?>
Re: Config.php April 06, 2013 12:57PM |
Registered: 11 years ago Posts: 131 Rating: 0 |
Re: Config.php April 08, 2013 05:37AM |
Registered: 11 years ago Posts: 33 Rating: 0 |
Re: Config.php April 08, 2013 08:42AM |
Registered: 11 years ago Posts: 163 Rating: 0 |
Re: Config.php April 09, 2013 05:28PM |
Registered: 11 years ago Posts: 33 Rating: 0 |
Language: PHP$conf[';db_hostname';] = "localhost"; $conf[';db_username';] = "username"; $conf[';db_password';] = "password"; $conf[';db_name';] = "sample"; $conf[';db_type';] = "mysql"; $conf[';db_prefix';] = "exp";
Language: PHPclass autoloader { public static $loader; public static function init() { if(self::$loader == NULL) { self::$loader = new self(); } return self::$loader; } public function __construct() { spl_autoload_register(array(this, ';library';)); spl_autoload_register(array(this, ';controller';)); spl_autoload_register(array(this, ';helper';)); spl_autoload_register(array($this, ';model';)); } public function library($class) { set_include_path(get_include_path() . PATH_SEPARATOR . ';/lib';); spl_autoload_extensions(';.php';); spl_autoload($class); } public function controller($class) { set_include_path(get_include_path() . PATH_SEPARATOR . ';/controller';); spl_autoload_extensions(';.php';); spl_autoload($class); } public function helper($class) { set_include_path(get_include_path() . PATH_SEPARATOR . ';/helper';); spl_autoload_extensions(';.php';); spl_autoload($class); } public function model($class) { set_include_path(get_include_path() . PATH_SEPARATOR . ';/model';); spl_autoload_extensions(';.php';); spl_autoload($class); } }
Don't worry about people viewing your database password, all php variables are purely server-side, and no php code or variables can be viewed by a client unless explicitly echoed out.Language: PHPrequire_once("./config.php");
Re: Config.php April 15, 2013 11:43PM |
Registered: 11 years ago Posts: 34 Rating: 0 |
Re: Config.php April 24, 2013 06:37AM |
Registered: 11 years ago Posts: 38 Rating: 0 |
Re: Config.php April 24, 2013 08:50AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Config.php April 24, 2013 11:57AM |
Registered: 11 years ago Posts: 70 Rating: 0 |
Language: PHP<?php $user_name = "root"; $pass_word = ""; $database = "registration"; $server = "127.0.0.1"; $db_handle=mysql_connect($server,$user_name,$pass_word); $db_found=mysql_select_db($database,$db_handle); ?>
Re: Config.php April 24, 2013 10:34PM |
Registered: 11 years ago Posts: 34 Rating: 0 |