Jump to content
Ancient Clan
Sign in to follow this  
Mathias

Common input functions

Recommended Posts

Note, all of my functions belong to classes, but I am posting only snippets of my functions to avoid boredom and giving away all my secrets. Please post corrections, suggestions, and your own related functions.


Understand this lad, fate is a fickle lady. Work with the hand you're dealt and you may just be able to run your flag up the pole. Don't, and well, you may just find your mast cut down.

Share this post


Link to post
Share on other sites


        //-----------------------------------------------------------------------
        // Function:    GetInput
        // Author:      Andrew Hinkle
        // Modified:    08/18/2007
        // Description: Return the merged $_GET and $_POST input.
        //-----------------------------------------------------------------------
        public function GetInput()
        {
            return array_merge((array)$_GET, (array)$_POST);
        }


Understand this lad, fate is a fickle lady. Work with the hand you're dealt and you may just be able to run your flag up the pole. Don't, and well, you may just find your mast cut down.

Share this post


Link to post
Share on other sites
        //-----------------------------------------------------------------------
        // Function:    CleanInput
        // Author:      Andrew Hinkle
        // Modified:    08/18/2007
        // Description: Return the cleaned array.
        //-----------------------------------------------------------------------
        public function CleanInput($aInput)
        {
            // Stripslashes
            if (is_array($aInput))
            {
                foreach ($aInput as $sKey => $sValue)
                {
                    // If magic quotes is on, it will automatically add backslashes.
                    // Remove the extra slashes.
                    $sValue = get_magic_quotes_gpc() ? stripslashes($sValue)  $sValue;
                    $aInput[$sKey] = !empty($sValue) && !is_null($sValue) ? trim($sValue)  "";
                }
            }
            else
            {
                // If magic quotes is on, it will automatically add backslashes.
                // Remove the extra slashes.
                $sValue = get_magic_quotes_gpc() ? stripslashes($aInput)  $aInput;
                $aInput = !empty($sValue) && !is_null($sValue) ? trim($sValue)  "";
            }

            return $aInput;
        }


Understand this lad, fate is a fickle lady. Work with the hand you're dealt and you may just be able to run your flag up the pole. Don't, and well, you may just find your mast cut down.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...