[php] register globals

Pagina: 1
Acties:
  • 53 views sinds 30-01-2008

  • pdehoop
  • Registratie: September 1999
  • Laatst online: 04-06-2024
phpBB heeft volgens mij de volgende functie om het probleem met de registerglobals op te lossen:

PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
if( !get_magic_quotes_gpc() )
{
    if( is_array($HTTP_GET_VARS) )
    {
        while( list($k, $v) = each($HTTP_GET_VARS) )
        {
            if( is_array($HTTP_GET_VARS[$k]) )
            {
                while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
                {
                    $HTTP_GET_VARS[$k][$k2] = addslashes($v2);
                }
                @reset($HTTP_GET_VARS[$k]);
            }
            else
            {
                $HTTP_GET_VARS[$k] = addslashes($v);
            }
        }
        @reset($HTTP_GET_VARS);
    }

    if( is_array($HTTP_POST_VARS) )
    {
        while( list($k, $v) = each($HTTP_POST_VARS) )
        {
            if( is_array($HTTP_POST_VARS[$k]) )
            {
                while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) )
                {
                    $HTTP_POST_VARS[$k][$k2] = addslashes($v2);
                }
                @reset($HTTP_POST_VARS[$k]);
            }
            else
            {
                $HTTP_POST_VARS[$k] = addslashes($v);
            }
        }
        @reset($HTTP_POST_VARS);
    }

    if( is_array($HTTP_COOKIE_VARS) )
    {
        while( list($k, $v) = each($HTTP_COOKIE_VARS) )
        {
            if( is_array($HTTP_COOKIE_VARS[$k]) )
            {
                while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) )
                {
                    $HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2);
                }
                @reset($HTTP_COOKIE_VARS[$k]);
            }
            else
            {
                $HTTP_COOKIE_VARS[$k] = addslashes($v);
            }
        }
        @reset($HTTP_COOKIE_VARS);
    }
}


Nu heb ik dus zelf ook geprobeerd, maar bij mij werkt dit dus niet.
Heeft iemand hier eenzelfde soort stukje code voor?
Ik zoek dus iets dat automatisch alle variabelen met de juiste get of post methode worden benaderd. Dus niet handmatig alles toewijzen.

  • whoami
  • Registratie: December 2000
  • Laatst online: 16:11
Scriptrequest. En scriptrequests zijn niet toegelaten. Check de P&W FAQ maar.

https://fgheysels.github.io/


Dit topic is gesloten.