2008-03-20, 11:08 PM
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
2008-03-23, 01:52 PM
Could you please give me a code for Logout link? Thank you.
2008-03-29, 12:39 AM
I keep geting
Warning: Cannot modify header information - headers already sent by (output started at /home/gmodfana/public_html/index1.php:6) in /home/gmodfana/public_html/forum/inc/functions.php on line 1216
Warning: Cannot modify header information - headers already sent by (output started at /home/gmodfana/public_html/index1.php:6) in /home/gmodfana/public_html/forum/inc/functions.php on line 1216
2008-04-04, 12:26 PM
You should include the files at the top before using echo or generally print functions.
2008-04-05, 03:16 AM
Gogy Wrote:Could you please give me a code for Logout link? Thank you.
something along the lines of this will work with the latest builds
<a href="YOURFOURMLOCATION/member.php?action=logout&logoutkey=<?php echo $mybb->user["logoutkey"]; ?>"><strong>Logout</strong></a>
Cheers FnT...
2008-04-15, 02:05 AM
okay, so here's my code:
this works fine. everything is okey-koke.
however, i want a logout link when logged in, and a register link when logged out. how would i go about doing this?
i would like it included in the code itself, rather than on another page.
i've tried using <a href=""></a> links, but they won't work.
thanks
<?php
if($mybb->user['uid'])
{
echo "Hey, ".$mybb->user['username']."<br>
Thanks for logging in.";
}
else
{
echo "<form action='Forums/member.php' method='post'>
Username: <input type='text' name='username' size='15' maxlength='30' /><br />
Password: <input type='password' name='password' size='15' />
<input type='hidden' name='action' value='do_login'>
<input type='hidden' name='url' value='index.php' />
<input type='submit' class='submit' name='submit' value='Login' /><input type='reset' class='reset' name='reset' value='Reset' /></form><br>";
}
?>
this works fine. everything is okey-koke.
however, i want a logout link when logged in, and a register link when logged out. how would i go about doing this?
i would like it included in the code itself, rather than on another page.
i've tried using <a href=""></a> links, but they won't work.
thanks
2008-04-22, 10:01 PM
Michael83 Wrote:You can use some code like the following:
Replace x, y and z with the Group-IDs of the usergroups that are allowed to view that page.if($mybb->user['usergroup'] = "x" || $mybb->user['usergroup'] = "y" || $mybb->user['usergroup'] = "z") { // User can access } else { // User has no permission to view the page }
okay, so where do i add that code first of all?
do i make a new php extension so it's like
<?php if($mybb->user['usergroup'] = "x" || $mybb->user['usergroup'] = "y" || $mybb->user['usergroup'] = "z") {
// User can access
} else {
// User has no permission to view the page
}; ?>
or do i add it in an existing code.
and also, how do i know what number my usergroups are?
cheers.
2008-04-23, 09:13 AM
I will try to explain a little as you will use this code in your existing page
look at the first part of this code if you go the bit that says
below this make a new line and enter the code you want people to see if they belong to the group or groups mentioned above.
then the next part of the code you need to know about
again create a new line and place in here a response to give or what ever to show if they do not belong to this group or groups.
as for finding the group id's or gid this one i can not see a simple way other than to open the correct table in phpmyadmin someone else might know another way but i can not seem to find a simple way??
FnT
if($mybb->user['usergroup'] = "x" || $mybb->user['usergroup'] = "y" || $mybb->user['usergroup'] = "z") {
// User can access
} else {
// User has no permission to view the page
}
look at the first part of this code if you go the bit that says
Quote:// User can access
below this make a new line and enter the code you want people to see if they belong to the group or groups mentioned above.
then the next part of the code you need to know about
Quote:// User has no permission to view the page
again create a new line and place in here a response to give or what ever to show if they do not belong to this group or groups.
as for finding the group id's or gid this one i can not see a simple way other than to open the correct table in phpmyadmin someone else might know another way but i can not seem to find a simple way??
FnT
2008-04-23, 04:00 PM
actually, i thought of an easier way.
how do i block guests/unregistered/banned from certain pages?
in other words, how do i just allow any registered member to the page?
how do i block guests/unregistered/banned from certain pages?
in other words, how do i just allow any registered member to the page?
2008-04-24, 03:45 AM
brootal Wrote:actually, i thought of an easier way.
how do i block guests/unregistered/banned from certain pages?
in other words, how do i just allow any registered member to the page?
Assuming you already have this from the first post:
<?php
chdir('forums'); // path to MyBB
require './global.php';
?>
You can add this:<?php
chdir('forums'); // path to MyBB
require './global.php';
if(!$mybb->user['uid'])
{
error_no_permission();
// Or replace with your own "not logged in" message
}
?>
<!-- rest of your page -->