Required to login help


Posted on 16th Feb 2014 07:03 pm by admin

I'm trying to set up my site so users have to be logged into the forum to access the site.I've been working with this bit of code
Code: [Select]<?php
writeLog();
if ($context['user']['is_logged'])
?>
<?php
else if ($context['user']['is_guest'])
{
redirectexit('action=login');
}
?>
But the problem is that it won't let me stay on the requested page. It'll still redirects even if you are logged in. I want it to check if you are logged in. Then stay on current page as normal, and if you'r not logged in. To redirect you to the login page of the forum.

Any help on this would be great.

No comments posted yet

Your Answer:

Login to answer
291 Like 12 Dislike
Previous forums Next forums
Other forums

Can I call a class inside a function?
I have a class written in another file that handles my image resizing.

Can I do this (php say

Why use OOP?
Can someone explain to me why I should use OOP instead of procedure based code.

Im building a

Procedure with variable number of columns
Hi, I have a procedure that looks like this:

PROCEDURE PROC(p_cursor OUT sys_refcurso

Select Lists into MYSQL
Hello All, I am new to PHP @ 1 week. So borrowing code anywhere I can. I am making progress, but h

Binding 2 UDP sockets on same port, connected to different destinations, 1 receives
Hello,
My application wants to send/recv data to 2 different UDP ports on a remote computer, us

SCO Unix
I know this might not be the place to ask, but, can anyone tell me if SCO Unix comes with PHP built

Edit MySQL Row Using PHP and HTML Form
Hello,

Here's what I'm trying to do. Build a page where a user enters a MySQL row number in.

Post PHP form to non-existing page
The company that I work for host their PHP code on IIS on a Windows server, no Apache, so no mod_rew

Removing Title From database problem
Hi again ! i am having an issue with updating database. When i update any price of a title it remove

How do I create a 2D game "camera" to follow player?
In J2ME programming I'm targeting MIDP 2.0 devices.

I'm using gamecanvas and I was thinking t

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash