Archive for April, 2007

Chapter 4: Architecture of an Intranet (Web hosting plans) Application If

Monday, April 30th, 2007

Chapter 4: Architecture of an Intranet Application If the query is successful, it returns the result object. The result object can be used to fetch rows. For example, the test_query.php script tries to fetch data from a table called PROD_TBL using a database URL such as mysql://root:foobar@localhost/products. Note: In case you are looking for affordable and reliable webhost to host and run your business application check Vision php5 hosting services

Part II: Developing Intranet Solutions // Dump the (Web server on xp)

Monday, April 30th, 2007

Part II: Developing Intranet Solutions // Dump the contents of the DBI object to // see what it contains. echo

   ; print_r($dbi); echo    

; ?> Here, $dbi is an instance of the DBI object created from class.DBI.php. The constructor method has to be passed a database URL which has the following syntax: database_type://username:password.tabase_host/database_name The $DB_URL variable was set to create a database URL that pointed to a MySQL database (mysql) named mydb on host called localhost The database can be accessed using the root user account and foobar password. The DBI() method sets the DB URL passed to itself as db_url member variable and calls the connect() method to connect to the given database. The constructor sets the fetch mode to DB_FETCHMODE_OBJECT, which allows us to fetch database rows as objects. . connect(): By default, the DBI() constructor method calls the connect() function directly to establish the connection, so you don t need to. connect() connects to the database specified in db_url member variable of the object. It sets a member variable dbh to the database handle object created by the DB::connect() method, which is found in the PEAR DB package. connect also sets a member variable called connected to Boolean TRUE or FALSE and returns that value. . disconnect(): The disconnect() function disconnects the DBI object from the database. The terminate() function in PHPApplication class (class. PHPApplication.php) calls the disconnect() function if the application is connected to a database. See terminate() function in PHPApplicationclass for details. . query(): This function performs a SQL query on the connected database. The result of the query is stored in a result object called $result. If the query returns SQL error(s), a member variable called $this->dbi->error is set to the error message and null is returned.
Note: If you are looking for cheap and reliable webhost to host and run your web application check Vision coldfusion web hosting services

Chapter 4: Architecture of an Intranet Application // (Cheapest web hosting)

Monday, April 30th, 2007

Chapter 4: Architecture of an Intranet Application // setting below. $PEAR_DIR = $_SERVER[ DOCUMENT_ROOT ] . /pear ; // If you have installed PHPLIB in a different // directory than %DocumentRoot%/phplib, change // the setting below. $PHPLIB_DIR = $_SERVER[ DOCUMENT_ROOT ] . /phplib ; // If you have installed framework directory in // a different directory than // %DocumentRoot%/framework, change the setting below. $APP_FRAMEWORK_DIR=$_SERVER[ DOCUMENT_ROOT ] . /framework ; // Create a path consisting of the PEAR, // PHPLIB and our application framework // path ($APP_FRAMEWORK_DIR) $PATH = $PEAR_DIR . : . $PHPLIB_DIR . : . $APP_FRAMEWORK_DIR; // Insert the path in the PHP include_path so that PHP // looks for our PEAR, PHPLIB and application framework // classes in these directories ini_set( include_path , : . $PATH . : . ini_get( include_path )); // Now load the DB.php class from PEAR require_once DB.php ; // Now load our DBI class from application framework // directory require_once( class.DBI.php ); // Set the database URL to point to a MySQL // database. In this example, the database is // pointing to a MySQL database called auth on // the localhost server, which requires username // (root) and password (foobar) to login $DB_URL = mysql://root:foobar@localhost/auth ; // Create a DBI object using our DBI class // Use the database URL to initialize the object // and make connection to the database $dbi = new DBI($DB_URL);
Note: If you are looking for high quality webhost to host and run your jsp application check Vision christian web host services

Web design - Part II: Developing Intranet Solutions Listing 4-1 (Continued)

Monday, April 30th, 2007

Part II: Developing Intranet Solutions Listing 4-1 (Continued) $this->error_type = $TABLE_UNKNOWN_ERROR; } } function isError() { return (!empty($this->error)) ? 1 : 0; } function isErrorType($type = null) { return ($this->error_type == $type) ? 1 : 0; } function getError() { return $this->error; } function quote($str) { return . $str . ; } function apiVersion() { return $VERSION; } } ?> Here are the functions the DBI class implements: . DBI(): This is the constructor method, which creates the instances of the DBI object. For example, here is a script called test_dbi.php that creates a DBI object. Note: If you are looking for cheap webhost to host and run your apache application check Vision apache web hosting services

