I have an error driving me mad:
Parse error: parse error in flatsecurity.class.php on line 61
Here is line 61:
$handle = fopen ($this->pathFile, "r");
of the following class:
<?
class FlatSecurity
{
var $secFolderName;
var $secFileName;
var $pathFolder;
var $pathFile;
var $suppressErrors;
var $users = array();
var $errors = array();
/*----------------------------------------------------------------------
PUBLIC METHODS
----------------------------------------------------------------------*/
function FlatSecurity()
{
$this->suppressErrors = false;
// this server automatically blocks '.ht' files from being displayed
// via http.
$this->secFolderName = ".htflatsecurity";
$this->secFileName = ".htflatpasswd";
$this->pathFolder = $_SERVER['DOCUMENT_ROOT']."/".$this->secFolderName;
$this->pathFile = $this->pathFolder."/".$this->secFileName;
$this->_makeFiles();
$this->_buildUserArray();
}
//--------------------------- end constructor -------------------------
function mkUser($username, $password)
{
if (@array_key_exists($username, $this->users)) {
$this->_buildError("Cannot add user. Username ($username) already exists.");
return;
}
//$password = crypt($username, $password);
$this->_writeSecFile("$username:$password);
$this->users[$username] = $password;
}
/*----------------------------------------------------------------------
PRIVATE METHODS
----------------------------------------------------------------------*/
function _buildUserArray()
{
//clearstatcache();
if (!file_exists($this->pathFile)) {
$this->_buildError('yep!');
return;
}
if (!is_readable($this->pathFile)) {
$this->_buildError('you gota be kidding!!!');
return;
}
$handle = fopen ($this->pathFile, "r");
while ($userinfo = fscanf ($handle, "%s:%s\n")) {
list ($username, $password) = $userinfo;
$this->users[$username] = $password;
}
fclose($handle);
}
function _readSecFile()
{
$contents = "";
//clearstatcache();
if (@file_exists($this->pathFile)) {
if (!$handle = fopen($this->pathFile, "r")) {
$this->_buildError("Cannot open file (".$this->pathFile.") for reading.");
return;
}
$contents = fread($handle, filesize($this->pathFile));
fclose($handle);
}else{
$this->_buildError("The file (".$this->pathFile.") was not found!");
}
return $contents;
}
function _writeSecFile($content, $mode = "a") //default mode is a (append)
{
//clearstatcache();
if (is_writable($this->pathFile)) {
if (!$handle = fopen($this->pathFile, $mode)) {
$this->_buildError("Cannot open file (".$this->pathFile.")!");
return;
}
if (!fwrite($handle, $content)) {
$this->_buildError("Cannot write to file (".$this->pathFile.")!");
return;
}
fclose($handle);
} else {
$this->_buildError("The file (".$this->pathFile.") is not writable!");
}
}
function _makeFiles()
{
//clearstatcache();
if (!@file_exists($this->pathFolder)) {
if (!@mkdir ($this->pathFolder, 0755)) {
$this->_buildError('Could not make folder!');
} else {
if (!@file_exists($this->pathFile)) {
if (!@touch ($this->pathFile)) {
$this->_buildError('Could not make file!');
}
}
}
}
}
function _buildError($my_error)
{
if($this->suppressErrors) {
$this->errors[] = $my_error;
} else {
echo $my_error;
}
}
}
?>
If anyone can see a parse error in line 61 (plus or minus)...PLEASE, give me a heads-up.
THANK YOU!