
![]() |
jammaster82
quote author=jammaster82 link=topic=694.msg4819#msg4819 date=1200069392 ![]() $companyname = trim($_REQUEST['companyname']); $contactfirstname= trim($_REQUEST['contactfirstname']); $contactlastname=trim($_REQUEST['contactlastname']); $streetaddress=trim($_REQUEST['streetaddress']); $suitenumber=trim($_REQUEST['suitenumber']); $city=trim($_REQUEST['city']); ![]() so i can just be like print $suitenumber; print ' was the suitenumber posted to this form.'; jammaster82
<? phpextract($_REQUEST); echo $companyname.'::was companyname <br><br>'; echo $contactfirstname.'::was contactfirstname <br><br>'; ?> by placing extract($_REQUEST) at start of the script all GET, POST and Cookie data will be available as variables in the current scope. Awwwwwwwwwwwwwwwwwww SNAP! nutballs
what happens when the variable already exists? Just curious.
vsloathe
Nice find bro. I wonder if doing this would open up an injection vector? I guess not but I would like to see the extract function.
perkiset
Absolutely opens up a vector - I personally would never use it.
The problem is that extract, by default, will overwrite variables in the same scope. So someone could take a wild-assed guess and overwrite some of yours and dick with your procedure, or if they really knew more they could potentially hijack you. There are modifications to the extract behavior which can be seen here: http://us3. php.net/manual/en/function.extract.phpbut this is a poor man's way to make sure. This little snippet uses scope as a hard firewall against variable intrusion.<? php$AVarIExpect = 'testing'; $AnotherVarIExpect = 'Fubar'; doExtractFunction() function doExtractFunction() { global $AVarIExpect, $AnotherVarIExpect; extract($_REQUEST); } ?> |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads