URL Encoder / Decoder [PHP] Rahman Surya Praja Selasa, 26 April 2011 No Comment


Url Encode / Decode membantu untuk memperbaiki URL yang kita copy/paste menjadi link yang mudah di baca:







[example URL Encode]

http%3A%2f%2fvir0e5.blogspot.com%2f2011%2f04%2furl-encoder-decoder-php.html

[example URL Decode]
http://vir0e5.blogspot.com/2011/04/url-encoder-decoder-php.html



<?php

echo"<title>URL Encode / Decode</title>";
echo"<div align=center>URL Encode / Decode";

$bandit= stripslashes($_POST['c0de']);
    if ($bandit == "")
    {
        $bandit = $_GET['c0de'];
    }

$action = $_POST['action'];
    if ($action == "")
    {
       $action = $_GET['action'];
          if ($action == "encode"){
          $action = "enc0de";
          }
          elseif ($action == "decode")
          {
          $action = "dec0de";
          }
    }

switch($action){
case "enc0de":
       $output = urlencode ($bandit);
           if(!$output){
           echo 'Ada yang salah!!!';
           }

echo"<center><table width='380'><td>";
echo"<br><center>&#34;urlencode() function&#34;</center><hr></br>";
echo "<p> Input   : " . $bandit . "</p>";
echo "<p> Output: " . $output ."</p>";
echo "<p><a href='javascript:history.back(0);'> << Back </a></p>";
break;

case "dec0de":
$output = urldecode($bandit);
if(!$output){
echo 'Ada yang salah!!!';
exit;
}

echo"<center><table width='380'><td>";
echo"<br><center>&#34;urldecode() function&#34;</center><hr></br>";
echo "<p> Input    : " . $bandit . "</p>";
echo "<p> Output : " . $output ."</p>";
echo "<p><a href='javascript:history.back(0);'> << Back </a></p>";
break;

default: 
echo"<p>Input your text on text area...and enjoy it!!</p>";
echo '<form id="form1" name="form1" method="post" action="?encode/vir0e5\decode">
            <p>
               <textarea name="c0de" id="c0de" rows=8 cols=40 ></textarea>
            </p>
          
          <p>Pilih yang mau di cari</p>
          
          <p><input type=radio name="action" id="action" value="enc0de">Encode</p>
          <p><input type=radio name="action" id="action" value="dec0de">Decode</p>

        <input type="submit" class = "button" name="submit" id="submit" onClick="
        if(c0de.value==\'\'){alert(\'mana teksnya kang???\'); return false;}" value="Submit" />
        <input type="reset" name="reset" class="button" value="Reset"/>

    </p>
  </form>';
  
break;
}
?>
by Jillur Rahman

Jillur Rahman is a Web designers. He enjoys to make blogger templates. He always try to make modern and 3D looking Templates. You can by his templates from Themeforest.

Follow him @ Twitter | Facebook | Google Plus

No Comment

Terima Kasih Sudah berkunjung!! Di Mohon Untuk Meninggalkan Komen, untuk mempererat silaturahmi.... ^_^