PHP $_GET with signature and Pair-Key-Id

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
momo_8888
Forum Newbie
Posts: 3
Joined: Thu Jul 07, 2011 6:09 am

PHP $_GET with signature and Pair-Key-Id

Post by momo_8888 »

hi guys,

I stored media records in one of secured servers when I ask for alink to the media I receive the following link

url?flv=dfdffdfdf?Expires=3344 &jpg=mmmm?expires=222&mp4?expires=111&Signature=dkksdkskdskdsjkdskd&Signature=slldklksdlkld&Signature=30443034-030&Key-Pair-Id=9384jekjdj&key-Pair-Id=04kfkkfl-4-4&key-Pair-Id=043o4lldl;l;flf
I recieved 3 signatures and 3 Pair-Key-Ids and I need to match them together to fetch the data ,

[text]The problem in retrieving the signature and Pair-Key-Id from $_GET[] it returns the last signature and key .
Do any one of you has an idea on how to fetch the 3 Signatures and keys from $_GET
[/text]
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: PHP $_GET with signature and Pair-Key-Id

Post by social_experiment »

Do the key id values correspond with the signature values, the first signature requires the first key id, the second signature requires the second key id, etc?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
momo_8888
Forum Newbie
Posts: 3
Joined: Thu Jul 07, 2011 6:09 am

Re: PHP $_GET with signature and Pair-Key-Id

Post by momo_8888 »

Yes That's exactly what is should happened and it is as you like ,
If i did it manually it works , but the actual problem is
$sig=$_GET['Signature']; //show the last signature in URL
$sig=$_GET['Signature1']; //wrong index
$sig=$_GET['Signature'][1]; //it give me the letters in the string

I need to fetch the first signature and second signature and third signature with 3 key-ids to match them .

Thanks
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: PHP $_GET with signature and Pair-Key-Id

Post by AbraCadaver »

You can't get anything but the last variable with a query string like that because the variables cannot have the same name. You would need to use an array in the query string, like:

Signature[]=dkksdkskdskdsjkdskd&Signature[]=slldklksdlkld&Signature[]=30443034-030&key-Pair-Id[]=9384jekjdj&key-Pair-Id[]=04kfkkfl-4-4&key-Pair-Id[]=043o4lldl;l;flf

Then you can get $_GET['Signature'][0] etc... You might want to urlencode the [] so %5B%5D.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply