<?php // Verififica se foi Inserido algum "Texto" if (isset($string)){ $ascii = ''; // Verififica se � Convers�o ao ASCII ou NORMAL if ($type == '1'){ // Se for Convers�o ao NORMAL Tira o �nicio somente deixando os N�mero $string = str_replace('&', '', $string); $string = str_replace('&', '', $string); $string = str_replace('&', '', $string); $string = str_replace('#', '', $string); $dados = explode(';', $string); $total = count($dados); } else { $dados = $string; $total = strlen($dados); } // Por final lista as plavras/n�meros e converte no qual for NORMAL/ASCII e Exibe for ($i = '0' ; $i < $total ; $i++): $ascii .= ($type == '1') ? chr($dados[$i]) : '&#'.ord($dados[$i]).';'; endfor; $ascii = trim($ascii); echo "<font size=\"2\" color=\"#000000\" face=\"Verdana,Arial\"><b><form name=\"converted\"> Texto Convertido em Normal ou ASCII:<br> <textarea name=\"string\" cols=\"75\" rows=\"14\">$ascii</textarea><br> <input type=\"button\" name=\"back\" value=\"Voltar\" onClick=\"javascript:location.href='$PHP_SELF';\"> <input type=\"button\" name=\"select\" value=\"Seleciona\" onClick=\"javascript:document.converted.string.select();\"> </form></b></font>"; } else { // Se n�o existir nada pede para se inserir o "Texto" echo "<font size=\"2\" color=\"#000000\" face=\"Verdana,Arial\"><b> <form action=\"$PHP_SELF\" method=\"POST\"> Texto Normal ou ASCII:<br> <textarea name=\"string\" cols=\"40\" rows=\"10\"></textarea><br> ASCII: <input type=\"radio\" name=\"type\" value=\"0\" checked> Normal: <input type=\"radio\" name=\"type\" value=\"1\"><br> <input type=\"submit\" name=\"str\" value=\"Converter\"> </form></b></font>"; } ?>