Home | Support Forums | Your Account | Gallery [2] | Downloads | News | Site Map ]
Nuked Gallery
  Create a FREE account or Login   As a guest, you don't have access to our FULL navigation system.
 Forum FAQForum FAQ   StatisticsStatistics   SearchSearch   UsergroupsUsergroups   FavoritesFavorites  

How to get login embedded in header

 
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Issues » Other PHPNuke Issues View previous topicPrinter friendly versionView next topic
Author Message
inSaNE_iRIsH

Wizard
Wizard


Joined: Jun 19, 2003
Posts: 101

PostPosted: Sat Feb 14, 2004 8:39 pm    Post subject: How to get login embedded in header Reply with quote

Does anyone here know how to get the login embedded in the header? I am trying to modify the theme of my webpage, but dont know much about html or php. I am using a slightly customized version of the Brick theme that i think comes standard with phpnuke (cant remember if it came with it or if i downloaded it somewhere, its been quite a while)...any help would be appreciated.

Thanks
Back to top
Offline View user's profile Send private message
AdBot
   Post subject: How to get login embedded in header  

Back to top
slackbladder

Moderator
Moderator


Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK

PostPosted: Sun Feb 15, 2004 5:25 am    Post subject: Re: How to get login embedded in header Reply with quote

Ok try this:

Create an empty file and file it with this:

Code: ›
<?php
global $cookie, $sitekey;
cookiedecode($user);
$username = $cookie[1];
    if ($username == "") {
        $username = "Anonymous";
    }
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, 6);

if ($username == "Anonymous") {
   echo "<form action=\"modules.php?name=Your_Account\" method=\"post\">\n"
."<font class=\"content\">"._NICKNAME."\n"
."<input type=\"text\" name=\"username\" size=\"10\" maxlength=\"25\">\n"
.""._PASSWORD."\n"
."<input type=\"password\" name=\"user_password\" size=\"10\" maxlength=\"20\">\n"
."<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">\n"
."<input type=\"hidden\" name=\"gfx_check\" value=\"$code\">\n"
."<input type=\"hidden\" name=\"op\" value=\"login\">\n"
."<input type=\"submit\" value=\""._LOGIN."\"></font></center></form>\n";

} else {
   echo "&nbsp;&nbsp;Welcome $username!";
    }
?>


Save as 'headlogin.php' and upload to your themes folder (/themes/yourtheme)

Open your 'theme.php' (/themes/yourtheme/theme.php)

Find:

Code: ›
$public_msg = public_message();


directly above it - put:

Code: ›
include('themes/yourtheme/headlogin.php');


save and upload
_________________
"The only difference between me and a madman is that I'm not mad."
Back to top
Offline View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
inSaNE_iRIsH

Wizard
Wizard


Joined: Jun 19, 2003
Posts: 101

PostPosted: Sun Feb 15, 2004 1:29 pm    Post subject: Re: How to get login embedded in header Reply with quote

i dont have a line saying $public_msg = public_message(); in my theme.php, this is what my theme.php looks like currently

Code: › <?php



/************************************************************/

/* Theme Name: BricK                                        */

/* Theme Design: www.disipal.vze.com (Disipal)              */

/* Powered by www.mid.gr                                    */

/*                                                          */

/************************************************************/



/************************************************************/

/* Theme Colors Definition                                  */

/*                                                          */

/* Define colors for your web site. $bgcolor2 is generaly   */

/* used for the tables border as you can see on OpenTable() */

/* function, $bgcolor1 is for the table background and the  */

/* other two bgcolor variables follows the same criteria.   */

/* $texcolor1 and 2 are for tables internal texts           */

/************************************************************/



$bgcolor1 = "242C2F";

$bgcolor2 = "242C2F";

$bgcolor3 = "242C2F";

$bgcolor4 = "242C2F";

$textcolor1 = "#c0c0c0";

$textcolor2 = "#c0c0c0";



include("themes/BricK/tables.php");



/************************************************************/

/* Function themeheader()                                   */

/*                                                          */

/* Control the header for your site. You need to define the */

/* BODY tag and in some part of the code call the blocks    */

/* function for left side with: blocks(left);               */

/************************************************************/



