WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
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 Resources
Web Development Content
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

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 : 6539
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  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
?>



Mssql database Manager
Categories : PHP, Databases, MS SQL Server, 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
MySQL Handler
Categories : PHP, Databases, MySQL, Classes and Objects, PHP Classes
Access_user Class - an easy to use system for protecting pages and register users.
Categories : PHP, Classes and Objects, Object Oriented, PHP Classes, Authentication
ClassFuncDoc - This script is a classes and functions documentation tool.
Categories : PHP, Classes and Objects, Documentation, PHP Classes, Complete Programs
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
Online Automatic Class Generator for MySQL Tables
Categories : PHP, PHP Classes, Classes and Objects, Databases, MySQL
PHP CLASS for ORACLE (database connectivity)
Categories : PHP, PHP Classes, Classes and Objects, Databases, Oracle
An efficient iterative and buffered text file reader
Categories : PHP, Classes and Objects, Filesystem, PHP Classes, Log Files
SPL and ITERATOR : examples
Categories : PHP, Object Oriented, PHP Classes, Sessions
Three Cool Classes and One Trick
Categories : PHP, PHP Classes, Graphics, Email
XTemplate, a template class for PHP
Categories : PHP Classes, HTML and PHP, PHP
call_user_method -- Call a user method on an specific object
Categories : PHP, PHP Functions, Classes and Objects
AutoRSS
Categories : PHP, Rich Site Summary (RSS), PHP Classes
A Timing Class
Categories : PHP, PHP Classes, Date Time
 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