Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Automatic Code Insertion
Old 02-28-2008, 04:30 AM Automatic Code Insertion
cbeaudin's Avatar
Extreme Talker

Posts: 158
Name: cbeaudin
Location: Proud to be Canadian
Trades: 1
I want to be able to create ftp accounts for subdirectories on my server so that i can provide a few people with some free webspace.

I am trying to find a way to have a script in a higher directory that automatically adds code to the biggining of each file (advertisment). The code must be seperate from the files in that directory so that the ftp users can upload any code and they do not have control over the advertisments.

Thank you in advance for any help.
__________________
- cbeaudin
cbeaudin is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-28-2008, 04:54 AM Re: Automatic Code Insertion
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Wtf.
1. You never should modify your user's files without prior and mutual agreement.
2. You never should modify each file because it can be binary data file or config file or whatever else.
3. This should be done by means of your webserver, on the stage of sending the final output to the user. E.g. nginx can do it and I'm not totally sure but suppose that apache can too. You can also use auto_prepend_file setting in your php.ini but in this case you won't be able to attach your ads to html files.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 02-28-2008, 05:20 AM Re: Automatic Code Insertion
cbeaudin's Avatar
Extreme Talker

Posts: 158
Name: cbeaudin
Location: Proud to be Canadian
Trades: 1
1. There will definatly be a mutal agreement between me and the users. I would never provide anyone with free webspace without telling them that a banner will be included on each of thier pages.
2. By "each file" i meant each .html/.htm file.
3. This is a shared server and i am hoping for a solution that does not include server modification.
__________________
- cbeaudin
cbeaudin is offline
Reply With Quote
View Public Profile
 
Old 02-29-2008, 01:24 AM Re: Automatic Code Insertion
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
If you want to modify files physically you can write a simple script that will take html file name as an argument, check whether it is modified already and if not then append your bannerin front of it. This script can be run from shell or by cron along with 'find' command to recursively find all html files (something like "find -E /your/root/path -type f -regex '.*html?' -exec php yourscript.php {} \;") or you can reinvent recursive directory scanning in your script.

If you do not want to modify user's html files physically then I'm afraid you will not be able to avoid server modification in any case.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to Automatic Code Insertion
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24815 seconds with 12 queries