function themeheader() {

    global $user, $banners, $sitename, $slogan, $cookie, $prefix, $dbi;

    cookiedecode($user);

    $username = $cookie[1];

    if ($username == "") {

        $username = "Anonymous";

    }

    echo "<body bgcolor=\"598598\" text=\"#c0c0c0\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">";

    if ($banners == 1) {

   include("banners.php");}

   

    $topics_list = "<select name=\"new_topic\" onChange='submit()'>\n";

    $topics_list .= "<option value=\"\">All Topics</option>\n";

    $toplist = sql_query("select topicid, topictext from ".$prefix."_topics order by topictext", $dbi);

    while(list($topicid, $topics) = sql_fetch_row($toplist, $dbi)) {

    if ($topicid==$topic) { $sel = "selected "; }

   $topics_list .= "<option $sel value=\"$topicid\">$topics</option>\n";

   $sel = "";

    }

    if ($username == "Anonymous") {

   $theuser = "&nbsp;&nbsp;<a href=\"modules.php?name=Your_Account\">Login";

    } else {

   $theuser = "&nbsp;&nbsp;Welcome $username!";

    }

    if ($username == "Anonymous") {
        $theuser1 = "&nbsp;&nbsp;<a href=\"modules.php?name=Your_Account&op=new_user\">Create an account";
    } else {
        $theuser1 = "&nbsp;&nbsp;<a href=\"modules.php?name=Your_Account&op=logout\">Logout/Exit";
    }
    $tmpl_file = "themes/BricK/header.html";

    $thefile = implode("", file($tmpl_file));

    $thefile = addslashes($thefile);

    $thefile = "\$r_file=\"".$thefile."\";";

    eval($thefile);

    print $r_file;

    blocks(left);

    $tmpl_file = "themes/BricK/left_center.html";

    $thefile = implode("", file($tmpl_file));

    $thefile = addslashes($thefile);

    $thefile = "\$r_file=\"".$thefile."\";";

    eval($thefile);

    print $r_file;

}



/************************************************************/

/* Function themefooter()                                   */

/*                                                          */

/* Control the footer for your site. You don't need to      */

/* close BODY and HTML tags at the end. In some part call   */

/* the function for right blocks with: blocks(right);       */

/* Also, $index variable need to be global and is used to   */

/* determine if the page your're viewing is the Homepage or */

/* and internal one.                                        */

/************************************************************/



function themefooter() {

    global $index, $foot1, $foot2, $foot3, $foot4;

    if ($index == 1) {

   $tmpl_file = "themes/BricK/center_right.html";

   $thefile = implode("", file($tmpl_file));

   $thefile = addslashes($thefile);

   $thefile = "\$r_file=\"".$thefile."\";";

   eval($thefile);

   print $r_file;

   blocks(right);

    }   

    $footer_message = "$foot1<br>$foot2<br>$foot3<br>$foot4";

    $tmpl_file = "themes/BricK/footer.html";

    $thefile = implode("", file($tmpl_file));

    $thefile = addslashes($thefile);

    $thefile = "\$r_file=\"".$thefile."\";";

    eval($thefile);

    print $r_file;

}



/************************************************************/

/* Function themeindex()                                    */

/*                                                          */

/* This function format the stories on the Homepage         */

/************************************************************/



function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {

    global $anonymous, $tipath;

    if ($notes != "") {

   $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";

    } else {

   $notes = "";

    }

    if ("$aid" == "$informant") {

   $content = "$thetext$notes\n";

    } else {

   if($informant != "") {

       $content = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;uname=$informant\">$informant</a> ";

   } else {

       $content = "$anonymous ";

   }

   $content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";

    }

    $posted = ""._POSTEDBY." ";

    $posted .= get_author($aid);

    $posted .= " "._ON." $time $timezone ($counter "._READS.")";

    $tmpl_file = "themes/BricK/story_home.html";

    $thefile = implode("", file($tmpl_file));

    $thefile = addslashes($thefile);

    $thefile = "\$r_file=\"".$thefile."\";";

    eval($thefile);

    print $r_file;

}



/************************************************************/

/* Function themearticle()                                  */

/*                                                          */

/* This function format the stories on the story page, when */

/* you click on that "Read More..." link in the home        */

/************************************************************/



function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext) {

    global $admin, $sid, $tipath;

    $posted = ""._POSTEDON." $datetime "._BY." ";

    $posted .= get_author($aid);

    if ($notes != "") {

   $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";

    } else {

   $notes = "";

    }

    if ("$aid" == "$informant") {

   $content = "$thetext$notes\n";

    } else {

   if($informant != "") {

       $content = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;uname=$informant\">$informant</a> ";

   } else {

       $content = "$anonymous ";

   }

   $content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";

    }

    $tmpl_file = "themes/BricK/story_page.html";

    $thefile = implode("", file($tmpl_file));

    $thefile = addslashes($thefile);

    $thefile = "\$r_file=\"".$thefile."\";";

    eval($thefile);

    print $r_file;

}



/************************************************************/

/* Function themesidebox()                                  */

/*                                                          */

/* Control look of your blocks. Just simple.                */

/************************************************************/



function themesidebox($title, $content) {

    $tmpl_file = "themes/BricK/blocks.html";

    $thefile = implode("", file($tmpl_file));

    $thefile = addslashes($thefile);

    $thefile = "\$r_file=\"".$thefile."\";";

    eval($thefile);

    print $r_file;

}



?>


i modified it a little bit from stock, but didnt delete anything, just customized this section

Code: ›     if ($username == "Anonymous") {

   $theuser = "&nbsp;&nbsp;<a href=\"modules.php?name=Your_Account\">Login";

    } else {

   $theuser = "&nbsp;&nbsp;Welcome $username!";

    }

    if ($username == "Anonymous") {
        $theuser1 = "&nbsp;&nbsp;<a href=\"modules.php?name=Your_Account&op=new_user\">Create an account";
    } else {
        $theuser1 = "&nbsp;&nbsp;<a href=\"modules.php?name=Your_Account&op=logout\">Logout/Exit";
    }
Back to top
Offline View user's profile Send private message
slackbladder

Moderator
Moderator


Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK

PostPosted: Sun Feb 15, 2004 2:42 pm    Post subject: Re: How to get login embedded in header Reply with quote

Code: ›
if ($username == "Anonymous") {

   $theuser = "&nbsp;&nbsp;<a href=\"modules.php?name=Your_Account\">Login";

    } else {

   $theuser = "&nbsp;&nbsp;Welcome $username!";

    }

    if ($username == "Anonymous") {
        $theuser1 = "&nbsp;&nbsp;<a href=\"modules.php?name=Your_Account&op=new_user\">Create an account";
    } else {
        $theuser1 = "&nbsp;&nbsp;<a href=\"modules.php?name=Your_Account&op=logout\">Logout/Exit";
    }


Try replacing that bit with:

include('themes/yourtheme/headlogin.php');

You will then need to edit the NEW file (headlogin.php) with the NEW code you altered
_________________
"The only difference between me and a madman is that I'm not mad."
Back to top
Offline View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
inSaNE_iRIsH

Wizard
Wizard


Joined: Jun 19, 2003
Posts: 101

PostPosted: Sun Feb 15, 2004 3:22 pm    Post subject: Re: How to get login embedded in header Reply with quote

hmm, that gets me closer, that ends up placing the login stuff just above the header, i will mess with it some to see if i can get it actually in the header unless you have any more suggestions?

if your not sure what i mean you can look at my page at

www.theapplingclan.com [theapplingclan.com] see how that put the Nick & Password box above the header? any idea how I can control the locatoin? I would like to get it in the spot where I currently have the "Login" link right above the "Create an account" link, the problem i see is that location is called in the header.html file, so i have to use html code to somehow locate the php code where i want it

thanks for your help
Back to top
Offline View user's profile Send private message
inSaNE_iRIsH

Wizard
Wizard


Joined: Jun 19, 2003
Posts: 101

PostPosted: Tue Feb 17, 2004 1:54 pm    Post subject: Re: How to get login embedded in header Reply with quote

ok, i got it to work, thanks for your help. just in case someone else comes looking here is how I got it to work.

headlogin.php code looks like this now
Code: › <?php
global $cookie, $sitekey;
cookiedecode($user);
$username = $cookie[1];
if ($username == "") {
$username = "Anonymous";
}
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, 6);

if ($username == "Anonymous") {
$log = "<form action=\"modules.php?name=Your_Account\" method=\"post\">"
   ."<left><font class=\"content\">"._NICKNAME."<br>"
   ."<input type=\"text\" name=\"username\" size=\"10\" maxlength=\"25\"><br>"
   .""._PASSWORD."<br>"
   ."<input type=\"password\" name=\"user_password\" size=\"10\" maxlength=\"20\"><br>"
   ."<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">"
   ."<input type=\"hidden\" name=\"gfx_check\" value=\"$code\">"
   ."<input type=\"hidden\" name=\"op\" value=\"login\">"
   ."<input type=\"submit\" value=\""._LOGIN."\"></font></center></form>"
   ."<a href=\"modules.php?name=Your_Account&op=new_user\">Create an account";

} else {
$log = "Welcome $username!<br>"
   ."<a href=\"modules.php?name=Your_Account\">Your Account<br>"
   ."<a href=\"modules.php?name=Your_Account&op=logout\">Logout/Exit";
}
?>


then in the header.html file find
Code: › <td nowrap><font class="content">$theuser</font></td>


and change $theuser to $log

oh and you do still need to put somewhere in your theme.php the following code
Code: › include('themes/yourtheme/headlogin.php');


you can see what it looks like now at my site www.theapplingclan.com [theapplingclan.com] the only thing i dont like is the big space between where the "Login" button and the "Create new account" link, but i cant seem to find a way to find a way to get rid of that, so i will have to live with it
Back to top
Offline View user's profile Send private message
slackbladder

Moderator
Moderator


Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK

PostPosted: Tue Feb 17, 2004 2:15 pm    Post subject: Re: How to get login embedded in header Reply with quote

Can't test it at the moment but try:

Code: ›
if ($username == "Anonymous") {
$log = "<form action=\"modules.php?name=Your_Account\" method=\"post\">"
   ."<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">"
   ."<input type=\"hidden\" name=\"gfx_check\" value=\"$code\">"
   ."<input type=\"hidden\" name=\"op\" value=\"login\">" 
   ."<left><font class=\"content\">"._NICKNAME."<br>"
   ."<input type=\"text\" name=\"username\" size=\"10\" maxlength=\"25\"><br>"
   .""._PASSWORD."<br>"
   ."<input type=\"password\" name=\"user_password\" size=\"10\" maxlength=\"20\"><br>"
   ."<input type=\"submit\" value=\""._LOGIN."\"></font>"
   ."<a href=\"modules.php?name=Your_Account&op=new_user\">Create an account</form>";

} else {
$log = "Welcome $username!<br>"
   ."<a href=\"modules.php?name=Your_Account\">Your Account<br>"
   ."<a href=\"modules.php?name=Your_Account&op=logout\">Logout/Exit";
}

_________________
"The only difference between me and a madman is that I'm not mad."
Back to top
Offline View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
inSaNE_iRIsH

Wizard
Wizard


Joined: Jun 19, 2003
Posts: 101

PostPosted: Tue Feb 17, 2004 3:25 pm    Post subject: Re: How to get login embedded in header Reply with quote

well, that actually caused the "Login" button and the "Create new account" link to be on the same line, so I added a <br> to the end of this line
Code: › ."<input type=\"submit\" value=\""._LOGIN."\"></font>"

that fixed that and it does make the "Create new account" link be close below the "Login" button,

but now there is a large gap below the "Create new account" link... dont know why...it is only there when you are not logged in, when you are logged in there is a very small space below the 3 lines of stuff as there should be....any ideas? do you even think that is related to the headlogin.php? or is it something else?
Back to top
Offline View user's profile Send private message
inSaNE_iRIsH

Wizard
Wizard


Joined: Jun 19, 2003
Posts: 101

PostPosted: Tue Feb 17, 2004 7:28 pm    Post subject: Re: How to get login embedded in header Reply with quote

nevermind, i got it now, the large gap below the "Create new account" link was due to this line in your code
Code: › ."<a href=\"modules.php?name=Your_Account&op=new_user\">Create an account</form>";
it shouldnt have had the </form> at the end, when i removed that it is perfect

thanks for all your help
Back to top
Offline View user's profile Send private message
screamatme

Beginner
Beginner


Joined: Nov 23, 2005
Posts: 14

PostPosted: Tue May 01, 2007 9:44 am    Post subject: Re: How to get login embedded in header Reply with quote

First off, thanks for posting this! I managed to get everything "working" in a few minutes but I noticed when I would put in my login information it would send me to the "login information is incorrect page" where I would simply put the information in again in the phpnuke standard form and it would work. Any ideas as to how I can get it working properly? Thanks so much! The site is: http://nutmegpunk.com

-Matthew Norman
Back to top
Offline View user's profile Send private message
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6233
Location: Washington Township, NJ, USA

PostPosted: Tue May 08, 2007 11:59 am    Post subject: Re: How to get login embedded in header Reply with quote

look at the source of the stock phpnuke form, and make sure that your form submission variables, etc are the same.
_________________
Back to top
Offline View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Issues » Other PHPNuke Issues View previous topicPrinter friendly versionView next topic

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours

Powered by phpBB © phpBB Group



Sponsors: Web HostingDomain NamesDedicated ServersDedicated Web HostingDomain Name RegistrationWeb hosting AustraliaSEO Web DesignWeb Design New YorkSearch Engine OptimizationSearch Engine Optimisation

6th year online! 2003-2008
Legal • Use of this site consitutes agreement to the Acceptable Use Policy
Hosted by Implosion WorksSourceForge.net Logo • Theme by TonicMedia