Hi all,
To start of with ill exsplain what im doing.
I am making a game walkthrough submitter script.
How ever i have come across a few things i need some help with doing.
Ok, so to start of with there are 3 text boxes
The 1st one they type there username into, the second They write the game title in and 3rd one they add the walkthrough to.
Then there is a drop down box with 5 selections
1) Action & Adventure
2) Driving & Racing
3) Role-Playing Games
4) War & Shoot 'Em Ups
5) Sport
On submit, it creates a page from a pre made template at walkthrough/templates/file1.html
wich consists of ( for example )
so what i need is to modify the following script to do this, im just not sure on the script to fufill my needs. :( Also i would like it if it gives the file a random name ( so the same one is never used twice )PHP Code:<html>
<head>
<title>{REPLACE_TITLE}</title>
</head>
<body>
MADE BY <b> {REPLACE_WITH_USERNAME} </b>
IN CATAGORY <b> {REPLACE_CATAGORY} </b>
<b> {REPLACE_DATA} </b>
</body>
</html>
also this script creates the script to the folder /walkthrough/ and i would like it to create it into the folder depending on what category they place it under.PHP Code:<?php
if(empty($_POST)) {
?>
<form method="post">
File Name <input type="text" name="name" size="20"><p>
Game Name <input type="text" name="title" size="22"></p>
<p>
Walkthrough - use as much space as you like<br>
<textarea rows="16" name="content" cols="51"></textarea><br>
<input type="submit" value="Create"> </p>
</form>
<?php
die();
}
$name = $_POST['name'];
$title = $_POST['title'];
$content = $_POST['content'];
$sanitized_name = preg_replace('/[^0-9a-z\.\_\-]/i','',$name);
if ($sanitized_name == $name) {
$data = file_get_contents("walkthrough/templates/file1.html");
if(get_magic_quotes_gpc())
$data = stripslashes($data);
$data = str_replace("{REPLACE_TITLE}",$title,$data);
$data = str_replace("{REPLACE_DATA}",$content,$data);
write_file("walkthrough/$name.php",$data);
} else {
echo "Filename problems. Try ".$sanitized_name;
exit;
}
function write_file($filename,$data) {
$f = fopen($filename,"w");
fwrite($f,$data);
fclose($f);
}
?>
Another thing that would be great ( if anyone knows how to do it ) is to also add a link to the created page, in the form of a table with the text being the game title. ( so its like a menu, that would be great ).
Any questions just ask
Thanx - all help is apreceated.
- Paul

