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 : Request Method Class - seful for situations like form processing or API development. Requires PHP5 for the magic __call() method.
Categories : PHP, PHP Classes, HTTP, Headers Click here to Update Your Picture
Alix Axel
Date : Apr 28th 2009
Grade : 3 of 5 (graded 2 times)
Viewed : 4980
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Alix Axel
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

<?php

class Request
{
    function
__call($method, $arguments)
    {
        if (
strcasecmp($method, $_SERVER['REQUEST_METHOD']) == 0)
        {
            return
true;
        }

        return
false;
    }

    function
Ajax()
    {
        return (
$this->Element($_SERVER, 'HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest') ? true : false;
    }

    function
Secure()
    {
        return (isset(
$_SERVER['HTTPS']) === true) ? true : false;
    }

    function
Session()
    {
        return (isset(
$_SESSION) === true) ? true : false;
    }
}
?>



Usage:
<?php
if (Request::Post())
{
   
// form submited, process it
}


if (
Request::Ajax() === true)
{
    echo
'Request is AJAX.';
}

if (
Request::Secure() === true)
{
    echo
'Request is SECURE.';
}

if (
Request::Session() === true)
{
    echo
'Request has SESSIONS.';
}

if (
Request::Connect() === true)
{
    echo
'Request was made using CONNECT.';
}

else if (
Request::Delete() === true)
{
    echo
'Request was made using DELETE.';
}

else if (
Request::Get() === true)
{
    echo
'Request was made using GET.';
}

else if (
Request::Head() === true)
{
    echo
'Request was made using HEAD.';
}

else if (
Request::Options() === true)
{
    echo
'Request was made using OPTIONS.';
}

else if (
Request::Post() === true)
{
    echo
'Request was made using POST.';
}

else if (
Request::Put() === true)
{
    echo
'Request was made using PUT.';
}

else if (
Request::Trace() === true)
{
    echo
'Request was made using TRACE.';
}
?>



Automatic Browsers Detect
Categories : PHP, PHP Classes, Headers, Browsers
Gonx Proxy - This class is meant to act as an HTTP proxy to serve pages of a remote server as if they were local pages.
Categories : PHP, PHP Classes, HTTP
Class that allows the PHP developer to create and manage UNIX like password files suitable for use as Apache authentication password files.
Categories : HTTP, PHP, PHP Classes, Filesystem
Easy upload class
Categories : PHP Classes, Filesystem, HTTP, PHP
Simple and fast user authentication
Categories : PHP, PHP Classes, Authentication
very simple ftp class
Categories : PHP, PHP Classes, FTP
Form Elements Class
Categories : PHP, PHP Classes, Form Processing
FormChecker Package - validate any data via classes and patterns.
Categories : PHP, Form Processing, PHP Classes, Regexps
XPath for PHP without the DOM XML extension
Categories : DOM XML, XML, XSLT, PHP Classes, PHP
Exploder class . Explodes a string into segments given any amount of delimiters. Can also esc characters.Useful for parsing query input from a form.
Categories : PHP Classes, HTTP
PHP Class to calculate Degrees Minutes Seconds to Decimal Degrees
Categories : PHP, PHP Classes, Geo Related, Beginner Guides
HTML_Graphs provides a simple PHP interface for creating pure HTML charts.
Categories : Graphics, PHP, PHP Classes, Charts and Graphs
Greatest Common Denominator - A simple class that finds the greatest common denominator for two integers.
Categories : PHP, PHP Classes, Math.
PHP4 HTTP Compression Speeds up the Web
Categories : PHP, Zlib, HTML and PHP, HTTP, Network
PHP Based Apache + Mysql Error Log Parser
Categories : PHP, PHP Classes, Apache, MySQL, Log Files