enox10mx
New Member
- Messages
- 29
- Reaction score
- 0
- Points
- 0
hello. I have made a small two-page php script on my site. The script is supposed to allow me to create and edit pages on my website, without logging in to cpanel. Here is the code for the folder: File: index.php
File: edit.php
Whenever I go to index.php and type in a page name, and click my edit button, it returns the following php error:
(filepath is censored just in case.) Please help me.
PHP:
<a href="..">home</a>
<br />
<form action="edit.php" method="post">
<h1>type file to edit/make</h1>
<input type="text"name="urltoedit">
<input type="submit" value="edit">
</form>
PHP:
<a href="..">Home</a>
<br />
<a href="index.php">Edit/make another page</a>
<br />
<?php
$edit = "edit.php";
$filename = $_post['urltoedit']; // This is what you want to save the file as.
$content = $_post['code']; // This is the stuff that you want to put into the file.
if (empty($content)) {
$html = file_get_contents($filename);
}
else
{
file_put_contents($filename, $content);
}
?>
<?php
echo "<form method='post' action='edit.php'>";
echo "<textarea name='code' width='500' height='500'>$html</textarea>";
echo "<input type='submit' value='save'>";
echo "</form>";
?>
Code:
[B]Warning[/B]: file_get_contents() [[URL="http://eno.x10.mx/admin/edit.php/function.file-get-contents"]function.file-get-contents[/URL]]: Filename cannot be empty in [B]/****/********/************/*****/********/edit.php[/B] on line [B]10[/B]