Exemplo n.º 1
0
function conv_codage($txt, $d, $enc)
{
    if ($d == 'utf8') {
        $ret = $enc ? utf8_encode(utf8_encode($txt)) : utf8_decode_b($txt);
    } elseif ($d == 'base64') {
        $ret = $enc ? base64_encode($txt) : base64_decode($txt);
    } elseif ($d == 'htmlentities') {
        $ret = $enc ? htmlentities($txt, ENT_QUOTES, 'ISO-8859-15', false) : html_entity_decode($txt);
    } elseif ($d == 'url') {
        $ret = $enc ? urlencode($txt) : urldecode($txt);
    } elseif ($d == 'unescape') {
        $ret = $enc ? $ret : unescape($txt, "");
    } elseif ($d == 'ascii') {
        if ($enc) {
            $ret = ascii_encode($txt);
        } else {
            $ret = mb_convert_encoding($txt, 'ASCII') . "\r";
        }
    } elseif ($d == 'binary') {
        $ret = $enc ? ascii2bin($txt) : bin2ascii($txt);
    } elseif ($d == 'bin/dec') {
        $ret = $enc ? decbin($txt) : bindec($txt);
    } elseif ($d == 'timestamp') {
        $ret = $enc ? strtotime($txt) : date('d/m/Y H:i:s', $txt);
    } elseif ($d == 'php') {
        $ret = clean_code($txt);
    }
    return stripslashes($ret);
}
Exemplo n.º 2
0
function mailto($email, $size, $font, $color, $bgcolor)
{
    $address = explode("@", $email, 2);
    $account = $address[0] . "@";
    $domain = $address[1];
    $hemail = hex_encode($email);
    $aemail = ascii_encode($email);
    $pathfile = DIR_HTTP_INCLUDES . "textimage.php";
    $output = <<<EOT
<script language="javascript">
<!-- 
var Domain = "{$domain}";
var Mailme = "mail" + "to:" + "{$account}" + Domain;
document.write("<a href=\\"#\\" onclick=\\"parent.location=Mailme\\"><img src=\\"textimage.php?text={$hemail}&size={$size}&font={$font}&color={$color}&bgcolor={$bgcolor}\\" border=0 alt=\\"{$aemail}\\" /></a>");
// -->
</script>
<noscript>
  <img src="{$pathfile}?text={$hemail}&size={$size}&font={$font}&color={$color}&bgcolor={$bgcolor}" border=0 alt="{$aemail}" />
</noscript>
EOT;
    return $output;
}