Jump to content
xisto Community
Albus Dumbledore

Script I Am Looking For Kind of like a content management system

Recommended Posts

Ok,

what i am looking for would be a script, that has a page set-up similar to this
http://forums.xisto.com/no_longer_exists/

But, what i want it to do, is when i type in the Name: box, that will be the file name to a new file on my site.

and whatever i put in the Content: box, will be the content that is put inbetween he top part of my sites HTML, and the bottom part of my sites HTML...

and it would automatically have the HTML pre-set into the code, and easy for me to change it if i change layouts.

it's kind of hard to explain, but if you dont undertand please let me know.

I know there are scripts out there, but i dont know where i can find them./what to call them >_<

so it would kind of be like this


<HTML><HEAD>
<TITLE>.:Hogwarts Magic:. Where Real Magic Is Possible!</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META NAME="author" CONTENT="Phillip Morehead">
<META NAME="copyright" CONTENT="© Phillip Morehead 2006 All Rights Reserved">
<META NAME="keywords" CONTENT="Harry ginny ,Ron hermione,Scripts,Hex, Articles, muggle tower, quotes, quiz, bio , Scripts ,harry potter, jk rowling ,Daniel , Emma , Hex , Hexie , magic, quidditch, wizards, witches, hogwarts, the sorcerer's stone, Dobby , Sana , Potter , scholastic, bloomsbury, warner bros., daniel radcliffe, rupert grint, emma watson, tom felton Sorcerer's Stone, Chamber of Secrets, Prisoner of Azkaban, Goblet of Fire, Order of the Phoenix, Half Blood Prince, Quidditch">
<META NAME="description" CONTENT="Hogwarts Magic is your source for all of your Harry Potter needs, whether it be Harry Potter Pictures, or magical spells, everything related to harry potter can be located here at Hogwarts Magic!">
<META NAME="rating" CONTENT="general">
<link rel="stylesheet" href="site_files/css.css" type="text/css">
</HEAD>
<BODY text="#FFFFFF" bgcolor="#000000" topmargin="0" leftmargin="0" rightmargin="0">
<CENTER>
<table width="100%" cellspacing="0" cellpadding="0" bgcolor="#000000" border="0">
<tr>
<td align="center" colspan="1"><img src="images/layout_images/top.jpg" width="900" height="298" border="0"></td>
</tr><tr>
<td align="center" colspan="1">
<table align="center" cellspacing="0" cellpadding="0" background="images/layout_images/fill.jpg" border="0"><tr>
<td align="right" valign="top" width="199">
<table width="80%" cellspacing="0" cellpadding="4" border="0">
<tr><td align="center" valign="top"><?php include("site_files/menu.html"); ?>
</td>
</tr></table></td>
<td align="center" valign="top" width="507">
<table width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td align="center" valign="top">

READ THIS
HERE WOULD BE THE STUFF THAT I PUT IN THE CONTENT: BOX ON THAT FORM

<br><br>Hogwarts Magic is not an offical Harry Potter website, as much as we wish we were. Hogwarts Magic is in no way Affiliated with J.k. Rowling, Warner Brothers, Or Schoolastic Inc.
</td>
</tr></table></td>
<td valign="top" width="194">
<table width="80%" cellspacing="0" cellpadding="4" border="0">
<tr><td align="center" valign="top"><?php include("site_files/bottom.html"); ?>
</td>
</tr></table></td>
</tr></table></td>
</tr><tr>
<td align="center" colspan="1"><img src="images/layout_images/bottom.jpg" width="900" height="48" border="0"></td>
</tr></table>
<FONT face="Arial,Verdana" size=2><I>Template created by <a href="http://forums.xisto.com/no_longer_exists/; target="_top">Web Sets by Donna</a> ©2006</I></font><br><br>
</CENTER>
</BODY>
</HTML>


and whatever i put the File name: as, it would save it to the server as for example index.php if i put index.php in the File name area.....

this is all that i want it to do. i dont want to be able to edit other files or anything else....

Share this post


Link to post
Share on other sites

I think I understand what you sre saying. You want to basically type in the filename box eg. eg.html then the contents eg

<html ><body><h2>test</h2></body></html>

Then you want to write this to a new file? with the contens in it, and the filename is specified to the one you set ok?

Share this post


Link to post
Share on other sites

no, i would like for the

<html><head></head><body></body></html>

i just want to be able to put content in the textbox, and have it automatically put in the correct table.

but the rest you have is correct yes.

Share this post


Link to post
Share on other sites

no, i would like for the

<html><head></head><body></body></html>

i just want to be able to put content in the textbox, and have it automatically put in the correct table.

but the rest you have is correct yes.

