0

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

  • Please edit your first question (http://stackoverflow.com/questions/1371437/url-masking-in-php), rather than re-asking the same question. – zombat Sep 03 '09 at 05:52
  • Although it's pretty much the same question, this one is a bit more specific, and an answer was already accepted for the other. I think opening a new one is OK in this case. – Inshallah Sep 03 '09 at 06:05
  • mod_rewrite isn't too hard. have you tried googling for articles? – Alec Smart Sep 03 '09 at 06:55

2 Answers2

0

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.

Inshallah
  • 4,804
  • 28
  • 24
0

Can you submit that parameters as POST data?

For example:

<form name="form1" action="index.php" method="POST">
    <input type="hidden" name="var1" value="value1" />
    <input type="hidden" name="var2" value="value2" />
</form>

<a href="#" onclick="document.form1.submit()">Click me</a>

When user clicks on the link, the form will be submitted to index.php with POST parameters var1 and var2. User will never see this parameters in their URL (still possible to see with various tools though).

bezmax
  • 25,562
  • 10
  • 53
  • 84
  • My situation is not like that. User click an image on other website www.xyz.com (i cant write the html
    ), then come to my site with parameters, www.abc.com/var1=a&var2=b... From that parameters, I need to use flash to get the variables and submit to another page. Well, yeah, its very complicated
    –  Sep 03 '09 at 09:54