![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 329
Rep Power: 3
![]() |
Shorterning this code:
does anybody know hot to make this code shorter and more effecient:
$my_input = $ENV{QUERY_STRING};
$my_input=substr($my_input,9);
$my_input =~ s/%21/!/g;
$my_input =~ s/%22/"/g;
$my_input =~ s/%A3/£/g;
$my_input =~ s/%24/\$/g;
$my_input =~ s/%25/\%/g;
$my_input =~ s/%5E/^/g;
$my_input =~ s/%26/\&/g;
$my_input =~ s/%28/(/g;
$my_input =~ s/%29/)/g;
$my_input =~ s/%3D/=/g;
$my_input =~ s/%2B/+/g;
$my_input =~ s/%7B/{/g;
$my_input =~ s/%7D/}/g;
$my_input =~ s/%5B/[/g;
$my_input =~ s/%5D/]/g;
$my_input =~ s/%3A/:/g;
$my_input =~ s/%3B/;/g;
$my_input =~ s/%27/'/g;
$my_input =~ s/%23/\#/g;
$my_input =~ s/%7E/~/g;
$my_input =~ s/%7C/\|/g;
$my_input =~ s/%5C/\\/g;
$my_input =~ s/%3C/</g;
$my_input =~ s/%2C/,/g;
$my_input =~ s/%3E/>/g;
$my_input =~ s/%2F/\//g;
$my_input =~ s/%3F/?/g;
$my_input =~ s/%AC/¬/g;
$my_input =~ s/%60/`/g;
$my_input =~ s/\+/ /g;
$my_input =~ s/%0D%0A/<br>/g;as you can see i am just trying decode the submission of a form. I thank you in advance for your replies.
__________________
Quote:
|
|
|
|
|
|
|
#2 |
|
Professional Programmer
|
This might work :o
my_input =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg;Not my code, found it on google ![]() |
|
|
|
|
|
#3 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() ![]() |
look into regular expressions
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Little help | whoawhoayoyo | Assembly | 8 | Apr 18th, 2006 7:10 PM |
| Functions returing a pointer using new | Jessehk | C++ | 29 | Dec 21st, 2005 2:52 AM |
| How to post a question | nnxion | C++ | 10 | Jun 3rd, 2005 11:53 AM |
| How to post a question | nnxion | C++ | 0 | Jun 3rd, 2005 8:55 AM |
| How to post a question | nnxion | C | 0 | Jun 3rd, 2005 8:55 AM |