Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

PHP script to automate some uploading and adding

Posted on 2005-05-11
3
Medium Priority
?
230 Views
Last Modified: 2008-02-20
I'm looking for a script in php to automate some things i do by hand!

on my server i have a file named .htacces wich is located in:

/home/bogmon05/public_html/

The file .htacces file contains the following content:
[begin .htaccesfile]
#
#  mod_rewrite in use
#

RewriteEngine On

RewriteBase /

#
#  Rules
#

RewriteRule ^news(.*) news.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) index.php

RedirectMatch permanent ^/media/lolasian.wmv$ http://www.xxxxxxx.com/bogmon/videos/lolasian.wmv

RedirectMatch permanent ^/media/volkswagon.wmv$ http://www.xxxxxx.com/bogmon/videos/volkswagon.wmv
[/end .htacces file]

Now i want a php page where i can fill in a NAME ( in a field ) then it should download from the ftp the .htacces file add a new line on the bottom of the .htacces and reupload it.

[line should be added to .htacces]
RedirectMatch permanent ^/media/NAME.wmv$ http://www.xxxxxx.com/bogmon/videos/NAME.wmv
[/line should be added to .htacces]

Here it should replace NAME with the name i insterted in the field.

Could you guys help me out

thnx in advance
0
Comment
Question by:Mr-sark
  • 2
2 Comments
 
LVL 7

Accepted Solution

by:
jdpipe earned 1500 total points
ID: 13983335
how are you doing the 'download from the ftp'?

I suggest that you should use a more general-purpose RedirectMatch file - it doesn't make sense that you have to edit .htaccess every time you want to add a file to your website. And I would use aliasmatch instead, perhaps.For example:

AliasMatch ^/media/([a-z][a-z0-9]*).(wmv|avi|mpg)$ /home/bogmon05/public_html/videos/$1.$2

Hope that helps

JP
0
 
LVL 7

Expert Comment

by:jdpipe
ID: 13983342
so... the above 'aliasmatch' would allow you to use ANY URL like

http://xxx.com/media/aaaa.mpg 
http://xxx.com/media/bbbb.avi
http://xxx.com/media/cccc.wmv

and it will retreive the file from your 'videos' directory.

If redirectmatch is what you want, then use that instead of course. Just change the second part back into a URL instead of a file path.

JP

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question