How To Inject Code Into PHP Files and ZIP ONLINE?

gimme4free

Elite Member
Joined
Oct 22, 2008
Messages
1,935
Reaction score
1,989
I am looking for a PHP script like the one used on cakeslice.

Basically you tpe in your URL, add it to a rotator and at the end click download and out pops a ZIP file with a couple of folders, a txt file and a PHP file all customized to what you have previously entered.

I have got my own files that I need to inject certain links into but do not know how to do this. Anyone know much about this? :)
 
UPDATE: I was being thick at the time of writing the first post or just didnt put enough info. This is what will happen:

User will enter affiliate link 1 ($aff1) & affilite link 2 ($aff2). And then click Next.

The second file will GET $aff1 and $aff2 and insert them into a default code.

I can get the code to display on the second page with these too links entered. But this is not what I want to happen. I want the $aff1 and $aff2 to be put into two PHP files and the ZIP the files so the user can then click download or for this to happen when they click next and the download will start.

Anyone know how to do this?
 
You can make new files with the following code:

Code:
$file = fopen("file.php","w"); 
fwrite($file,'$aff1');
fclose($file);

Then you can for example use the following PHP library:
Code:
http://www.weberdev.com/get_example-4066.html
and create a new ZIP file like this:

Code:
<?php
include("zip.lib.php");
$zipper = new zipfile();
$zipper->addFiles(array("mypdf.pdf","file.png"));  //array of files
$zipper->output("myzip.zip");
?>
 
Thanks for that, any idea how I can send data to a file and the other file can receive it in a certain place? Like a sort of GET function.

So Form1.php Sends dat to Page2.php and page 2 displays this data where it says $DATAGOESHERE

Any idea what PHP code to use here?
 
Here is the way I do it..

I put the text to be overwritten as something like '//MYVAR'.
So, in the php file, you could have something like, $myvar=//MYVAR

Now, the other php file opens this file, and uses a function like this:
Code:
$acs=strrpos($contents,'//MYVAR');
$leftstr=substr($contents,0,$acs);
$rightstr=substr($contents,$acs);
$contents = $leftstr.$variabledata.$rightstr;
$contents = str_replace('//MYVAR','',$contents);

This looks for the text //MYVAR, copys whats before it and after it into 2 different strings, then makes a new string like, before, then variable data, then after. Then it deletes the //MYVAR text.

I imaging you could use a preg_replace pretty much the same way. But, to be honest, I didn't know about preg_replace when I figured this method out, and I just copied and pasted this little snippet from the php creation part of Gump.

Hope that helped some. Thank me if you like. :]
 
Back
Top