/** * Method setDatabase() * * Define the database for store the NASP data * * @param string $hostname The hostname or IP of the server's database * @param string $database The database's name * @param string $user The database'user * @param string $pass The database's password for the user specify * @access public */ public function setDatabase($hostname = null, $database = null, $user = null, $pass = null) { //Makes the connection self::$conn = DBConnection::open($hostname, $database, $user, $pass); }
<?php /** * Template to use with service MoIP NASP * * @author Alê Borba <*****@*****.**> * @version 0.0.1 * @license <a href="http://www.opensource.org/licenses/bsd-license.php">BSD License</a> */ //Include the autoload function include_once 'autoload.inc.php'; //Uses the MoIPNASP class to record the informations in a file //Instance new object MoIPNASP() $nasp = new MoIPNASP(); //Set the path and filename $nasp->setFile("your_path", "your_filename"); //Set the array of contents $nasp->setContent($_POST); //Write the informations $nasp->write();
* Template to make tha NASP configuration more easy * * @author Alê Borba <*****@*****.**> * @version 0.0.1 * @license <a href="http://www.opensource.org/licenses/bsd-license.php">BSD License</a> */ //Get the flag sended via $_GET $infos = isset($_GET['config']) && $_GET['config'] == true ? $_GET['config'] : false; if ($infos) { include_once 'autoload.inc.php'; //Get the informations sended via $_POST $hostname = isset($_POST['dbhost']) ? $_POST['dbhost'] : null; $database = isset($_POST['dbname']) ? $_POST['dbname'] : null; $user = isset($_POST['dbuser']) ? $_POST['dbuser'] : null; $pass = isset($_POST['dbpass']) ? $_POST['dbpass'] : null; $nasp = new MoIPNASP(); $nasp->setDatabase($hostname, $database, $user, $pass); $nasp->createTable(); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>NASP's Database Configuration</title> <style type="text/css"> .conteudo{ width: 75%; margin: auto; margin-top: 100px; }