user3454436
user3454436

Reputation: 231

how to hide url value when i using href to pass value?

I'm trying to filter my URL value become hidden due to security purpose. Any solution or method to do that?

I'm doing it this way:

<html
    <a href='www.iluvpromo.com/unsubscribe.php?email=$email'> 
</html>

and the URL is displayed like this:

http://www.iluvpromo.com/unsubscribe.php?email="email_address"

but I want it to be displayed like this:

http://www.iluvpromo.com/unsubscribe.php

Upvotes: 1

Views: 13871

Answers (4)

user3462511
user3462511

Reputation:

you can use some encryption code to encrypt your parameter which cannot understand by user.

$myData = array('foo'=>1, 'bar'=>'hax0r');
$arg = base64_encode( json_encode($myData) );

http:www.iluvpormo.com/parameter=$arg

and back:

$myData = json_decode( base64_decode( $_GET['secret'] ) );

Upvotes: 1

Mohsen Kamrani
Mohsen Kamrani

Reputation: 7457

You may use session :

in the first page :

<?php
 session_start();
$_SESSION['email']=$email;
?>

in the second page :

if(isset($_SESSION['email']))
//do sth
//unset($_SESSION['email']); to destroy the session

another way is to use post variable :

in the first pge :

$_POST['email'] = $email;

in the second page:

if( $_POST["email"])
//do something

another way is using hlink :

echo hlink ("hyperlinktext", "email", "http://www.iluvpromo.com/unsubscribe.php", "funkyclass",     $email);

instead of this:

<a href='http://www.iluvpromo.com/unsubscribe.php?email=$email' class='funkyclass'>hyperlink text</a>

Upvotes: 1

Valdas
Valdas

Reputation: 1074

You can do similar 'action' in several ways:

  • md5(email), and user wont see it in cleartext
  • you can use session (if user is logged in)
  • pass user id (not that good idea thou, users can guess that easily)
  • make a POST request with params (not link, form is used for that)

Upvotes: 1

Marc
Marc

Reputation: 992

Alternatively you could encrypt your querystring or post the value in a form (visible in source though).

Upvotes: 0

Related Questions