Hide get variables

I have a url that is built using get variables such as

location.href = this.href +'?type='+ escape($('#type_of_station').html()) + '&count='+ escape($('.number_changer').attr("id").slice(-1));

which gives me a url like

http://posnation.com/pre_config/pre_config_step_2.php?type=Grocery&count=2 

on the next page i take variables via php

<p id="type_of_station" class="text left"><?php $_GET['type'] != "" ? print str_replace("_", " ", $_GET['type']) : print "Food Pos System" ?></p>

This works fine, but the url is ugly. Is there a way to hide this and still have get variables available to me on the next page.

+3
source share
4 answers

Making a URL beautiful is one thing. Hide URL data is another. Never hide anything. Or you will make your site unusable.

+3
source

You want to use POST your variables on the server, rather than sending them as GET requests.

PHP POST-ed $_POST.

:

form.php

<form action="process.php" method="POST">
   username: <input type="text" name="username" value="" /><br/>
</form>

"POST-ed" " " process.php

process.php

echo $_POST['username'];

GET, , , URL-.

+2

$_POST $_GET .

EDIT: , . : mod_rewrite, , .

0

.. - , , -:

:

Just add the following line to your index.php file after starting the php session:

if(isset($_GET))
{
header("Location:index.php");
$_SESSION['relink'] = $_GET;
}

You will have some GET value in the SESSION ['relink'] variable. And then you redirect the index.php file. Your browser will display visible traces. After that, you should check any value of the array before using it. But at least your browser address is CLEAN!

0
source

Source: https://habr.com/ru/post/1763225/


All Articles