I get this error for this code.....

Warning: fopen(964830301.php) [function.fopen]: failed to open stream: Permission denied in product.php on line 168
PHP Error Message
Warning: fwrite(): supplied argument is not a valid stream resource in product.php on line 169

This is the code...

$Random_Number = rand(100,100000000000);
$Check_Number = mysql_query("SELECT * FROM products WHERE randomnumber='$Random_Number'");
$Check_Final = mysql_num_rows($Check_Number);

while($Check_Final != '0')
{
$Random_Number = rand(100,100000000000);
}

$Query = mysql_query("INSERT INTO products (title,url,finalurl,category,owner,shortdescriptio n,price,rank,tag1,tag2,tag3)
VALUES ('$Title','$Random_Number','$url','$Category','$Us ername','$SD','$Price','-10','$Tag1','$Tag2','$Tag3')");
echo mysql_error();
if(!$Query)
{
die("There was an error creating your product!");
}
else
{
echo "Yes! Your product was created, I hope " . $Title . " will rank high!";
$Insert_Link_Click = '0';
}

$php = "<?php

if (!mysql_connect(\"127.0.0.1\",\"root\",\"\"))
{
die(\"MySQL could not connect!\");
}

if(!mysql_select_db('FinddOnline'))
{
die(\"My SQL could not select Database!\");
}
\$Today = date(\"Y-m-d\");
if(!mysql_query(\"INSERT INTO clicks (username,title,date)
VALUES ('$Username','$Title','\$Today')\"))
{
die(\"Opps Try again!\");
}
else
{
header(\"location:$url\");
}


?>";

$Create_File = fopen($Random_Number . '.php','w');
fwrite($Create_File,"$php");

?>

It was design to automatically create a page then inset code into the page but I recieve those error messages? ???? Best answer will be chosen FAST!