well so far this is a short code, however, I seem to have the problem that everytime I try and generate a random file it will not create this file to open, instead it just says it can't open the file. I want to know why this code will not work. The code is short so it shouldn't be hard to figure out.
<?PHP
//////THI-Paste//////
$title = $_POST['title'];
$type = $_POST['type'];
$author = $_POST['author'];
$info = $_POST['info'];
$self= $_SERVER[’PHP_SELF’];
$n = 8; $x = 0;
$ext = ".txt";
/////Make Random url / file function/////////
function randomurl($length) {
$pattern = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
for($i=0;$i<$length;$i++)
{
$url .= $pattern{rand(0,60)};
}
return $url;
}
while($x < "1"){
$file = randomurl($n);
$link = fopen("$file$ext", 'x+') or die("Could not open file");
fwrite($link, "OMG it works"); fclose($link);
} ?>