Decimal encode/decode

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Decimal encode/decode

    Encode and decode text by decimal

    Demo:


    Snippet :
    PHP Code:
    <?php
    $string=$_POST['text'];
    $stringdecript=$_POST['textdecript'];
    
    $print="<textarea cols=\"15\" rows=\"1\" readonly=\"readonly\"  onfocus=\"this.select()\">".$string."</textarea>";
    echo"Before:<br>".$print." <br>";
    
    echo'Encrypt your text:<br><form action="decimal.php" method="post"><textarea cols="10" name="text" rows="1" style="width:300px;height:100px;" value="" id="code_txt"  onfocus="this.select()">';
    unick($string);
    echo'</textarea><br><input type="submit" value="Encrypt"></form>';
    
    $stringdec=str_replace('&','&amp;',$stringdecript);
    $print="<textarea cols=\"15\" rows=\"1\" readonly=\"readonly\"  onfocus=\"this.select()\">".$stringdec."</textarea>";
    echo"Before:<br>".$print." <br>";
    echo'Decrypt your text:<br><form action="decimal.php" method="post"><textarea cols="10" name="textdecript" rows="1" style="width:300px;height:100px;" value="" id="code_txt"  onfocus="this.select()">';
    echo"$stringdecript";
    echo'</textarea><br><input type="submit" value="Decrypt"></form>';
    
    function unick($string){ 
    for($i=0;$i<strlen($string);$i++) { 
     echo "&amp;#".ord($string{$i}).";"; }
    }
    ?>
    Attached Files
    Last edited by just_m3.; 22.06.11, 15:46.
    This is ten percent luck, twenty percent skill
    Fifteen percent concentrated power of will
    Five percent pleasure, fifty percent pain

    And a hundred percent reason to remember the name!
Working...
X