Quote:
Originally Posted by Sarteck
What's your "Paste" template got in it? Chances are that you forgot to add the needed security token.
In whatever <form> you have, be sure to add the tag
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
Some advice, though. Don't access $_POST, $_GET, or $_REQUEST directly. Instead of:
PHP Code:
$title = $_POST['name'];
use
PHP Code:
$title = $vbulletin->input->clean_gpc('p', 'name', TYPE_STR);
And stuff like that. vBulletin's cleaning functions make it so that you don't have to worry about data being "bad" or of a type you don't want.
|
Here's the template, so where would I put the security token? Sorry for the trouble.
Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle]</title>
</head>
<body>
$header
$navbar
<!-- Custom Code Start Here -->
<?php
$paste = htmlentities($_POST['paste']);
$sub = $_POST['sub'];
$name = md5($_POST['name']);
$title = $vbulletin->input->clean_gpc('p', 'name', TYPE_STR);
$dir = getcwd();
$rand = rand(1,200);
$save = "$name$rand.html";
$all = "<center>Name of paste:<h3>$title</h3><hr /><br /></center><pre> $paste </pre>";
if(isset($sub)){
if(!empty($title) && !empty($paste)){
file_put_contents("$dir/$save", $all , FILE_APPEND);
echo "<footer>View your paste: <a href=" . $save . ">$title</a></footer>";
}
else{
echo "<script>alert('Please fill in all the fields.');</script>";
}
}
?>
<html>
<head>
<style type="text/css">
.inputForm
{
-moz-border-radius:5px;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
border-radius: 5px;
}
textarea
{
-moz-border-radius:5px;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
border-radius: 5px;
}
</style>
</head>
<body>
<body bgcolor="#F5F5F5">
<center>
<form action="" method="post" align="center">
Title of Paste:<input type="text" class="inputForm" name="name">
<br />
<textarea id=text name="paste" rows=30 cols=68 onload="fade()"></textarea>
<br />
<input type="submit" name="sub">
</center>
</form>
<!-- / Custom Code Ends here -->
$footer
</body>
</html>