Advertisement
Guest User

printHasher

a guest
Aug 20th, 2014
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. $text = htmlentities($_GET['text']);
  4. $hashVal = htmlentities($_GET['hashValue']);
  5. $fontSize = htmlentities($_GET['fontSize']);
  6. $style = htmlentities($_GET['fontStyle']);
  7. $fontStyle = getTag($style);
  8. $hashedString = "";
  9. for ($i=0; $i < strlen($text); $i++) {
  10.     if ($i % 2 == 0) {
  11.         $hashedString .= chr(ord($text[$i]) + intval($hashVal));
  12.     }else {
  13.         $hashedString .= chr(ord($text[$i]) - intval($hashVal));
  14.     }
  15. }
  16. echo "<p style=\"font-size:$fontSize;$fontStyle\">";
  17. echo "$hashedString";
  18. echo "</p>";
  19.  
  20. function getTag($style) {
  21.     switch ($style) {
  22.         case "normal":
  23.         case "italic":
  24.             return "font-style:$style;";
  25.         case "bold":
  26.             return "font-weight:bold;";
  27.         default: return "";
  28.     }
  29. }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement