christophdb

christophdb supports this item

Supported

This author's response time can be up to 2 business days.

Popular questions for this item

One User asked me the following: I set the $CreateHTaccess = true but no htaccess was created in the subfolders.

Answer to: No htaccess after $CreateHTaccess = true

Ok this one should be a easy one. After setting $CreateHTaccess to true only one .htaccess will be created in the mainfolder.

Example of a folder structure: www.example.com/protect www.example.com/protect/login.php www.example.com/protect/index.php www.example.com/protect/fileprotect/... <- location of the fileprotect_class.php

The .htaccess will be created in the folder: www.example.com/protect/.htaccess and all access tries like “www.example.com/protect/adfadf” will be rerouted to www.example.com/protect/login.php

I hope this helped. Best regards, Christoph

I tried everything but the login is not working.

Some users wrote me with that problem and in all cases there were problems with the session settings of php. Therefore I created a test file to check the setting. Copy the following code to a php file, upload it and open it with your browser. It will show a) if the session path is writable and b) if the session values are saved correctly.

Here is the code:
<?php
// start session
session_start();

// initialize session variable temp in case that it is not page "next" 
if(isset($_GET['page']) AND $_GET['page'] == "next"){}
else{
    $_SESSION['temp'] = date('m/d/Y, H:i:s', time());
}

echo "<h1>Fileprotect Prerequesites Check</h1>";
if(!is_writable(session_save_path())){
    echo '<p>Session_path '. session_save_path() .' is not wirtable for PHP! (bad)</p>'; 
}
else{
    echo '<p>session_path '. session_save_path() .' is writable for PHP! (great)</p>';
    }

echo "<hr />";

echo "<h2>Check it by yourself</h2>";
if(isset($_GET['page']) AND $_GET['page'] == "next"){
    if(isset($_SESSION['temp'])){ echo "<p>The current date <strong>". $_SESSION['temp'] ."</strong> was stored correctly in the session variable.<br />
    <a href="test_fileprotect.php">go back</a></p>"; }
    else{ echo "<p>There is no value saved in the session variable temp. Please make the session_path writable.<br />
    <a href="test_fileprotect.php">go back</a></p>"; }
}
else{
    echo "<p>I stored the session variable 'temp' the current date: <strong>". $_SESSION['temp'] ."</strong>. 
    Even after reloading the page by clicking this <strong><u><a href="test_fileprotect.php?page=next">link</a></u></strong> the date should be stored in this session variable.    Please click on this link and test if the date is saved and shown on the next page. If not sessions are not working correctly.</p>";
}

echo "<hr />";
echo "<h2>Here is your phpinfo();</h2>";
phpinfo();
?>

Contact the author

This author provides limited support for this item through this item's comments.

Item support includes:

  • Availability of the author to answer questions
  • Answering technical questions about item’s features
  • Assistance with reported bugs and issues
  • Help with included 3rd party assets

However, item support does not include:

  • Customization services
  • Installation services

View the item support policy

by
by
by
by
by
by