- Moderated by:
- Support
-
- rank:
-
Helper
- registered:
- August 2002
- Status:
- offline
- last visit:
- 31.05.06
- Posts:
- 105
Without going any further here is the solution:
Code
<?php
// Decide bar menu based on user level by Adam Docherty
if (pnUserLoggedIn()) {
//Check for admin.
if (pnSecAuthAction(1, '.*', '.*', ACCESS_ADMIN))
echo "<table width=100%>"
."<tr><td>"
."<font color=#000000>"
."<form action=\"user.php\" method=\"post\">"
."<font color=#000000><b>Welcome "
.pnUserGetVar("uname")
."</font></b> - <a href=\"user.php\">"
."Your Account</font></a> | "
."<a href=\"modules.php?op=modload&name=Members_List&file=index\">Members list</a> | "
."<a href=\"modules.php?op=modload&name=Stats&file=index\">Site Statistics</a> | "
."<a href=\"admin.php\">Administration</a> | "
."<a href=\"user.php?module=NS-User&op=logout\">Log out"
."</font></a></td></form>"
//Search box
."<td align=\"right\"><font color=#000000>"
."<form action=\"modules.php\" method=\"post\">"
."<table cellpadding=0 cellspacing=0 align=\"right\">"
."<tr><td class=\"bar-top-form\" align=\"right\" valign=\"bottom\">"
."<font color=#000000>Search</font>"
."</td><td class=\"bar-top-form\" align=\"right\" valign=\"middle\" >"
."<input type=\"hidden\" name=\"name\" value=\"Search\">"
."<input type=\"hidden\" name=\"file\" value=\"index\">"
."<input type=\"hidden\" name=\"op\" value=\"modload\">"
."<input type=\"hidden\" name=\"action\" value=\"search\">"
."<input type=\"hidden\" name=\"overview\" value=\"1\">"
."<input type=\"hidden\" name=\"active_stories\" value=\"1\">"
."<input type=\"hidden\" name=\"bool\" value=\"AND\">"
."<input type=\"hidden\" name=\"stories_cat\" value=\"\">"
."<input type=\"hidden\" name=\"stories_topics\" value=\"\">"
."<input name=\"q\" type=\"text\" size=\"15\">"
."</td></tr></table></font></form></td></tr></table></td></tr>";
else
// Normal user link bar
echo "<table width=100%>"
."<tr><td>"
."<font color=#000000>"
."<form action=\"user.php\" method=\"post\">"
."<font color=#000000> <b>Welcome "
.pnUserGetVar("uname")
."</font></b> -"
."<a href=\"user.php\">Your Account</a> | "
."<a href=\"modules.php?op=modload&name=Members_List&file=index\">Members list</font></a> | "
."<a href=\"modules.php?op=modload&name=Stats&file=index\">Site Statistics</a> | "
."<a href=\"user.php?module=NS-User&op=logout\">Log out</font></a>"
."</td></form>"
//search box
."<td align=\"right\"><font color=#000000>"
."<form action=\"modules.php\" method=\"post\">"
."<table cellpadding=0 cellspacing=0 align=\"right\">"
."<tr><td class=\"bar-top-form\" align=\"right\" valign=\"bottom\">"
."<font color=#000000>Search</font>"
."</td><td class=\"bar-top-form\" align=\"right\" valign=\"middle\" >"
."<input type=\"hidden\" name=\"name\" value=\"Search\">"
."<input type=\"hidden\" name=\"file\" value=\"index\">"
."<input type=\"hidden\" name=\"op\" value=\"modload\">"
."<input type=\"hidden\" name=\"action\" value=\"search\">"
."<input type=\"hidden\" name=\"overview\" value=\"1\">"
."<input type=\"hidden\" name=\"active_stories\" value=\"1\">"
."<input type=\"hidden\" name=\"bool\" value=\"AND\">"
."<input type=\"hidden\" name=\"stories_cat\" value=\"\">"
."<input type=\"hidden\" name=\"stories_topics\" value=\"\">"
."<input name=\"q\" type=\"text\" size=\"15\">"
."</td></tr></table></font></form></td></tr></table></td></tr>";
}
else
{
//Anonymous user link bar
echo "<table width=100%>"
."<TR><TD>"
."Welcome Stranger - Get registered "
."<a href=\"user.php?op=check_age&module=NS-NewUser\">here</a> "
."it's FREE!"
."</TD><TD><P align=center>"
."<a href=\"modules.php?op=modload&name=Stats&file=index\">Site Statistics</a>"
."</TD><TD><P align=right>"
."Click <a href=\"user.php?op=lostpassscreen&module=NS-LostPassword\">here</a> "
."if you have forgotten your password"
."</TD></TR></TABLE>";
//This is the 1 pixel Table border wrapper
echo "<table width=\"100%\" height=\"0\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#484973\">"
."<tr>"
."<img src=\"spacer.gif\" width=\"1\" height=\"1\"></td>"
."</tr>"
."<tr>"
."<td width=\"1\"><img src=\"spacer.gif\" width=\"1\" height=\"1\"></td>"
."<td width=\"100%\"><table width=\"100%\" height=\"0\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" bgcolor=\"#AAABC9\">"
."<tr>"
."<td height=\"0\" valign=\"middle\">"; //information to be inside table from here on.
//username, password, rememberme input boxes
echo "<form action=\"user.php\" method=\"post\">"
." Username "
."<input type=\"text\" name=\"uname\" size=\"14\" maxlength=\"25\"> Password "
."<input type=\"password\" name=\"pass\" size=\"14\" maxlength=\"20\"> "
."<input type=\"checkbox\" value=\"1\" name=\"rememberme\"/> Remember me "
."<input type=\"hidden\" name=\"module\" value=\"NS-User\"/>"
."<input type=\"hidden\" name=\"op\" value=\"login\"/>"
."<input type=\"hidden\" name=\"url\" value=\"/\">"
."<input type=\"submit\" value=\"LoGin\">"
//search form
."<td align=\"right\"></form>"
."<form action=\"modules.php\" method=\"post\">"
."Search"
."<input type=\"hidden\" name=\"name\" value=\"Search\">"
."<input type=\"hidden\" name=\"file\" value=\"index\">"
."<input type=\"hidden\" name=\"op\" value=\"modload\">"
."<input type=\"hidden\" name=\"action\" value=\"search\">"
."<input type=\"hidden\" name=\"overview\" value=\"1\">"
."<input type=\"hidden\" name=\"active_stories\" value=\"1\">"
."<input type=\"hidden\" name=\"bool\" value=\"AND\">"
."<input type=\"hidden\" name=\"stories_cat\" value=\"\">"
."<input type=\"hidden\" name=\"stories_topics\" value=\"\">"
."<input type=\"hidden\" name=\"active_sections\" value=\"\">"
."<input name=\"q\" type=\"text\" size=\"15\" maxlength=\"25\"> "
."</td>"
//This code is to close the 1 pixel table border
."</table>"
."</td>"
."<td width=\"100%\"></form><img src=\"spacer.gif\" width=\"1\" height=\"1\"></td>"
."</tr><tr>"
."<img src=\"spacer.gif\" width=\"1\" height=\"1\"></td>"
."</tr></table>";
}
Save this as menubar.php and include it somewhere under you header function.
Kindest Regards
Tyranid -
- rank:
-
Helper
- registered:
- August 2002
- Status:
- offline
- last visit:
- 31.05.06
- Posts:
- 105
Yes I thought that would be the case, but unfortunatley i have not the time, or more importantly, the ability to do this.
Would there be any chance of getting the code snippet from you guys?
Kindest regards
Tyranid -
- rank:
-
Freshman
- registered:
- October 2002
- Status:
- offline
- last visit:
- 15.10.02
- Posts:
- 9
Yeah I would also like to be able to have a piece of code to incorporate the PostNuke style of logging in.
However, I think it could be made better if there is a "Register Here" link just beside it.
Please, somebody, give us the code!!!
Haha...a little exagerated, but I really do mean it. -
- rank:
-
Helper
- registered:
- August 2002
- Status:
- offline
- last visit:
- 31.05.06
- Posts:
- 105
Ok I've done it. This may not be the best way to do it, but it works.
I've heard a lot of people asking about the postnuke.com theme and where they can get it - if I am not wrong this theme is not to be released!
The main thing about it I liked was the login bar, it just saves soooo much space, so I made it happen for my site and now I'm giving it to you.
Put this piece of code where you want the login bar to appear and subsitute "theme-name" for the name of the theme you are editing.
/*this is the if else statement
if (pnUserLoggedIn()) {
include 'themes/theme-name/loggedin.htm';
} else {
include 'themes/theme-name/notlogged.htm';
}
Okay now we will create 2 htm files - "Loggedin.htm" and "notlogged.htm".
Place these 2 files in the same folder as "theme.php"
Here's the code for "loggedin.htm":
<font color="#000000"><form action="user.php" method="post"><font color="#000000"> Welcome Member - <font color="#000000">Your Account | <font color="#000000">Members list | <font color="#000000">Log out</form> <font color="#000000"><form action="modules.php" method="post">
</form><font color="#000000"> Search <input type="hidden" name="name" value="Search" /><input type="hidden" name="file" value="index" /><input type="hidden" name="op" value="modload" /><input type="hidden" name="action" value="search" /><input type="hidden" name="overview" value="1" /><input type="hidden" name="active_stories" value="1" /><input type="hidden" name="bool" value="AND" /><input type="hidden" name="stories_cat" value="" /><input type="hidden" name="stories_topics" value="" /><input name="q" type="text" size="15" />
**here is the code for "notlogged.htm"**
<font color="#000000">
<form action="user.php" method="post"><font color="#000000">Username <input type="text" name="uname" size="14" maxlength="25" /> Password <input type="password" name="pass" size="14" maxlength="20" /><input type="checkbox" value="1" name="rememberme" /> Remember me<input type="hidden" name="module" value="NS-User" /><input type="hidden" name="op" value="login" /><input type="hidden" name="url" value="/" /><input type="submit" value="Login" /></form><font color="#000000"><form action="modules.php" method="post">
</form><font color="#000000">Search <input type="hidden" name="name" value="Search" /><input type="hidden" name="file" value="index" /><input type="hidden" name="op" value="modload" /><input type="hidden" name="action" value="search" /><input type="hidden" name="overview" value="1" /><input type="hidden" name="active_stories" value="1" /><input type="hidden" name="bool" value="AND" /><input type="hidden" name="stories_cat" value="" /><input type="hidden" name="stories_topics" value="" /><input type="hidden" name="active_sections" value="" /><input name="q" type="text" size="15" />
I hope this helps
Kindest regards -
- rank:
-
Freshman
- registered:
- September 2002
- Status:
- offline
- last visit:
- 21.04.05
- Posts:
- 45
I tried the code and get this error:
Parse error: parse error, expecting `','' or `';'' in /usr/local/psa/home/vhosts/babychildrensmaternityresaleclothing.com/httpdocs/themes/PostNukePink/theme.php on line 116
Fatal error: call to undefined function: themeheader() in /usr/local/psa/home/vhosts/babychildrensmaternityresaleclothing.com/httpdocs/header.php on line 177
Any ideas?
I was so bummed I couldn't get it to work. =( -
- rank:
-
Freshman
- registered:
- September 2002
- Status:
- offline
- last visit:
- 21.04.05
- Posts:
- 45
Thanks Tyr!
I don't know if I pasted it in the wrong place, I opened my theme.php in Dreamweaver then took out all the escape \'s and \n"'s so that I could figure out where I wanted the login to go. Once I found out where *thought* I needed to paste the code to get the login in the header of my theme, I reopened the original theme.php and pasted in the if/then statement.
Anyway, let me know what you think, this is kinda long:
-
- rank:
-
Freshman
- registered:
- September 2002
- Status:
- offline
- last visit:
- 21.04.05
- Posts:
- 45
Thanks Tyr!
I don't know if I pasted it in the wrong place, I opened my theme.php in Dreamweaver then took out all the escape \'s and \n"'s so that I could figure out where I wanted the login to go. Once I found out where *thought* I needed to paste the code to get the login in the header of my theme, I reopened the original theme.php and pasted in the if/then statement.
Anyway, let me know what you think, this is kinda long:
-
- rank:
-
Freshman
- registered:
- September 2002
- Status:
- offline
- last visit:
- 21.04.05
- Posts:
- 45
I am not sure of the rules for PHP with the \n"
The theme.php works fine without pasting in the if/then statement when all \n" do not end in ;
However, I tried to add the ; to make line 116 into:
."\n" ;
And it fixes the one error, but gives me a whole new error:
Parse error: parse error in /usr/local/psa/home/vhosts/babychildrensmaternityresaleclothing.com/httpdocs/themes/PostNukePink/theme.php on line 121
Fatal error: call to undefined function: themeheader() in /usr/local/psa/home/vhosts/babychildrensmaternityresaleclothing.com/httpdocs/header.php on line 177
Line 121 in theme.php is:
."<form action="\"modules.php\"" method="\"post\"">\n"
So, I think I may need to add a semicolon there as well now. And I do...but I get the same exact error message.
And for good measure, I check header.php to see what line 177 is:
themeheader();
No luck. It doesn't magically reveal anything to me. =)
Anyone see something I don't? And thank you very much everyone for the help. It is much appreciated!</form> -
- rank:
-
Freshman
- registered:
- September 2002
- Status:
- offline
- last visit:
- 28.05.03
- Posts:
- 13
Sugaar
Line 121 in theme.php is:
."<form action="\"modules.php\"" method="\"post\"">\n"
</form>
should beCode
echo "<form action=\"modules.php\" method=\"post\">\n"
with no semicolon at the end
