The code was designed to create a new page with the random number and then it would insert code into the newly created file. This worked when I was using my localhost, but now I receive these error messages. I looked around the web and I saw somethings about permissions??? So, please be as detailed as possible in your answer!
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,shortdescription,price,rank,tag1,tag2,tag3)
VALUES ('$Title','$Random_Number','$url','$Category','$Username','$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");
?>