Hi guys,
Trying to get make a zip file on the fly but I’m sure my paths (in the exec command) are not correct.
Help is greatly appreciated.
(safe is just a mysql_real_escape_string function so I don’t have to write that long function name each time.)
So what I’m trying to do is zip a folder to a zip file.
[code]
$id = safe($_GET[“id”]);
$sql = “select cmp_user, cmp_list, cmp_list_name, cmp_user, cmp_id from tbl_campaign where cmp_id = $id”;
$rs = mysql_query($sql);
if(@mysql_num_rows($rs) == 0){
echo “That campaign is invalid.”;
exit;
}
$r = mysql_fetch_assoc($rs);
$userid = $r[“cmp_user”];
$cmpfolder = “cmp_”.$r[“cmp_id”];
$cid = $r[“cmp_id”];
$zipto = “./content/$userid/campaign_$cid.zip”;
$dl = “campaign_$cid.zip”;
$zip_cmd = “zip -r $zipto ./content/$userid/$cid”;
exec($zip_cmd);
This is a linux server running php 5.2.
Also, how can I see the error if it fails?
Thanks