PDA

View Full Version : if else conditionals


T_Richardson
08 Jul 2007, 21:09
I have a custom page and I want only members to view it and direct guests the login/register page/popup.

Something like:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

ragtek
08 Jul 2007, 21:32
you could make this in the php file:
exec_header_redirect("login.php");

T_Richardson
08 Jul 2007, 22:07
I put that code directly under <?php and got this error:


Fatal error: Call to undefined function: exec_header_redirect() in /home/alliedte/public_html/stats.php on line 2

Is there more to this code?

ragtek
08 Jul 2007, 22:11
in templates php isn't allowed

you could make it in the php file


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Danny.VBT
08 Jul 2007, 22:11
Use print_no_permission();

It will display a nice display message with login form as well. :)

ragtek
08 Jul 2007, 22:13
lol
ok thats easier:D

in your php file after including global.php make this:

if (!$vbulletin->userinfo['userid']) print_no_permission();

that should be enought

T_Richardson
08 Jul 2007, 22:22
got it - thank you very much for your help.

Now when guests view those pages I modified to show the No permissions login page, it still says that they are viewing that page and not the "No permissions" page in "Who's Online".

Danny.VBT
08 Jul 2007, 23:15
got it - thank you very much for your help.

Now when guests view those pages I modified to show the No permissions login page, it still says that they are viewing that page and not the "No permissions" page in "Who's Online".

There should be a little stop sign image indicating they are getting A No Permissions error on Who's Online.

T_Richardson
08 Jul 2007, 23:17
They are getting it for the default vb pages, but not the ones I created.

edgecutioner
04 Aug 2007, 13:36
what't the whole code?