By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,890 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,890 IT Pros & Developers. It's quick & easy.

Let users create a html/php page

P: 13
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
Feb 11 '08 #1
Share this Question
Share on Google+
5 Replies


ronverdonk
Expert 2.5K+
P: 4,258
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
Feb 11 '08 #2

P: 13
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
Feb 12 '08 #3

ronverdonk
Expert 2.5K+
P: 4,258
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
Feb 13 '08 #4

P: 13
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="System.IO" %>

<script language="C#" runat="server">
void ProcessButton(Object sender, EventArgs e) {
string f = Server.MapPath(theFile.Text);
StreamWriter sw = File.CreateText(f);
sw.Write(theContents.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="MultiLine"
Columns=50
Rows=10
/>

<br>
<br>

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

<br>
<br>

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

</form>

</body>
</html>[/HTML]
Feb 14 '08 #5

ronverdonk
Expert 2.5K+
P: 4,258
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
Feb 15 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.