It's not as hard as you'd think.
Say that that you're creating a Pastebin. You'd have (simplified) the fields id, title, and filename. The filename could be random. For our purposes, $input is what the user is saving in the document, $title is the title, and we'll create the filename.
<?php
$title = mysql_real_escape_string($title);
$filename = rand(1,1000) . substr(0, 5, time());
mysql_query("INSERT INTO `pastebin`(title, filename) VALUES('$title', '$filename')");
$fh = fopen($filename . ".txt", +w);
fwrite($fh, $input);
fclose($fh);
?>
Of course, that's just creating it.
Reputation Points: 10
Solved Threads: 4
Junior Poster in Training
Offline 60 posts
since Jan 2009