How to make the path in the web browser not to be seen/encrypted

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ewwachi
    New Member
    • Feb 2010
    • 11

    #1

    How to make the path in the web browser not to be seen/encrypted

    Please help me out I do not want users to see the path of information on the web browser.How do i go about it

    example of path

    http://localhost/cmp/certs/certs.php?cid=4 1350

    I don't want users to see the path especially the number cid=41350 for security reasons.

    regards emmah
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    If you want to pass data with a request without putting it in the URL you typically use a POST request. A normal browser won't do that by default though. You would have to use a <form> or somehow simulate a form. (By using AJAX, for example.)

    Please note, though, that this doesn't really "secure" anything. It just hides it from being obviously visible. It will still be fairly easily visible if people are determined to find it.

    You can also try encrypting the data. For that check out the mcrypt extension.

    Comment

    • ewwachi
      New Member
      • Feb 2010
      • 11

      #3
      Sori i forgot to mention i need the code in php but I'll look further into what you've said

      Comment

      • chathura86
        New Member
        • May 2007
        • 227

        #4
        Code:
        <?php
            define('SALT', 'whateveryouwant');
           
            function encrypt($text)
            {
                return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
            }
        
            function decrypt($text)
            {
                return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SALT, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
            }
        ?>
        above methods will help you to encrypt and decrypt data

        so when you have a url to display

        Code:
        <a href="http://localhost/cmp/certs/certs.php?cid=<?php echo encrypt('4020'); ?>" >link</a>
        to get the variable

        Code:
        <?php
        
        $cid = decrypt($_GET['cid']);
        
        ?>
        Regards
        Chathura Bamunusinghe

        Comment

        Working...