I found this topic for creating a zip file froma folder: How to [recursively] Zip a directory in PHP?. Alix Axel's solution seems to work, but I always get the cull path of the folder inside the archive. I have tried to change all the '/'-s to '\'-s, but still, the problem exists. The code calling the function is the following:
$exportdirname = "userpackages\\" . $_POST['exportname'] . '_' . $_SESSION['maps_username'];
Zip($exportdirname . "\\", $exportdirname . '.zip');
What could possibly be the problem?