duanbodai5166 2009-09-03 05:46
浏览 60
已采纳

如何在这种情况下进行URL屏蔽?

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 :)

  • 写回答

2条回答 默认 最新

  • drk7700 2009-09-03 06:19
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?