WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Class: Info on Users, Servers and the running script
Categories : PHP, Classes and Objects, User Interface, PHP Classes Click here to Update Your Picture
leaping langoor
Date : Apr 23rd 2005
Grade : 3 of 5 (graded 4 times)
Viewed : 3867
File : No file for this code example.
Images : No Images for this code example.
Search : More code by leaping langoor
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

OK, I was thinking I'd make a script for recording access to my server when I got this Idea to make a script to display the info abt the users or the server or the running script. Pass the variable depending on the need

info.php
/*********************************************
** class info
**
** Author.: leapinglangoor
** Date...: 9th April 2005
** version: v1.00
**
** Params.: You'll have to send a parameter $topic
** which can be:
**
** server
** user
** script
** all ( default )
**
** As the name suggests, they give info on the
** particular topics.
**
************************************************/


class info
{

    function print_info( $topic = 'all' )
    {
        $list = array();

        // Define the properties to be shown
        // Modify it if needed

        if( $topic == 'server' )
        {

            $list = array( 'SERVER_NAME', 'SERVER_SOFTWARE', 'SERVER_PROTOCOL', 'SERVER_PORT', 'SERVER_SIGNATURE' );

        }
        else if( $topic == 'user' )
        {

            $list = array( 'REMOTE_ADDR', 'REMOTE_HOST', 'REMOTE_PORT', 'HTTP_USER_AGENT', 'HTTP_REFFERER', 'HTTP_REQUEST', 'PHP_AUTH_USER', 'PHP_AUTH_PW' );

        }
        else if( $topic == 'script' )
        {

            $list = array( 'SCRIPT_FILENAME', 'SCRIPT_NAME', 'DOCUMENT_ROOT', 'QUERY_STRING', 'REQUEST_METHOD', 'REQUEST_TIME' );

        }
        else
        {

            $list = array( 'SERVER_NAME', 'SERVER_SOFTWARE', 'SERVER_PROTOCOL', 'SERVER_PORT', 'SERVER_SIGNATURE', 'REMOTE_ADDR', 'REMOTE_HOST', 'REMOTE_PORT', 'HTTP_USER_AGENT', 'HTTP_REFFERER', 'HTTP_REQUEST', 'PHP_AUTH_USER', 'PHP_AUTH_PW', 'SCRIPT_FILENAME', 'SCRIPT_NAME', 'DOCUMENT_ROOT', 'QUERY_STRING', 'REQUEST_METHOD', 'REQUEST_TIME' );

        }       

        for( $i = 0; $i < count( $list ); $i++ )
        {
            echo $i . ' ' . $list[$i] . ' = ' . $_SERVER["$list[$i]"] . '<br />';
        }
    }
}
?>



Example:
<?php

include( 'info.php' );
$i = new info;
$i->print_info( 'server' ); //You can also send user or script or all instead os server
?>



MySQL Handler
Categories : PHP, Databases, MySQL, Classes and Objects, PHP Classes
ECHO-PHP Class Real Time Transaction Processor v1.4.4 for Credit Cards and Checks / ACH
Categories : PHP Classes, Cybercash, Classes and Objects, Ecommerce, PHP
Online Automatic Class Generator for MySQL Tables
Categories : PHP, PHP Classes, Classes and Objects, Databases, MySQL
An efficient iterative and buffered text file reader
Categories : PHP, Classes and Objects, Filesystem, PHP Classes, Log Files
Access_user Class - an easy to use system for protecting pages and register users.
Categories : PHP, Classes and Objects, Object Oriented, PHP Classes, Authentication
Mssql database Manager
Categories : PHP, Databases, MS SQL Server, Classes and Objects, PHP Classes
PHP CLASS for ORACLE (database connectivity)
Categories : PHP, PHP Classes, Classes and Objects, Databases, Oracle
Reflection Examples - Their main goal is show how to use PHP's reflection classes re-implementing some php standard functions using reflection.
Categories : PHP, PHP Classes, Classes and Objects
ClassFuncDoc - This script is a classes and functions documentation tool.
Categories : PHP, Classes and Objects, Documentation, PHP Classes, Complete Programs
file class , uploade file , download file already uploaded on another website
Categories : PHP, PHP Classes, Filesystem, Web Services
Authorize.net AIM Interface Class v1.0.0
Categories : PHP, PHP Classes, Ecommerce, Payment Gateways
crop and resize image class using gd library function
Categories : PHP, PHP Classes, GD image library, Graphics
News management class
Categories : PHP, PHP Classes, Beginner Guides
A Timing Class
Categories : PHP, PHP Classes, Date Time
The class to check load time of your script VERY usefull for relatively slow applications, but not only..
Categories : PHP, PHP Classes, Debugging
 Ariel Filipiak wrote : 1310
Hello from Argentina

Excuse me cause I`m novice. Why the most of developers use classes when just a few funtions are needed?
Someone can answer me, please?

For example, the same process could be more simple and quickly in this way:

&lt;?php

function print_info($topic = `all`) { 
    
    switch ($topic) {
        case `server`: 
            $list = array( `SERVER_NAME`, `SERVER_SOFTWARE`, `SERVER_PROTOCOL`, `SERVER_PORT`, `SERVER_SIGNATURE` ); break;
        case `user`: 
            $list = array( `REMOTE_ADDR`, `REMOTE_HOST`, `REMOTE_PORT`, `HTTP_USER_AGENT`, `HTTP_REFFERER`, `HTTP_REQUEST`, `PHP_AUTH_USER`, `PHP_AUTH_PW` ); break;
        case `script`: 
            $list = array( `SCRIPT_FILENAME`, `SCRIPT_NAME`, `DOCUMENT_ROOT`, `QUERY_STRING`, `REQUEST_METHOD`, `REQUEST_TIME` ); break;
        default:
            $list = array( `SERVER_NAME`, `SERVER_SOFTWARE`, `SERVER_PROTOCOL`, `SERVER_PORT`, `SERVER_SIGNATURE`, `REMOTE_ADDR`, `REMOTE_HOST`, `REMOTE_PORT`, `HTTP_USER_AGENT`, `HTTP_REFFERER`, `HTTP_REQUEST`, `PHP_AUTH_USER`, `PHP_AUTH_PW`, `SCRIPT_FILENAME`, `SCRIPT_NAME`, `DOCUMENT_ROOT`, `QUERY_STRING`, `REQUEST_METHOD`, `REQUEST_TIME` ); 
    }
    for($i=0; $i&lt;count($list); $i++ ) { 
        echo "$i.- $list[$i] = ".$_SERVER[$list[$i]]."&lt;br&gt;\n"; 
    } 


// Example: 
print_info();

?&gt; 

Thank you
Ariel Filipiak
 
 Boaz Yahav wrote :1311
I think that the best place to as this would be http://www.weberforums.com