The protect() MD5 Form Fingerprint Generator : md5 « Utility Function « PHP






The protect() MD5 Form Fingerprint Generator

 
<?php

    define('PROTECTED_KEY', 'mysecretword');

    function my_addslashes($string) {
        return (get_magic_quotes_gpc() == 1) ? $string : addslashes($string);
    }

    function protect($name, $value, $secret) {
        $tag = "";
        $seed = md5($name.$value.$secret);
        $html_name = $name."_checksum";
        $tag = "<INPUT TYPE='hidden' NAME='$name' VALUE='" .
               urlencode(my_addslashes($value))."'>\n";
        $tag .= "<INPUT TYPE='hidden' NAME='$html_name' VALUE='$seed'>\n";
        return $tag;

    }
?>
  
  








Related examples in the same category

1.Checking for session hijacking
2.string md5 ( string str [, bool raw_output] )
3.string md5 ( string str [, bool raw_output] ) produces a data checksum in exactly the same way as sha1( );
4.Creating an md5 signature
5.PHP's basic md5() function
6.md5.php
7.Insert a unique ID into a form