Example #1
0
    Webfinance is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Webfinance; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
// Common topper
require_once "inc/main.php";
global $title;
global $roles;
$User = new User();
if (!$User->isLogued()) {
    $_SESSION['came_from'] = $_SERVER['REQUEST_URI'];
    if ($_SESSION['debug'] == 1) {
        echo 'Not logged. Debug mode, please <a href="/login.php">log in</a>';
        include "bottom.php";
        die;
    }
    header("Location: /login.php");
    die;
}
$user = $User->getInfos();
if (!$User->isAuthorized($roles)) {
    header("Location: /welcome.php");
    exit;
}
if (isset($_SESSION['message']) and $_SESSION['message'] != "") {
Example #2
0
function must_login()
{
    if (isset($_SESSION['id_user']) and $_SESSION['id_user'] > 0) {
        $User = new User();
        if ($User->isLogued()) {
            return true;
            exit;
        }
    }
    $_SESSION['came_from'] = $_SERVER['REQUEST_URI'];
    if (WF_DEBUG) {
        echo 'Not logged. Debug mode, please <a href="/login.php">log in</a>';
        include "bottom.php";
        die;
    }
    header("Location: ../login.php");
    die;
}