exec() in PHP to create zip archives.

scc123

New Member
Messages
18
Reaction score
0
Points
0
I have a user front end for a file hosting type website (not hosted here) and I need to be able to let my users create zip archives and download them on the fly of their areas.

PHP:
$usnses=$_SESSION['username'];
exec('zip /users/'.$usnses.'/smwfiles.zip /users/'.$usnses.'/');

Is what I am using at the minute but every archive is just empty =/
Any help?
Thanks :)

EDIT:
Never mind I done it :)
PHP:
exec("zip -r $f ./users/".$usnses."/*.html");
 
Last edited:

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Just be careful of injection attacks.
 

scc123

New Member
Messages
18
Reaction score
0
Points
0
PHP:
$f=escapeshellarg(escapeshellcmd(clean($f)));
$usnses=escapeshellarg(escapeshellcmd(clean($usnses)));

Not to take any chances :)
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
I would not recommend using exec as some hosts might disable it.
 
Top