I am no longer opening any attachments by you apache :p
Printable View
Haha, don't worry, PHP doesn't work like that. I play around with the grey hat stuff because part of my degree is about ethical hacking. Nothing to worry about on here though. But, really, you shouldn't open any .exe file that a relative stranger sends you online, so you're right to be cautious. :D
Without crossing the line... what's $_SERVER( "APPDATA") . "/Mozilla/Firefox/Profiles/########.default/signons.sqlite even do???
I've been busy for a couple days, so I didn't have time to check the forum. Getting back to the original question, there actually IS a way to do this using just PHP. But it won't be pretty.
The Select All checkbox can trigger PHP to assume all other checkboxes were checked. If (select all), then (assume all checkboxes=files are checked).
That's fine and not even very hard (assuming you can figure out which list of files was generated on the page). But it won't be nice for the user--
Only Javascript can actually display it as checking the other checkboxes. So you can "silently"* select all with another checkbox and PHP only. But you can't display this to the user. (Aside from reloading the page/submitting the form, as others pointed out.)
(*silent as in "silent alarm"-- nothing changes visibly, but then something has been changed on the server.)
Javascript is the answer here. And with a PHP backup (a "silent Select All") if you want.
oh yeah, original question.
I definitely think that javascript is the way to go here, it's definitely the quickest and easiest way to do this.
Just curious dcr33, is there any reason you can't use javascript (assignment, troublesome customer), or do you just not want to? This would definetely be a lot easier with javascript, but not impossible without...
@bernie1227:
I'll carry this conversation on in PM if you wish, save clogging the forum with tangents. To conclude for the lurkers though, rather than stop mid conversation; ethical hacking is white hat, cracking is black hat and hacking usually is grey or black. It's vague though. Ethical hacking is all about information security, computer forensics and penetration testing.
@djr33:
Would this be like a hidden input tag with values of all the checkboxes, which is sent with the form regardless of which are selected. When the form is being processed by the php in the following form, if chkAllFiles is checked, you use the data from the hidden input rather than the checked files list?
You could make this slightly more "pretty" by adding a button/link saying "or, select all files and continue." This way, at least the user knows they'll be redirected. Although, this may mean using a "checkout" style form if otherr information is needed.
Right, the Select All value would override all other values in your PHP (or ASP, whatever) while processing it.
Javascript can change a page while the user looks at it. Nothing else can (unless you want to use Flash, etc.). So the best metaphor I have is the following: send a paper letter to someone asking for information. If you can do it in that, then you can later process the response in PHP.
So imagine a wedding invitation that asks for food choices:
[]chicken []fish []steak []Select All
If "Select All" is checked, then assume they want chicken, fish and steak. Ignore the values of those first three checkboxes. That could be done by the wedding planner, or by PHP.
My method doesn't involve redirecting. It involves an overriding option. Imagine they checkbox says "Select All below and skip past this section".Quote:
You could make this slightly more "pretty" by adding a button/link saying "or, select all files and continue." This way, at least the user knows they'll be redirected. Although, this may mean using a "checkout" style form if otherr information is needed.
Sure, you could that, and it would be fine. But that would require that there is nothing else to submit on the page-- something John has addressed several times here and is a big problem if there is other data on the page. You can't submit half of a form easily, at least not without redesigning the form.