Let users create a html/php page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skuer
    New Member
    • Feb 2008
    • 13

    Let users create a html/php page

    Hey everybody

    I'm very new to the php and mysql stuff, but know the basic of it..

    My qusetion:

    Is it possible to let people make their own pages (like html/php) on my site?

    With that I mean users who are registered and have posted their text (with form) to an mysql table..

    I want the layout to be simple as possible and I hope it can be stored under a special folder on the server..

    So do anybody know how I can create this code, or can someone give me some advise?

    Thankful for any advises..

    Skuer
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Of course you can do that. But there are some questions to be answered and some precautions you have to take.

    1. I would not allow my users to use server-side execution code, like PHP.
    2. Nor would I allow them Javascript or any nother code in the html pages.

    Assuming that you do not want a bulletin board but just html only pages, some thoughts:
    1. Do you want to allow users to use make-up of the page, like BB tags, smileys, images etc?
    2. Have you thought about filtering all page content for bad words, advertisements, links?
    3. Have you planned to filter all content in order to prevent malicious code attacks?

    Ronald

    Comment

    • skuer
      New Member
      • Feb 2008
      • 13

      #3
      Originally posted by ronverdonk
      Of course you can do that. But there are some questions to be answered and some precautions you have to take.

      1. I would not allow my users to use server-side execution code, like PHP.
      2. Nor would I allow them Javascript or any nother code in the html pages.

      Assuming that you do not want a bulletin board but just html only pages, some thoughts:
      1. Do you want to allow users to use make-up of the page, like BB tags, smileys, images etc?
      2. Have you thought about filtering all page content for bad words, advertisements, links?
      3. Have you planned to filter all content in order to prevent malicious code attacks?

      Ronald
      Well I have thought about the questions you asked me

      I want the page to be as simple as possible, that means plain text and perhaps 1 picture..

      And when you mention the two last quetion I havent thought much about it..

      My site is more like a hobby site, but I will give it a thought..

      If you could help me with a simple code from the mysql table (or from the text box), to the "make html page"...I would really be thankful for that
      (sorry for the writing mistakes)

      Skuer

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Start coding and we'll help you along here. The following checklist could help you to make up the ultimate html text:
        • Remove all embedded (possible) code
        • Filter all 'dirty' and not-allowed words out
        • Replace bb-code tags by HTML tags (incl. imgage placement)
        • Replace free-format URLs with <a href...> elements
        • Replace \n and \n\r line breaks with <br />


        Ronald

        Comment

        • skuer
          New Member
          • Feb 2008
          • 13

          #5
          Originally posted by ronverdonk
          Start coding and we'll help you along here. The following checklist could help you to make up the ultimate html text:
          • Remove all embedded (possible) code
          • Filter all 'dirty' and not-allowed words out
          • Replace bb-code tags by HTML tags (incl. imgage placement)
          • Replace free-format URLs with <a href...> elements
          • Replace \n and \n\r line breaks with <br />


          Ronald
          Thanks, trying my best to come up with the right code..

          I acctually found a code, but it's in asp.net:(..

          Trying too look at it, figure how I can write the code in php..

          [HTML]<%@ Import Namespace="Syst em.IO" %>

          <script language="C#" runat="server">
          void ProcessButton(O bject sender, EventArgs e) {
          string f = Server.MapPath( theFile.Text);
          StreamWriter sw = File.CreateText (f);
          sw.Write(theCon tents.Text);
          sw.Close();
          theMessage.Text = "Created file: <a href=\"" + theFile.Text + "\">" + theFile.Text + "</a>";
          }
          </script>

          <html>
          <body>

          <h2>Create an HTML File</h2>

          <form runat="server">
          HTML Text:<br>
          <asp:TextBox id="theContents " runat="server"
          TextMode="Multi Line"
          Columns=50
          Rows=10
          />

          <br>
          <br>

          File Name: <asp:TextBox id="theFile" runat="server"/>
          <asp:Button id="theButton" runat="server"
          OnClick="Proces sButton"
          Text="Create File"
          />

          <br>
          <br>

          <asp:Label id="theMessage " runat="server"/>

          </form>

          </body>
          </html>[/HTML]

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #6
            You cannot use that. It simply reads a textbox and makes it a file. Why not start some code yourself and we'll help when you get along.

            Ronald

            Comment

            Working...