function encode($string) { $secString = md5("geheim"); $length = strlen($string); $pos = rand(0,$length); $string = base64_encode($string); $secured = ''; for($i=0;$i<=$length;$i++) { if( $i == $pos ) { $secured .= $secString.$string[$i]; } else { $secured .= $string[$i]; } } return $secured; } function decode($string) { $secString = md5("geheim"); $string = str_replace($secString,"",$string); $string = base64_decode( $string ); return $string; }