Forum Moderators: coopster

Message Too Old, No Replies

Web Based Webpage Editor

         

artie2004

5:31 pm on Nov 24, 2004 (gmt 0)

10+ Year Member



I have a javascript file on my server at
[example.com...]

On my afilliate sites product pages they have included the following:

<HEAD>
<SCRIPT LANGUAGE="JavaScript" SRC="http://example.com/www.afilliatsite.com.js"></SCRIPT></HEAD>

and

<!-- Displays product price -->

$<SCRIPT TYPE="TEXT/JAVASCRIPT" LANGUAGE="JAVASCRIPT">
document.write(product1())
</SCRIPT>

My question is, i am looking for a script(preferably in PHP) that will allow me to update this javascript file via the web (thru a browser). Specifically, i need a script that shows a form to edit selected fields in this javascript file. Does anyone know where i can find a script like this? Is this even possible or is there an alternative way about doing this?

[edited by: ergophobe at 11:02 pm (utc) on Nov. 25, 2004]
[edit reason] url changed to example.com [/edit]

coopster

11:38 pm on Dec 6, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I think you would probably have to custom code something like this. You would want to be pretty particular who you allow to update your javascript files, though. How?
  1. Open the file, load it into a variable or array.
  2. Locate the variables you are interested in using a regular expression.
  3. Push them into your form.
  4. Receive user input, edit the input.
  5. If all is well, use a regular expression to once again update the string or array value(s).
  6. Write the file back out with the new values loaded.
  7. Send a success message.
As I said though, I would password protect this script so only trusted folk are allowed to make any updates to the javascript, then I would double-check the entered information again anyway.