salt

Gesponsorde koppelingen

PHP script bestanden

  1. salt

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?php

// gebruik:
// <a href="actie.php?actie=' . salt('v') . '">Verwijder</a>


// Sessie zetten

if(!isset($_SESSION['salt']))
    {

    $_SESSION['salt'] = mt_rand(1, 19);
    }




// functie salt
function salt($string)
    {

    if(is_numeric($string))
        {

        return rand_num(3) . ($string * $_SESSION['salt']) . rand_num(3);
        }

    else
        {
        $salt = rand_alfa(20);
        return $salt{$_SESSION['salt']} = $string;
        }
    }


// functie unsalt
function unsalt($salt)
    {

    if(is_numeric($salt))
        {

        $salt = substr($salt, 3);
        $salt = substr($salt, 0, -3);
        return ($salt / $_SESSION['salt']);
        }

    else
        {
        return substr($salt, $_SESSION['salt'], 1);
        }
    }

    
    




// functie rand_alfa
function rand_alfa($lengte = 9)
    {

    return substr(md5(time() . "salt"), 0, $lengte);    
    }


// functie rand_num
function rand_num($lengte = 9)
    {

    return substr(mt_rand(9999999999, 99999999999999), 0, $lengte);    
    }

    
    
?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.