Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4034208
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:56:36+00:00 2026-05-20T11:56:36+00:00

I am passing $_GET[]; variables in a link but want to encrypt the values

  • 0

I am passing $_GET[]; variables in a link but want to encrypt the values in the url. I would normally use sessions but since I am not using a form and just a url what are my options. I am sure there is someway to exploit this method so I am trying to make it as secure as possible.

Below is my code:

$cost = "152.00";
<a href="registration.php?class=Spanish&age=4-6&time=3pm&cost=<?echo $cost; ?>">

and registration.php looks like

<?
$class = $_GET[class];
$age = $_GET[age];
$time = $_GET[time];
$cost = $_GET[cost];
?>

If I could use something like md5 to encode the values and then decode them on registration.php that would be good or if there is a way to pass $_session variables using <a> that would be good.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:56:37+00:00Added an answer on May 20, 2026 at 11:56 am

    Is the page you’re linking to on the same site as the site you’re making the link from?

    If so, why not stick them in $_SESSION? This way, they’re stored on the server, where the user can never think of manipulating them.

    Another option is not actually encrypting the data, but signing it using an HMAC. If you’re using a modern version of PHP, you can use hash_hmac. On the link creation side:

    $validate = serialize(array( $class, $age, $time, $cost ));
    $hmac = hash_hmac('sha1', $validate, 'secret key goes here');
    $link = 'foo.php?...&validate=' . $hmac;
    

    … and on the other side:

    $validate = serialize(array( $_GET['class'], $_GET['age'], $_GET['time'], $_GET['cost'] ));
    $hmac = hash_hmac('sha1', $validate, 'secret key goes here');
    if($hmac != $_GET['validate']) {
        echo "No hacking!";
        exit;
    }
    

    You should actually use this technique for option #3, which is: use POST, i.e. a form. This will deter casual users from changing the data.

    Option #4 is the best: storing all that sensitive data server-side to begin with, and referring to it by a unique identifier that the user sees. This keeps the data out of the user’s hands to begin with, meaning you never need to worry about the user tampering with it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm passing variables to my page page?title=fred but I would like to redirect to
As in php we use $_GET to pass variables in the url , i
Difficult to explain this Question, but im currently passing variables in a php page
I'm having issues passing on multiple $_GET variables with next. I'm redirecting users to
I know a SESSION can expire but what about $_REQUEST/$_POST/$_GET variables? My question is,
I often get strange resulst when passing int variables to tasks such as in
I am trying to parse some xml data by passing the variables with a
I'm doing a style.php CSS file so I can use some dynamic variables in
I am passing variables to another page with this urlencoded string http://localhost:8888/proseat/index.php/configure/ve/Honda/Civic+%28sedan%29/2007 and when
I'm trying to use jaxb and want to use the 'XmlAccessType.PROPERTY' to let jaxb

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.