Raggaer
Godly Member
Hello, im making a simple pastebin site to train my php skills but I cant figure out how to show the pastecode you type in a new link
With that you can see the code in ex: localhost/pastes/file.txt but to see it like pastebin.com does? any idea?
PHP:
<?PHP
require("functions/core.php");
pastes();
connectt();
if ($_POST['submit']) {
$title = $_POST['title'];
$body = $_POST['body'];
$date = date("Y-m-d");
if ($title && $body) {
$query = mysql_query("INSERT INTO codes VALUES('','$title','$body','$date')");
$filename = "w".$title.".txt";
$handle = fopen('pastes\\'.$filename, 'w');
fwrite($handle,$body);
fclose($handle);
die( 'Share added correctly<br>
Your paste link is :<b> pastes/w'.$title.'.txt</b>
');
} else {
echo 'Fill all fields';
echo'<br>';
echo'<br>';
}
}
?>
With that you can see the code in ex: localhost/pastes/file.txt but to see it like pastebin.com does? any idea?