Jump to content

$_GET and md5 question.


iStriide

Recommended Posts

Can you use md5 with the $_GET thingy and decode it on the page your getting linked to.

I'll try and put and example of what i'm trying to say.

<?php

$link = md5($random); // I'm not sure on how md5 is setup that goes.

echo "

<a href='random.php?xyz=$link'>Click here yo!</a>

";

?>

 

Then after you reached the link page then can you decode the $_GET and then use it to query a database?

Link to comment
Share on other sites

How would you "Crack" it?

 

You don't. What he is stating has nothing to do with what you want to accomplish. Can you give some details about the values that you want to hash/encrypt? If it is a relatively small finite list, then you could build a lookup list of the values and their hash values. But, if the list of possible values is large then you could use Mcrypt (http://php.net/manual/en/book.mcrypt.php). But, depending upon how "secure" this value needs to be you could also consider building yourself a simple ceasar cypher. It would be helpful to know how the value of "$random" is determined.

Link to comment
Share on other sites

I guess the whole point here (of the original post) was passing a variable to the next page without it being in plain sight ( ? ). If so, you can simply store it in a $_SESSION variable and retrieve it on the next page. If you want it to look cool and encrypted, you can use your md5 hash as a session variable name: If they're links you wish to send out in emails, that are supposed to be unique, you can do the same thing, but store the hashes and values in a database instead of session.

 

 

<?php
session_start();
$link = md5($random); // I'm not sure on how md5 is setup that goes.
$_SESSION[$link] = $random;
echo "<a href='random.php?xyz=$link'>Click here yo!</a>";
?>

 

on next page, you can retrieve the value of $random with:

 

<?php
session_start();
echo $_SESSION[$_GET['xyz']];
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.