PDA

View Full Version : Show [code] in new window


finkdawg5
04-08-2003, 11:35 PM
The problem that I'm having on my boards is that people post their html code asking for help with it, but sometimes we get people posting whole html pages, or long strings of code that either throw off my tables or make the thread incredibly ad needlessly long. Here's what one of my users suggested:

<?
$pageText = "This is text, put it in a file";
$dir = "test/";
$postId = "1236";
$fileName = $dir.$postId.".phps";

if (!file_exists($filename))
{
touch($fileName);
chmod($fileName,0666);
$fp = fopen($fileName, "w");
if(!$fp)
{
exit;
}
else
{
fwrite($fp, $pageText);
echo("<a href=\"".$fileName."\">Attached File</a>");
}
}
else
{
exit;
}
?>

I'm a newbie hacker, so I'm sure there are either problems with this code or security issues, can someone take a look for me? Thanks very much!

filburt1
04-08-2003, 11:40 PM
You probably can't treat the attachment as a file. Instead you'll have to get it from the attachment table (arguably easier, anyway).

Logician
04-09-2003, 06:34 AM
I moved the thread because: it's algorithm is wrong according to what you are trying to achieve and there is no way the hack will work in the way you released it.

Please get help in this forum and when hack is ready, feel free to email me for a move back to Hack releases section. :)

Thanks!