I am working on a web application in which i want to make some security constraints and want to know the alternative way to send the data or id from URL in a secure way.for example:
$id=$row=['id'];
$name=$row['name'];
<a href="projects.php?project_id=<?pho echo $id; ?>&name=<?php echo $name; ?>">
so is there any alternate way to send this two attributes in a secure way to the project.php ?
I just only want that the id & name should not be visible on url.
Please guide me ,i know this is very basic feature of PHP and i just want to find the alternate or secure solution.
i know i am sending the data using get but is there any alternate way to send data to project.php without using tag?
I tried this after all comments & answer ,so the answer is :
<?php
$id="1";
$name="Harshal";
?>
<a href="projects.php?id=<?php echo base64_encode($id) ?>&name=<?php echo base64_encode($name) ?>">Send</a>
and on projects.php
<?php
echo $idd=base64_decode($_GET['id']);
echo $namme=base64_decode($_GET['name']);
?>
It works…!!
Anything sent in a URL is by default pretty much there for anyone and everyone to see, use and abuse.
Having said that, sometimes you simply have to send it that way. You can’t make the data in the URL secure, by you can make your code treat it in a secure manner.
For example, if you pass data via the URL and simply display data, anyone can change the URL bits and see information that they aren’t supposed to. If you however send data via the URL and your code then performs a check to see if the user is able to see it, that suddenly becomes much more secure.
Another quick method is to provide a link that copies the data into a session and redirects the user to a fresh page – showing them the content they wanted based on the information in their session – and again verifying that they are indeed allowed to see it.
Keep in mind that URLS can be edited by anyone in the space of seconds. Post data really isn’t too much different – though it might take a little more effort to fudge. To secure it, you need to make sure that the code you have is able to treat it in a secure manner.
Edit:
You should change your code to this: