Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Allow authorized user to change text on webpage *SOLVED* Please comment

  1. #1
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default Allow authorized user to change text on webpage *SOLVED* Please comment

    I would like to be able to allow someone to change one line of text on an HTML document that I constructed. It needs to be password protected.

    For example:

    HTML: <span>We will be open Monday</span> is on www.mysite.com . I would like to create a page where there is a form box that a user can enter text into, click a submit button, and have "We will be open Monday" change to whatever they want. This would then be saved so subsequent visitors would see the updated text.

    Please help, I think this is pretty simple and I have found some solutions, but they are all very very complicated.

    Thanks in advance. Great fourms!

    Jason
    Last edited by JasonDFR; 04-09-2008 at 08:50 AM. Reason: Solution posted want comments

  2. #2
    Join Date
    Mar 2008
    Posts
    122
    Thanks
    17
    Thanked 5 Times in 5 Posts

    Default

    hmm try this: (XHTML)


    <html>
    <head>
    <script type="text/javascript">
    function refresh() {
    var txt = document.getElementById('usertext').value;
    document.getElementById('update').innerHTML = txt;
    }
    </script>
    </head>
    <body>
    <p><span id="update">We will be open Monday</span></p>
    <input type="text" id="usertext" /><input type="button" onClick="refresh()" value="Update" />
    </body>
    </html>

    Please COntact mE!
    Last edited by hmsnacker123; 04-08-2008 at 04:32 PM.

  3. #3
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Thanks. That is on the right track.

    But I need something server side I think that will save the entered text into the original HTML document.

    I would like to put the text box on a separate page that I will password protect.

    So someone goes to www.mysite.com/private.html and enters text into the box, clicks a button. The text on www.mysite.com/index.html is changed and remains that way.

    Thanks again for the help!

    J

  4. #4
    Join Date
    Mar 2008
    Posts
    122
    Thanks
    17
    Thanked 5 Times in 5 Posts

    Default

    ok for a login i highly recomend that you dont use JavaScript, but find a PHP script or cofigure a sql database using aspx instead as for the thing where is saves the text, you can also use aspx webparts. to download sql look on microsoft.com. reply.

    also i think you should set up an IIS so you can view .aspx extensions in your web browser. (if you cant already)
    Last edited by hmsnacker123; 04-10-2008 at 03:01 PM.

  5. #5
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Thanks again for the reply. I'll look into your suggestions for sure.

    I just found this:

    http://www.snippetmaster.com/index.php

    Any thoughts on it?

  6. #6
    Join Date
    Mar 2008
    Posts
    122
    Thanks
    17
    Thanked 5 Times in 5 Posts

    Default

    this cant permantly save the edited text to the website through the private.html page, but this is my last reply cos i have to go

  7. #7
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    I have spent this morning figuring it out and I came up with this. It is different from your script, but it seems to work. BTW I used the Tizag.com tutorial to learn all this. It is a really good tut.

    *****I've got this where I want it on /index.php : <span><?php include("ticker.txt"); ?></span>

    *****I've got this on /private.php



    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

    <head>
    <title></title>


    </head>

    <body>

    <h1>TICKER CHANGE PAGE</h1>

    <h2>60 Characters Maximum INCLUDING Spaces</h2>
    <br />
    <form action="process.php" method="post">
    New Ticker Text: <input type="text" size="60" maxlength="60" name="ticker_text" />
    <input type="submit" />
    </form>


    </body>
    </html>


    ******And this on /process.php :


    <html>

    <body>

    <?php

    $ticker_text = $_POST['ticker_text'];

    $ticker_file = "ticker.txt";
    $fh = fopen($ticker_file, 'w') or die("can't open file");
    fwrite($fh, $ticker_text);
    fclose($fh);
    echo $ticker_text;

    ?>

    </body>

    </html>


    Seems to work. I'll password protect /private.php.

    You guys see any flaws?

  8. #8
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    here's my view of private.php(with login):
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
    <title></title>
    
    
    </head>
    
    <body>
    <?php 
    if ($_POST['password']=="your_pass" && $_POST['username']=="your_user") {
    ?>
    <h1>TICKER CHANGE PAGE</h1>
    
    <h2>60 Characters Maximum INCLUDING Spaces</h2>
    <br />
    <form action="process.php" method="post">
    Ticker Text: <input type="text" value="<?php include('ticker.txt');?>" size="60" maxlength="60" name="ticker_text" />
    <input type="submit" />
    </form>
    <?php
    } else {
    $error=(isset($_POST['submitted']) && $_POST['submitted']=="yes")?"Wrong username or password. Please try again.":"";
    echo '<span style="font-color:red">'.$error.'</span><br />';
    ?>
    <form action="private.php" method="post">
    Username: <input type="text" name="username" /><br />
    Password: <input type="text" name="password" />
    <input type="hidden" name="submitted" value="yes"/><br />
    <input type="submit" />
    <?php
    }
    ?>
    </form>
    </body>
    </html>
    change the values in red
    Last edited by Master_script_maker; 04-09-2008 at 09:54 PM.
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@ /\/\@|{
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  9. #9
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Very nice. I like it. How do I handle the password in this case? I had planned to use my webhosts file manager to password protect the /private.php file .

    J
    Last edited by JasonDFR; 04-09-2008 at 02:29 PM. Reason: adding information

  10. #10
    Join Date
    May 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default working?

    Did anyone get this to work? I get an 405 error, but then when i refresh it shows me nothing except for the bit of normal html text i popped in there, the word type in in private.php should show up between the brackets).

    this is my process file:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
    <title></title>
    
    
    </head>
    
    <body>
    
    <h1>TICKER CHANGE PAGE</h1>
    
    <h2>60 Characters Maximum INCLUDING Spaces</h2>
    <br />
    <form action="process.php" method="post">
    New Ticker Text: <input type="text" size="60" maxlength="60" name="ticker_text" />
    <input type="submit" />
    </form>
    
    
    </body>
    </html>
    I am really in desperate need of some code that an admin user can change and every other surfer will see (on a different page like the example above).

Similar Threads

  1. Comment Script with reply to comment support
    By luckycreationsindia in forum Looking for such a script or service
    Replies: 1
    Last Post: 01-17-2012, 08:29 PM
  2. user's simple entry onto a webpage?
    By HWL in forum Looking for such a script or service
    Replies: 25
    Last Post: 06-17-2010, 07:03 PM
  3. Resolved Change a webpage's background!
    By bruglione in forum Looking for such a script or service
    Replies: 18
    Last Post: 11-26-2008, 10:39 PM
  4. Certain Part of webpage change upon refresh?
    By stephenjames716 in forum HTML
    Replies: 4
    Last Post: 09-08-2008, 09:34 PM
  5. Replies: 0
    Last Post: 01-17-2007, 03:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •