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

Dizkus

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

Bottom
logging in the postnuke.com way (SOLVED)
  • Posted: 15.10.2002, 07:18
     
    Sugaar
    rank:
    Freshman Freshman
    registered:
     September 2002
    Status:
    offline
    last visit:
    21.04.05
    Posts:
    45
    Wonderful Olematon! Thanks!

    I think I get it now too. It looks like when you use echo or the ." there needs to be en echo before the ." line, so if we interrupt the flow of an echo ." (like we did by adding in the if/then statement), we have to remember to include another "echo" statement before we can procede to start using another ."

    Ok, but I still have a small teensy little error:

    Warning: open_basedir restriction in effect. File is in wrong directory in /usr/local/psa/home/vhosts/babychildrensmaternityresaleclothing.com/httpdocs/themes/PostNukePink/theme.php on line 119

    Warning: Failed opening 'themes/PostNukePink/notlogged.htm' for inclusion (include_path='.:') in /usr/local/psa/home/vhosts/babychildrensmaternityresaleclothing.com/httpdocs/themes/PostNukePink/theme.php on line 119

    Now, I assure you, notloggedin.htm and loggedin.htm are in the same themes/PostNukePink directory with the theme.php. I also tried putting them in httpdocs and in httpdocs/themes directory. Lastly, I tried not using a hard-coded theme type (PostNukePink) and tried using the $thename variable...still no go.

    Almost there, please don't give up on me yet! =)

    Thanks Again Guys!
  • Posted: 15.10.2002, 07:46
     
    Olematon
    rank:
    Freshman Freshman
    registered:
     September 2002
    Status:
    offline
    last visit:
    28.05.03
    Posts:
    13
    there's a slight syntax error:

    Code

    include 'themes/$thename/loggedin.htm';
    should be

    Code

    include ("themes/$thename/loggedin.htm");
  • Posted: 15.10.2002, 08:13
     
    Sugaar
    rank:
    Freshman Freshman
    registered:
     September 2002
    Status:
    offline
    last visit:
    21.04.05
    Posts:
    45
    /hugs Olematin.

    <does a="a" dance="dance"> I am so happy!

    Thanks Olematin!

    Just a little tweeking to get it pretty, then I'm set, but it's working! Yay!</does>
  • Posted: 16.10.2002, 08:47
     
    tyranid
    rank:
    Helper Helper
    registered:
     August 2002
    Status:
    offline
    last visit:
    31.05.06
    Posts:
    105
    Well alls well that ends well!
  • Posted: 17.10.2002, 12:30
     
    Sandbakk
    rank:
    Freshman Freshman
    registered:
     December 1969
    Status:
    offline
    last visit:
    10.02.03
    Posts:
    14
    How do I get the username after Welcome after logged in? :?:
  • Posted: 17.10.2002, 20:10
     
    tyranid
    rank:
    Helper Helper
    registered:
     August 2002
    Status:
    offline
    last visit:
    31.05.06
    Posts:
    105
    Use this code (sorry it's so messy...)

    Save it as loggedin.php (makesure .php). No you must change the include statement in your theme.php to call loggedin.php







    <font color="#000000">
    <form action="user.php" method="post">
    <font color="#000000">  Welcome -
    <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>





    Hope this helps

    Kindest regards
  • Posted: 18.10.2002, 04:19
     
    ox
    rank:
    Freshman Freshman
    registered:
     August 2002
    Status:
    offline
    last visit:
    18.10.02
    Posts:
    2
    This method is unnecessarily complicated. My theme.php file includes this code in the header table:

    Code

    if (pnUserLoggedIn()) {
        echo "<td colspan=\"6\"> \n"
        ."<b>Welcome</b> $username - <a href=\"user.php\">Your Account</a> | <a href=\"user.php?module=NS-User&op=logout\">Logout</a></td>\n";
    } else {
        echo "<td colspan=\"6\">\n"
        ."<form action=\"user.php\" method=\"post\">Username <input type=\"text\" name=\"uname\" size=\"10\" maxlength=\"14\"> Password <input type=\"password\" name=\"pass\" size=\"10\" maxlength=\"14\"><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\"></td>\n";
    }

    Works for me, and no need to worry about HTML files. :D The "colspan=6" is only necessary because this code is in the same table as a set of navigation buttons, so you might only need . You can see for yourself at http://www.ochsenhirt.com/html
  • Posted: 18.10.2002, 05:03
     
    tyranid
    rank:
    Helper Helper
    registered:
     August 2002
    Status:
    offline
    last visit:
    31.05.06
    Posts:
    105
    Thankyou for clarifying this.

    When I started this thread I asked the question of how to do this - no one answered so I did it myself. I am a beginner and I find any tips invaluable.

    Thankyou.
  • Posted: 24.10.2002, 05:29
     
    jjleprikon
    rank:
    Registered User Registered User
    registered:
     October 2002
    Status:
    offline
    last visit:
    24.10.02
    Posts:
    1
    I have something similar to the code above, but my site is not located at the at the root level of my server. When I log in using the code above I get the "logging on hang on tight" messsage and I am forwarded to the root directory of my server (which I expect with the hidden input tag named URL with a value of /). Is there a variable I should be using that says where my site is located or do I have to hard code that in too? I tried the .getenv ("HTTP_REFERER"). code from user.php, but it doesnt work.
  • Posted: 28.10.2002, 05:36
     
    CyberWolf
    rank:
    Freshman Freshman
    registered:
     April 2002
    Status:
    offline
    last visit:
    07.12.02
    Posts:
    5
    Im having the same problem, everything works great except it takes me to the root of my web site that is not my Post Nuke site :( HELP please.


    jjleprikon

    I have something similar to the code above, but my site is not located at the at the root level of my server. When I log in using the code above I get the "logging on hang on tight" messsage and I am forwarded to the root directory of my server (which I expect with the hidden input tag named URL with a value of /). Is there a variable I should be using that says where my site is located or do I have to hard code that in too? I tried the .getenv ("HTTP_REFERER"). code from user.php, but it doesnt work.
  • Posted: 28.10.2002, 05:45
     
    CyberWolf
    rank:
    Freshman Freshman
    registered:
     April 2002
    Status:
    offline
    last visit:
    07.12.02
    Posts:
    5
    I found bro....
    REM out this line....

    Code

    ."<input type=\"hidden\" name=\"url\" value=\"/\">"


    jjleprikon

    I have something similar to the code above, but my site is not located at the at the root level of my server. When I log in using the code above I get the "logging on hang on tight" messsage and I am forwarded to the root directory of my server (which I expect with the hidden input tag named URL with a value of /). Is there a variable I should be using that says where my site is located or do I have to hard code that in too? I tried the .getenv ("HTTP_REFERER"). code from user.php, but it doesnt work.
    [/code]
  • Posted: 30.11.2002, 14:43
     
    ColdRolledSteel
    rank:
    Professional Professional
    registered:
     December 1969
    Status:
    offline
    last visit:
    30.12.05
    Posts:
    1310
    The solutions posted above have a problem with the line:

    Code

    ."<input type=\"hidden\" name=\"url\" value=\"/\">"


    This will not work correctly in two ways. On sites that are not implementated at the root directory, the login will always put them in the wrong place. Secondly, for all sites, when users login, they will end up back at the home directory instead of returning to the page they're on.

    The correct PHP code should be:

    Code

    ."<input type=\"hidden\" name=\"url\" value=\"".getenv("REQUEST_URI")."\" />\n"


    I have just written a new theme, MTmodular, (get it at http://www.mtrad.com) that you might find as a good way to learn how themes work and how they can be customized.

    For example, the login form in the header is implemented as a function:

    Code

    function LoginForm() {
        global $bgcolor1, $bgcolor2;
        if (pnUserLoggedIn()) {
            $username = pnUserGetVar('uname');
        echo _WELCOME.$username."!";
        } else {
        echo "<!-- Start Login Form -->\n"
            ."<table width=100% cellpading=0 cellspacing=0><tr><td>\n"
        ."<form action=\"user.php\" method=\"post\">\n"
        ."&nbsp;&nbsp;User <input type=\"text\" name=\"uname\" size=10 maxlength=25>\n"
        ."&nbsp;Password <input type=\"password\" name=\"pass\" size=10 maxlength=\"20\">\n"
    //  ."<input type=\"checkbox\" value=\"1\" name=\"rememberme\" />&nbsp;Remember me\n"
        ."<input type=\"hidden\" name=\"module\" value=\"NS-User\" />\n"
        ."<input type=\"hidden\" name=\"op\" value=\"login\" />\n"
        ."<input type=\"hidden\" name=\"url\" value=\"".getenv("REQUEST_URI")."\" />\n"
        ."<input type=\"submit\" value=\"Login\">\n"
        ."</td><td align=right></form></td></tr></table>\n";
        }
    }


    The theme includes documentation about how to customize the theme to use (or not) the login form.
  • Posted: 10.12.2002, 06:09
     
    Sugaar
    rank:
    Freshman Freshman
    registered:
     September 2002
    Status:
    offline
    last visit:
    21.04.05
    Posts:
    45
    I tried the solutions from Ox and ColdRolledSteel, but when I attempt to login (as admin) it DOES take me to user.php, but it's a generic Personal Page and I am not actually logged in.

    You can try it out here to see what I mean:
    http://www.mommyguide.com

    Any ideas?
  • Posted: 10.12.2002, 11:49
     
    ColdRolledSteel
    rank:
    Professional Professional
    registered:
     December 1969
    Status:
    offline
    last visit:
    30.12.05
    Posts:
    1310

    Sugaar

    I tried the solutions from Ox and ColdRolledSteel, but when I attempt to login (as admin) it DOES take me to user.php, but it's a generic Personal Page and I am not actually logged in.

    You can try it out here to see what I mean:
    http://www.mommyguide.com

    Any ideas?


    You didn't close the form with a tag. If you go to http://www.mommyguid…reen&module=NS-User and then view the source from your browser, you'll see the difference between the bad form in the heading and the good form in the main part of the page.
  • Posted: 10.12.2002, 23:16
     
    Sugaar
    rank:
    Freshman Freshman
    registered:
     September 2002
    Status:
    offline
    last visit:
    21.04.05
    Posts:
    45
    In my hurriedness to cut and paste, I seemed to have forgotten a teensy little thing. lol. Thanks very much. icon_redface

    All fixed.

    Just curious. I am using a version of the "PostNuke" theme. The form fields are the same color as my table cell's background. Anyone know how I make them white?

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

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula