Jump to content

Unable to open files in web browser once I create them in php.


Recommended Posts

The php code below successfully creates the directory and all the files. When I the files that are being called by the view_scores_$number file are in the directory specified. For whatever reason I am not able to view that page when I type it into the browser url. It just displays a missing page.

 

$dir_var = mkdir("$tablename", 0700);
    				if ($dir_var)
    				{
    				}
    				echo "<br>Directory Setup";
    				$creatFile = fopen("$tablename/config.php", 'w');
    				$EnterData = "<?php \$table = $scorecode;\n \$dirname = $tablename; ?>";
    				fwrite($creatFile, $EnterData);
    				chmod("$tablename/config.php", 0644);
    				fclose($creatFile);
    				$createFile = fopen("$tablename/dbconnect.php", 'w');
    				$EnterData2 = "<?php\n \$host = \"test.server\";\n \$user = \"test\";\n \$pass = \"test2\";\n \$database = \"databasetest\";\n \$dbcnx = @mysql_connect(\$host,\$user, \$pass);\n if (!\$dbcnx) {\n echo( \"<P>Unable to connect to the database server at this time.</P>\" );\n exit();\n }\n if (! @mysql_select_db(\$database) ) {\n echo( \"Unable to find database\" );\n exit();\ }\n ?>";
    				fwrite($createFile, $EnterData2);
    				chmod("$tablename/dbconnect.php", 0644);
    				fclose($createFile);
    				for ($number = 1; $number <= 20; $number++)
    				{
    					$myFile = "$tablename/view_scores_$number.php";
    					$ourFileHandle = fopen($myFile, 'w') or die("can't open file $number");
    					$stringData = "<?php require_once (\"http://pogollama.com/scoreboards/view_scores_$number.php\");\n require_once (\"http://pogollama.com/scoreboards/$tablename/config.php\");\n ?>";
    					fwrite($ourFileHandle, $stringData);
    					chmod("$tablename/view_scores_$number.php", 0644);
    					fclose($ourFileHandle);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.