korndevil666 Posted November 4, 2008 Share Posted November 4, 2008 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! Quote Link to comment Share on other sites More sharing options...
rhodesa Posted November 4, 2008 Share Posted November 4, 2008 i'm confused, are you looking to 'encrypt' the data? or just have some sort of authentication method to validate who the client is? Quote Link to comment Share on other sites More sharing options...
korndevil666 Posted November 4, 2008 Author Share Posted November 4, 2008 i'm confused, are you looking to 'encrypt' the data? or just have some sort of authentication method to validate who the client is? yes, the second option - authenticate . thanks, Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 4, 2008 Share Posted November 4, 2008 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. Quote Link to comment Share on other sites More sharing options...
serverman Posted November 4, 2008 Share Posted November 4, 2008 so what do you want to do have it encrypt the file with random key then save the key on another file then send both files to a client? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted November 4, 2008 Share Posted November 4, 2008 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. Quote Link to comment Share on other sites More sharing options...
korndevil666 Posted November 4, 2008 Author Share Posted November 4, 2008 thanks, ill think ill just do that Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.