zechdc Posted January 8, 2008 Share Posted January 8, 2008 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); Link to comment https://forums.phpfreaks.com/topic/84957-unable-to-open-files-in-web-browser-once-i-create-them-in-php/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.