ok I will sort it out, you will need php functionability on your server to make this work.

You basically need to use the touch command then the fwrite function to wite the contents to the file. You will need to use the POST superglobal as well.

Share this post


Link to post
Share on other sites

try this out:

<? if ($_POST[check] =="1"){if ($_POST[Message] =="" AND $_POST[name] ==""){header("Location: test.php?error=nm");exit;}else if ($_POST[name] ==""){header("Location: test.php?error=n");exit;}else if($_POST[Message] ==""){header("Location: test.php?error=m");exit;}else{}touch("$_POST[name].php");$r = $_POST[name].'.php';$fh = fopen($r, 'w') or die("Error!!");fwrite($fh, "<html>\n"); fwrite($fh, "<head>\n"); fwrite($fh, "</head>\n");  fwrite($fh, "<body>\n");fwrite($fh, "$_POST[Message]\n");fwrite($fh, "</body>\n");fwrite($fh, "</html>\n");?><?}else if ($_POST[check] !="1"){?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- saved from url=(0037)http://forums.xisto.com/no_longer_exists/ --><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=windows-1252"><form name="form1" method="post" action="<? $_SERVER['PHP_SELF'] ?>"><META content="MSHTML 6.00.2900.2627" name=GENERATOR></HEAD><BODY><p><B>File Name:</B>	<INPUT size=40 name=name>  <BR>  <BR>  <BR>	<B>Content:</B>  <TEXTAREA name=Message rows=7 cols=40></TEXTAREA> <input type="hidden" name="check" value="1"></p>  <input type="submit" name="Submit" value="Submit">     <? if ($_GET[error] =="nm"){$error = "Please enter a message and a filename";}else if ($_GET[error] == "n"){$error = "Please enter a filename";}else if ($_GET[error] =="m"){$error = "Please enter some content";}?><font color="#FF0000"><? echo $error; ?></font></form></FORM></BODY></HTML><? }else{}  ?>

Also save this as test.php

Notice from truefusion:
Switched from CODE to CODEBOX
Edited by truefusion (see edit history)

Share this post


Link to post
Share on other sites

i get this error

Warning: touch() [function.touch]: Unable to create file testingthis.php.php because Permission denied in /home/albus/public_html/test.php on line 24Warning: fopen(testingthis.php.php) [function.fopen]: failed to open stream: Permission denied in /home/albus/public_html/test.php on line 26Error!!

and nowhere in this do i see the HTML to my layout >_<

Share this post


Link to post
Share on other sites

I'm guessing permission denied cause you don't have public_html chmodded to 777. According to what i read in the first post, you want the script to create a file for you with a specified template. You can't do so without chmodding the folder that the "test.php" file is in, to 777. You'd be better off just having the script add the stuff from the Content field, and just display the HTML on submit. Then copy, and manually create, and paste into a new file.

Share this post


Link to post
Share on other sites

Hey AD If i understand correctly i might be able to help.

this is what i think you want, correct me if im wrong :blink: :

you want a page to enter a filename and some content for said file. during saving this file you want
[hide=code1]

<HTML><HEAD><TITLE>.:Hogwarts Magic:. Where Real Magic Is Possible!</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="author" CONTENT="Phillip Morehead"><META NAME="copyright" CONTENT="Š Phillip Morehead 2006 All Rights Reserved"><META NAME="keywords" CONTENT="Harry ginny ,Ron hermione,Scripts,Hex, Articles, muggle tower, quotes, quiz, bio , Scripts ,harry potter, jk rowling ,Daniel , Emma , Hex , Hexie , magic, quidditch, wizards, witches, hogwarts, the sorcerer's stone, Dobby , Sana , Potter , scholastic, bloomsbury, warner bros., daniel radcliffe, rupert grint, emma watson, tom felton Sorcerer's Stone, Chamber of Secrets, Prisoner of Azkaban, Goblet of Fire, Order of the Phoenix, Half Blood Prince, Quidditch"><META NAME="description" CONTENT="Hogwarts Magic is your source for all of your Harry Potter needs, whether it be Harry Potter Pictures, or magical spells, everything related to harry potter can be located here at Hogwarts Magic!"><META NAME="rating" CONTENT="general"><link rel="stylesheet" href="site_files/css.css" type="text/css"></HEAD><BODY text="#FFFFFF" bgcolor="#000000" topmargin="0" leftmargin="0" rightmargin="0"><CENTER><table width="100%" cellspacing="0" cellpadding="0" bgcolor="#000000" border="0"><tr><td align="center" colspan="1"><img src="images/layout_images/top.jpg" width="900" height="298" border="0"></td></tr><tr><td align="center" colspan="1"><table align="center" cellspacing="0" cellpadding="0" background="images/layout_images/fill.jpg" border="0"><tr><td align="right" valign="top" width="199"><table width="80%" cellspacing="0" cellpadding="4" border="0"><tr><td align="center" valign="top"><?php include("site_files/menu.html"); ?></td></tr></table></td><td align="center" valign="top" width="507"><table width="100%" cellspacing="0" cellpadding="5" border="0"><tr><td align="center" valign="top">
[/hide]

To go above the file content and

[hide=code2]
<br><br>Hogwarts Magic is not an offical Harry Potter website, as much as we wish we were. Hogwarts Magic is in no way Affiliated with J.k. Rowling, Warner Brothers, Or Schoolastic Inc.</td></tr></table></td><td valign="top" width="194"><table width="80%" cellspacing="0" cellpadding="4" border="0"><tr><td align="center" valign="top"><?php include("site_files/bottom.html"); ?></td></tr></table></td></tr></table></td></tr><tr><td align="center" colspan="1"><img src="images/layout_images/bottom.jpg" width="900" height="48" border="0"></td></tr></table><FONT face="Arial,Verdana" size=2><I>Template created by <a href="http://websetsbydonna.com/" target="_top">Web Sets by Donna</a> Š2006</I></font><br><br></CENTER></BODY></HTML>
[/hide]

Below the content you enter in the form. This file will then be saved into the current directory as whatever filename you put into the filename box.

If thats what you want i should be able to help as i was working on a file management script just yesterday. So long as you provide the HTML to go above and below the content it shouldnt be too hard :wacko:
Edited by shadowx (see edit history)

Share this post


Link to post
Share on other sites

Fair enough, well i'l give it a go when i get home at the moment because here at my dads i have none of the script i wrote the other day or the development software i need, but i should have it ready by 9:30pm GMT (in about 5 and a half hours as i wont be home for another 4 and a bit ;) )Hopefully it suits what you want :blink:[hr=noshade]Hey AD sorry but im not going to be able to make that script tonight ive got a cracking headache and the computer makes it worse (not really surprising, probably the reason i got it in the first place lol) So ill makew it when i get in from college tomorrow evening and post it tomorrow. Sorry for the delay, if you find something in the meantime let me know but if you still want it ill post it tomorrow for you. :wacko:[/hr]

Share this post


Link to post
Share on other sites

Hmmm.... interestingly enough, I'm working on a content management system of my own right now. I'm just in the very beginning stages of it though at the moment, so I don't know enough about all of that sort of stuff yet to be of much help to you, I'm afraid... But I'll definately be keeping an eye on this thread in hopes that I can pick up a thing or two myself in here. From what I'm reading already, I'm happy to see that it shouldn't be all that hard. My hardest part is that I don't know much about coding, so I'm sort of trying to learn that at the same time.Oh, and shadowx... I really hope your headache is better. I had a killer one the other night, so I can almost feel your pain...

Share this post


Link to post
Share on other sites

Hey thanks guys, its much better today, went to bed early last night so feeling mkuch better :blink: Still at college at the moment though, fun! should be home in a couple hours though.AD you will need to set the permissions of the directory in which this file will be made to be 777, if you use the cpanel its easy as clicking the directory and changing the numbers to all 7's or clicking all the check boxes, otherwise the script wont be allowed to make any new files as was the case with what truefusion said. Royal pain in the.. that error. Well my lesson is about to start so the next post i make should hopefully be the code :wacko:*EDIT*AD do you plan on having security on this file? Unless its going into a protected directory or something any old user could find this script and write files to your server to do all manner of things. If you've got security planned and ready then fair enough, if not i can add a simple login page which i wont guarantee is 100% secure but its better than nothing! Let me know if you want me to include it, it will only be another script used to check for a session and then either forward you to the page im currently making or, if not logged in, will ask you to log in. ;)

Edited by shadowx (see edit history)

Share this post


Link to post
Share on other sites

Well ive got the scripts finished now. Its three files, one is the php file which is used to take the input (filename and its contents) and save them. It also checks to see if a file exists already with that filename and wont let you save over it so you wont accidentally delete files! And there are two HTML files, one is the top half of the html code and one is the bottom half. Its obvious which is which from the filenames! They are included by the php script and added to the content you input in the form and the whole lot is saved. This way if you even need to change the top or bottom of the HTML code its much easier to do by editing the relevant HTML page :blink: Ive added the scripts in a ZIP as an attachment, i can post them as code if you'd prefer but i thought its easier this way. And like i said in te above post if you want i can add a little security and you will need to chmod the directory to 777. If you have any problems let me know and if possible ill sort it out :wacko:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.