Här är iallafall scriptet.
<?php if (empty($_POST[code]) || empty($_POST[effect])) { echo "You did not enter a cheat or the effect."; } else { $path_name = $_POST[game]; $path_name=strtolower($path_name); $path_name=preg_replace('/\s+/', '', $path_name); $full_path="../games/$path_name/cheats/$path_name.php"; } if (file_exists($full_path)) { include 'db_con.php'; $sql="SELECT * FROM cheats_table WHERE code='$_POST[code]'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ $exists = $row['code']; } if ($exists != $_POST[code]) { $sql="INSERT INTO cheats_table (game,code,effect) VALUES ('$_POST[game]','$_POST[code]','$_POST[effect]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Cheat code added"; mysql_close($con); } else { echo 'The code you entered already exists.'; } } else { mkdir("../games/$path_name/cheats", 0777); echo chmod("../games/$path_name/cheats", 0777); $file= fopen ("../games/$path_name/cheats/$path_name.php", "x") or die("Game cheat files already exists!"); echo fwrite($file, "<?php"); echo fwrite($file, "\n"); echo fwrite($file, "\$game_cheat ='"); echo fwrite($file, $game); echo fwrite($file, "';\n"); echo fwrite($file, "include '../../cheats_template.php';"); echo fwrite($file, "\n"); echo fwrite($file, "\?\>"); fclose($file); echo 'Cheat file created'; include 'db_con.php'; $sql="INSERT INTO cheats_table (game,code,effect) VALUES ('$_POST[game]','$_POST[code]','$_POST[effect]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Cheat code added"; mysql_close($con); } ?>
Om ni kan se varför jag får detta fel medelande då jag försöker öppna filerna efteråt så skulle jag vara djupt tacksam för hjälpen.
Citat
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator,
webmaster@domain.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator,
webmaster@domain.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Filerna som blir skapade ser ut såhär med variablerna istället för värdena.
<?php $game_cheat ='$game'; include '../../cheats_template.php'; ?>
Tack på förhand // Raigon