Search code examples
phpiframeurl-rewritingframeset

how to do a URL masking in this condition?


I am using php, js, flash and mysql on 1 website.

I want to do a URL masking using frameset(or maybe iframe). Scenario:

An user click on a link, which direct him/her to my page with this url:

www.domain.com/index.php?var1=string1&var2=string2

How to mask the url so that visitor can only see www.domain.com/index.php, but actually there are some variables over there. I need the variables, but i dont want the visitors to see. How to do URL masking on this? (I dont expect to get any code, I just want to know the logic of the url masking method)

PS. I probably would not use mod_rewrite, because I dont know how to use/write the code. So please, answer with iframe/frameset methods :)


Solution

  • EDIT: I think I misunderstood your question, so here is another attempt:

    In www.yourdomain.com/index.php:

    <?php
    
    session_start();
    
    if (isset($_REQUEST['flashvar']) && ! isset($_SESSION['flashvar'])) {
    
        // Store any parameters received
        $_SESSION['flashvar'] = $_REQUEST['flashvar'];
    
        // Redirecting without query parameters
        header('Location: /index.php');
        exit;
    }
    ?>
    <HTML>
    <HEAD></HEAD>
    <BODY>
    <?php
      echo '<embed src="player.swf?flashvar=',
           urlencode($_SESSION['flashvar']), '"/>';
    ?>
    </BODY>
    </HTML>
    

    This example will start a session and redirect the user to itself without needing to store any parameters in the query string. Naturally, it will only work if the user has cookies enabled.