Hello, I'm currently trying to build a very simple CMS as I'm still quite a newbie when it comes to PHP. Thanks to help before on this forum I have been able to use a simple login script which stores the password to a php file. However, I would like the data to be stored to a text file so that this can be edited in the CMS backend.
Here is the code so far...
<?php
// if POST
$myFile = "pass.txt";
$fh = fopen($myFile, "r");
$theData = fread($fh, 710);
fclose($fh);
if (isset($POST['Password']))
{
if($POST['Password'] == "echo $theData;")
{
echo "Well Done!";
} else {
echo "Nope not correct";
}
}
// display form:
else {
?>
<form action="<?php htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES); ?>" method="POST">
Enter your password: <input type="password" name="Password" />
<input type="submit" />
<?php } ?>
Quick breakdown of what Im trying to do - (a)Store a password to the text file pass.txt (b) Open the text file (c) Output its contents and use an if statement for comparing an entry written through the form...
Any help would be appreciated...Thanks!