Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Goto page: 1 - 2 - 3 [+1]

Bottom
logging in the postnuke.com way (SOLVED)
  • Posted: 02.10.2002, 22:18
     
    tyranid
    rank:
    Helper 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>&nbsp;&nbsp;<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\">"
           
            ."&nbsp;Username&nbsp;"
            ."<input type=\"text\" name=\"uname\" size=\"14\" maxlength=\"25\">&nbsp;&nbsp;&nbsp;Password&nbsp;"
            ."<input type=\"password\" name=\"pass\" size=\"14\" maxlength=\"20\">&nbsp;&nbsp;&nbsp;"
            ."<input type=\"checkbox\" value=\"1\" name=\"rememberme\"/>&nbsp;Remember me&nbsp;&nbsp;&nbsp;"
            ."<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\">&nbsp;"
            ."</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
  • Posted: 02.10.2002, 23:12
     
    bharvey42
    rank:
    Developer Developer
    registered:
     December 1969
    Status:
    offline
    last visit:
    01.08.07
    Posts:
    820
    You would have to code that into your theme.php file to add that to your header.
  • Posted: 03.10.2002, 00:58
     
    tyranid
    rank:
    Helper 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
  • Posted: 04.10.2002, 18:12
     
    novax3eme
    rank:
    Freshman 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.
  • Posted: 05.10.2002, 02:32
     
    tyranid
    rank:
    Helper 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">
    <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" />
    </form>





    **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">
    <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" />
    </form>





    I hope this helps

    Kindest regards
  • Posted: 10.10.2002, 19:55
     
    ResellerBase
    rank:
    Freshman Freshman
    registered:
     October 2002
    Status:
    offline
    last visit:
    23.10.02
    Posts:
    6
    Very, very nice. Adding it to my site now, thanks.
  • Posted: 13.10.2002, 10:43
     
    Sugaar
    rank:
    Freshman 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. =(
  • Posted: 14.10.2002, 09:40
     
    tyranid
    rank:
    Helper Helper
    registered:
     August 2002
    Status:
    offline
    last visit:
    31.05.06
    Posts:
    105
    Hmm, souds like you may have put the if else statement in the wrong place. Post your theme.php code here and I'll have a look at it...

    Kindest regards

    Tyranid
  • Posted: 14.10.2002, 10:12
     
    Sugaar
    rank:
    Freshman 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:

  • Posted: 14.10.2002, 10:15
     
    Sugaar
    rank:
    Freshman 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:

  • Posted: 14.10.2002, 17:35
     
    batpuppy
    registered:
     June 2002
    Status:
    offline
    last visit:
    10.11.04
    Posts:
    611
    Well for one thing you need to end line 116 with a ";" like it said.

    ."\n" ;
    if (pnUserLoggedIn()) {
    include 'themes/PostNukePink/loggedin.htm';
    } else {
    include 'themes/PostNukePink/notlogged.htm';
    }
  • Posted: 14.10.2002, 20:49
     
    Sugaar
    rank:
    Freshman 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>
  • Posted: 15.10.2002, 02:13
     
    dougholt
    rank:
    Freshman Freshman
    registered:
     September 2002
    Status:
    offline
    last visit:
    17.02.06
    Posts:
    8
    Why hardcode the theme name in the code? Use the variable.

    if (pnUserLoggedIn()) {
    include("themes/$thename/loggedin.htm");
    }
    else{
    include("themes/$thename/notlogged.htm");
    }
  • Posted: 15.10.2002, 03:57
     
    tyranid
    rank:
    Helper Helper
    registered:
     August 2002
    Status:
    offline
    last visit:
    31.05.06
    Posts:
    105
    I'm sorry dude - I'm only a beginner myself and i'm afraid I have no idea of what to do in this situation - It looks like we might have to wait for the experts...

    Sorry 'bout that
  • Posted: 15.10.2002, 06:56
     
    Olematon
    rank:
    Freshman 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 be

    Code

    echo "<form action=\"modules.php\" method=\"post\">\n"

    with no semicolon at the end

Goto page: 1 - 2 - 3 [+1]

Extensions Moderation