Blame Scripts/CentOS-Web/admin/includes/functions/url.php

1f953a
1f953a
/***
1f953a
 * URL's functions
1f953a
 *
1f953a
 */
1f953a
1f953a
1f953a
//-----------/* Sanitize URL variables */
1f953a
    
1f953a
    function sanitize_url_var( $name )
1f953a
    {
1f953a
        if ( ! preg_match( '/^(page|action|id)$/', $name ) )
1f953a
        {
1f953a
            return false;
1f953a
        }
1f953a
1f953a
        switch ( $name )
1f953a
        {
1f953a
            case 'page': 
1f953a
                if ( isset($_GET[$name]) && preg_match( '/^(users|pages|categories|comments|entries|links)$/', $_GET[$name] ) )
1f953a
                {
1f953a
                    return true;
1f953a
                }
1f953a
                else
1f953a
                {
1f953a
                    return false;
1f953a
                }
1f953a
            break;
1f953a
1f953a
            case 'action':
1f953a
                if ( isset( $_GET[$name] ) && preg_match( '/^(update|add|tree|logout)$/', $_GET[$name] ) )
1f953a
                {
1f953a
                    return true;
1f953a
                }
1f953a
                else
1f953a
                {
1f953a
                    return false;
1f953a
                }
1f953a
            break;
1f953a
1f953a
            case 'id':
1f953a
                if ( isset( $_GET[$name] ) && preg_match( '/^[0-9]+$/', $_GET[$name] ) )
1f953a
                {
1f953a
                    return true;
1f953a
                }
1f953a
                else
1f953a
                {
1f953a
                    return false;
1f953a
                }
1f953a
            break;
1f953a
        }
1f953a
    }
1f953a
?>