Need PHP Programmer To Setup Simple Work


Elite Member
Oct 22, 2008
Reaction score
I need someone to create a page for me.

On this page there will be a form such as, type in your website, then your second website, then link X, then link Y etc.

These once submitted need to be put into a few different PHP files that are inside different folders and then ZIP the lot up and download instantly.

This needs to work as if a lot of users are doing this at the same time so people dont get hold of others files.

If anyone can do this please could you PM me with a price, it is quite a simple job in my opinion but I don't know how to do the ZIP up bit.
Im not really interested in taking this as a job but in any case I'd like to share the basic method to accomplish this as to help anyone who finds this thread, if noone has PMed you already about doing this, and the code samples below do not help you feel free to PM me.

1. Create a php file (phpFilename.php) and initiate a session with a random ID using somthing like:

$sess_id = rand(100000, 999999999);
$_SESSION['rand_id'] = $sess_id;

2. Build the form into the file (phpFilename.php).

<form action="formAction.php" method="post">
		<td>Website 1</td>
		<td><input type="text" name="website1" /></td>
		<td>Website 2</td>
		<td><input type="text" name="website2" /></td>
		<td>Link X</td>
		<td><input type="text" name="linkX" /></td>
		<td>Link Y</td>
		<td><input type="text" name="linkY" /></td>
		<td colspan="2">
			<input type="submit" value="Submit!" />

3. Create another php file (formAction.php) and add the functions to get the form POST
$website1 = $_POST['website1'];
$website2 = $_POST['website2'];
$linkX = $_POST['linkX'];
$linkY = $_POST['linkY'];

4. Now it gets a bit tricky. There are a ton of ways to accomplish writing the POST data to specific parts of the PHP script. One of the simplest is to include the whole php script into the (formAction.php) file as a PHP variable with the replacement part labeled, then replace the labels with the POST data and write the whole thing to a new file. Start with including the original script with labels.
$original_script = "<?php";
$original_script .= "echo 'Website 1 = {WEBSITE_1}';";
$original_script .= "echo 'Website 2 = {WEBSITE_2}';";
$original_script .= "echo 'Link X = {LINK_X}';";
$original_script .= "echo 'Link Y = {LINK_Y}';";
$original_script .= "?>";

5. Next add the replacement code to (formAction.php).
$original_script = str_replace('{WEBSITE_1}', $website1, $original_script);
$original_script = str_replace('{WEBSITE_2}', $website2, $original_script);
$original_script = str_replace('{LINK_X}', $linkX, $original_script);
$original_script = str_replace('{LINK_Y}', $linkY, $original_script);

6. Next in (formAction.php) use PHP's file functions to create a new file, and write the original script with the replacements added (the new file being made will be stored in a new directory named after the unique session ID, this way multiple people can use this script without comprimising thier data).
$dir_name = '/tmp_dirs/'.$_SESSION['rand_id'];
$final_filename = 'outputFile.php'
$final_file = fopen($dir_name.'/'.$final_filename, 'w');
fwrite($final_file, $original_script); 

7. Ok at this point the user has submitted thier data, a new php file has been created with thier data in a unique folder. Now we need to add this new file to a zip file along with whatever other files are needed. At this point if it hasn't gotten tricky enough for you, prepare yourself to use the ZIP functions of PHP (NOTE: this requires for ZZIPlib (PHP 4.0), or zlib (PHP 5.0) libraries to be installed with PHP) (formAction.php).
$zip = new ZipArchive();
$zip_name = '/zips/'.$_SESSION['rand_id'].'.zip';
$filename1 = '/tmp_dirs/'.$_SESSION['rand_id'].'outputFile.php';
$filename2 = '/otherDirectory/filename.php';
$filename3 = '/otherDirectory/filename2.php';

if ($zip->open($zip_name, ZIPARCHIVE::CREATE)!==TRUE) {
    exit("cannot open <$zip_name>n");

8. Ok so the zip file has been created, now we need to prompt the user to download the file. This can be accomplished by redirecting the user to the zip file. (formAction.php)
header("Location: ".$zip_name);

I would like to mention now that these samples are nothing more than samples, I have not tested this particular code, I have used similar functions in other projects but since this is untested I do not assure its function. Also there are many things that should be added to these samples such as the removal of files after use, checking to make sure files were created correctly, form validation, etc.
Last edited:
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock