Jump to content

[SOLVED] Simple Encryption / Decryption


korndevil666

Recommended Posts

im trying to use a key to validate the client.php/server.php

 

at the moment client.php uses a key that sends data along a form, code is

 

<?php 
$key1 = rand(1, 10000);
$encrypt_key = bin2hex($key1);
?>

 

so encrypt_key is sent along with a form of other variables

 

i need somehow to use the key created in client.php and validate it in server.php so only that key works, which then allows access to the script (displays form), but i cannot send unencrypted key to server.

 

or if you can point me to any other simple way of sending encrypted data, much apprechiated!

Link to comment
Share on other sites

Since client.php is using a random number there is no way for server.php to determine if the value sent was a legitimate value or a made up one. server.php needs to validate the key against something.

 

Not sure what you are really trying to accomplish here. If client.php and server.php are on the same server, then client.php could save a value to the database and server.php could validate the value against that.

Link to comment
Share on other sites

normally, for stuff like this, i give each client a key. then, the client can pass the key with the data. since i know what the key should be, that is how i validate it. the key doesn't change (unless the client specifically requests a new one). for the keys, i usually generate a random md5 string.

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.