Chapter 4: Architecture of an (Shared web hosting) Intranet Application {

Sunday, April 29th, 2007

Chapter 4: Architecture of an Intranet Application { return $this->connected; } function disconnect() { if (isset($this->dbh)) { $this->dbh->disconnect(); return 1; } else { return 0; } } function query($statement) { $result = $this->dbh->query($statement); if (DB::isError($result)) { $this->setError($result->getMessage()); return null; } else { return $result; } } function setError($msg = null) { global $TABLE_DOES_NOT_EXIST, $TABLE_UNKNOWN_ERROR; $this->error = $msg; if (strpos($msg, no such table )) { $this->error_type = $TABLE_DOES_NOT_EXIST; } else { Continued
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision best web hosting services

Part II: Developing Intranet Solutions Listing 4-1 (Continued) (Simple web server)

Sunday, April 29th, 2007

Part II: Developing Intranet Solutions Listing 4-1 (Continued) */ define( DBI_LOADED , TRUE); class DBI { var $VERSION = 1.0.0 ; function DBI($DB_URL) { $this->db_url = $DB_URL; $this->connect(); if ($this->connected == TRUE) { // set default mode for all resultset $this->dbh->setFetchMode(DB_FETCHMODE_OBJECT); } } function connect() { // connect to the database $status = $this->dbh = DB::connect($this->db_url); if (DB::isError($status)) { $this->connected = FALSE; $this->error = $status->getMessage(); } else { $this->connected = TRUE; } return $this->connected; } function isConnected()
Note: In case you are looking for affordable and reliable webhost to host and run your business application check Vision ftp web hosting services

Chapter 4: Architecture of an Intranet Application This (Adelphia web hosting)

Sunday, April 29th, 2007

Chapter 4: Architecture of an Intranet Application This framework is provided with the CD-ROM. You don t need to create it from scratch. Also note that the database abstraction uses DB.phpfrom the PEAR. Now let s create the classes needed to implement this application framework. Creating a Database Abstraction Class Accessing a database using its own API is common in the PHP world. For example, most PHP developers use PHP with MySQL and, therefore, they write code that is specific to the MySQL API found in PHP. There is nothing wrong with this approach if you know that your PHP applications will be used only for the MySQL database server. However, if there is a chance that your applications will be used with other databases such as Oracle, Postgres, and so forth, you need to avoid MySQL-specific API. A developer who has abstracted the database API in a level above the vendor-specific API can enjoy the speed of porting the application to different relational databases. Here, we will create a class called class.DBI.php that will implement a database abstraction layer for our application framework. Listing 4-1 shows class.DBI.php, which implements the database abstraction using PEAR DB. See http://pear.php.net/manual/en/core.db.phpfor details on PEAR DB, a unified API for accessing SQL-databases. Listing 4-1: class.DBI.php Note: If you are looking for best quality webspace to host and run your tomcat application check Vision tomcat hosting services

Florida web design - Part II: Developing Intranet Solutions The application checks

Saturday, April 28th, 2007

Part II: Developing Intranet Solutions The application checks for valid user credentials in the authentication phase, which is already supplied by the framework s login application for valid users. The authorization step involves application-specific privilege management. Not all valid (authenticated) users are likely to have the same privilege based on the type of application. For example, an Employee Information System (EIS) application in an engineering firm can assign different privileges to executive management, department heads, team leaders, and engineers. This is why the authorization code is specific to the instance of the application and should be written by the application developer and should not be provided by the framework. When an application has gone through the authentication and authorization phases, it will run the application. This code will involve invoking application specific business objects and database interaction. The application will have database access via the database-independent abstraction and also will produce status messages and errors using the facilities provided by the framework. Figure 4-5 shows a real-world application framework that we will create in this chapter. DB.php (from PEAR) class.PHPApplication.php class.Debugger.php class.ErrorHandler.php class.DBI.php Your PHP Application Business Logic Figure 4-5: A real-world PHP Application Framework. The core of this framework is the class.PHPApplication.php. This class provides an abstract PHP application that you can extend to incorporate facilities provided by the error handler (class.ErrorHandler.php), the debugger (class.Debugger.php), and the database abstraction (class.DBI.php).
Note: In case you are looking for affordable and reliable webhost to host and run your business application check Vision ftp web hosting services

Chapter 4: Architecture of an Intranet Application .

Saturday, April 28th, 2007

Chapter 4: Architecture of an Intranet Application . Override authorization support: Each application using the intranet application defines its own authorization method. . Debugging support: An application needs to be debugged many times during the development process. Because debugging is a core part of the development process, the framework includes a built-in debugger. The current implementation is very simple yet useful. . Internationalized error and status message handling support: Each application using the framework must use a central error message and status message repository. Both error and status messages can be internationalized. Business logic Each application has its own business-logic requirements. The business-logic objects will be given database connectivity from the application framework. This ensures that database abstraction is maintained. Relational database The relational database access is abstracted from the application using an abstraction layer, which is part of the application framework. This ensures that application database requirements can change without drastically affecting the application. For example, an application can be developed with this framework such that it works with the widely used, high-performance MySQL database and then deployed in an environment where the database is Oracle. Of course, the developers have to be careful not to use any vendor-specific features. Figure 4-4 shows a block diagram of an application that uses the previously mentioned application framework. Application Specific Error and Status Messages (Supports Internationalization) Database Independent Abstraction Authentication (Valid User Credentials) Authorization (Application Specific Authorization Requirements) Application Run() (Application Specific Driver Code) Business Logic Objects (Application Specific Code) Figure 4-4: A block diagram of an application using the PHP Application Framework.
Note: If you are looking for cheap webhost to host and run your apache application check Vision jboss web hosting services

Part II: Developing Intranet Solutions Relational Database Business (Managed web hosting)

Saturday, April 28th, 2007

Part II: Developing Intranet Solutions Relational Database Business Logic Your PHP Application PHP Application Framework Components HTML Template-based Presentation Layer INPUT OUTPUT Figure 4-3: High-level architecture diagram of an intranet application using our framework. Using an HTML template-based presentation layer All input and output to and from the application is handled via a template-driven HTML presentation layer. When the application needs input from the user, it presents an HTML page generated from an appropriate HTML template. Similarly, when the application needs to display output, it generates an HTML page by replacing special application-specific tags within the template. This ensures that cosmetic changes to the input or output interfaces can be done without requiring help from the application developer. For example, an application that uses the template-based presentation layer can have its interface modified by an HTML writer or graphics artist. Using PHP Application Framework components The components in the PHP Application Framework (PHPAF) layer implement the base application by providing the following services: . Database abstraction support: See the Relational database section later in this chapter for details. . Centralized authentication support: All applications defer the login and logout to the central authentication facility, as discussed earlier in this chapter.
Note: If you are looking for reliable webhost to maintain and run your java application check Vision java hosting services