Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.8
Author Message
pmaryan
Regular
Regular



Joined: Oct 06, 2005
Posts: 76

PostPosted: Thu Oct 06, 2005 5:51 pm Reply with quote

How would I go about adding a link that says "Logout Now" into this block, so it appears when the user is logged in. Any time I have edited this block something whacks it and then it doesnt even appear.


Here is the current code for the Whos Online block.

Code:
<?php

if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

global $user, $cookie, $prefix, $db, $user_prefix;

cookiedecode($user);
if (isset($_SERVER['REMOTE_ADDR'])) { $ip = $_SERVER['REMOTE_ADDR']; }
if (is_user($user))
{
    $uname = $cookie[1];
    $guest = 0;
}
else
{
    if (!empty($ip)) {
      $uname = $ip;
    } else {
      $uname = "";
    }
    $guest = 1;
}

$guest_online_sql = "SELECT * FROM ".$prefix."_session WHERE guest='1'";
$guest_online_query = $db->sql_query($guest_online_sql);
$guest_online_num = $db->sql_numrows($guest_online_query);

$member_online_sql = "SELECT * FROM ".$prefix."_session WHERE guest='0'";
$member_online_query = $db->sql_query($member_online_sql);
$member_online_num = $db->sql_numrows($member_online_query);

$who_online_num = $guest_online_num + $member_online_num;
$who_online = "<div align=\"center\"><span class=\"content\">"._CURRENTLY." $guest_online_num "._GUESTS." $member_online_num "._MEMBERS."<br>";

$content = $who_online;

if (is_user($user)) {
    if (is_active("Private_Messages")) {
        $sql = "SELECT user_id FROM ".$user_prefix."_users WHERE username='$uname'";
        $query = $db->sql_query($sql);
   list($user_id) = $db->sql_fetchrow($query);
   $uid = intval($user_id);
   $sql = "SELECT * FROM ".$prefix."_bbprivmsgs WHERE privmsgs_to_userid='$uid' AND (privmsgs_type='5' OR privmsgs_type='1')";
   $query = $db->sql_query($sql);
   $newpm = $db->sql_numrows($query);
    }
}

$sql2 = "SELECT title FROM ".$prefix."_blocks WHERE bkey='online'";
$query2 = $db->sql_query($sql2);
list($title) = $db->sql_fetchrow($query2);
if (is_user($user)) {
    $content .= "<br>"._YOUARELOGGED." <b>$uname</b>.<br>";
    if (is_active("Private_Messages")) {
        $sql = "SELECT user_id FROM ".$user_prefix."_users WHERE username='$uname'";
        $query = $db->sql_query($sql);
   list($user_id) = $db->sql_fetchrow($query);
   $uid = intval($user_id);
   $sql = "SELECT privmsgs_to_userid FROM ".$prefix."_bbprivmsgs WHERE privmsgs_to_userid='$uid' AND (privmsgs_type='1' OR privmsgs_type='5' OR privmsgs_type='0')";
   $query = $db->sql_query($sql);
   $numrow = $db->sql_numrows($query);
   $content .= ""._YOUHAVE." <a href=\"messages.html\"><b>$numrow</b></a> "._PRIVATEMSG."";
    }
    $content .= "</span></div>";
}
else {
    $content .= "<br>"._YOUAREANON."</span></div>";
}
?>
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Oct 06, 2005 9:45 pm Reply with quote

FIND
Code:
$content .= ""._YOUHAVE." <a href=\"messages.html\"><b>$numrow</b></a> "._PRIVATEMSG."";

    }

INSERT AFTER
Code:
$content .= ""."<a href=\"/modules.php?name=Your_Account&op=logout\"><b>"._LOGOUT."</b></a>";

    }


It should look like
Code:
$content .= ""._YOUHAVE." <a href=\"messages.html\"><b>$numrow</b></a> "._PRIVATEMSG."";

$content .= ""."<a href=\"/modules.php?name=Your_Account&op=logout\"><b>"._LOGOUT."</b></a>";
    }
 
View user's profile Send private message
pmaryan







PostPosted: Fri Oct 07, 2005 2:27 pm Reply with quote

Code:
<?php


/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2005 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

global $user, $cookie, $prefix, $db, $user_prefix;

cookiedecode($user);
if (isset($_SERVER['REMOTE_ADDR'])) { $ip = $_SERVER['REMOTE_ADDR']; }
if (is_user($user))
{
    $uname = $cookie[1];
    $guest = 0;
}
else
{
    if (!empty($ip)) {
      $uname = $ip;
    } else {
      $uname = "";
    }
    $guest = 1;
}

$guest_online_sql = "SELECT * FROM ".$prefix."_session WHERE guest='1'";
$guest_online_query = $db->sql_query($guest_online_sql);
$guest_online_num = $db->sql_numrows($guest_online_query);

$member_online_sql = "SELECT * FROM ".$prefix."_session WHERE guest='0'";
$member_online_query = $db->sql_query($member_online_sql);
$member_online_num = $db->sql_numrows($member_online_query);

$who_online_num = $guest_online_num + $member_online_num;
$who_online = "<div align=\"center\"><span class=\"content\">"._CURRENTLY."

$guest_online_num "._GUESTS." $member_online_num "._MEMBERS."<br>";

$content = $who_online;

if (is_user($user)) {
    if (is_active("Private_Messages")) {
        $sql = "SELECT user_id FROM ".$user_prefix."_users WHERE username='$uname'";
        $query = $db->sql_query($sql);
   list($user_id) = $db->sql_fetchrow($query);
   $uid = intval($user_id);
   $sql = "SELECT * FROM ".$prefix."_bbprivmsgs WHERE privmsgs_to_userid='$uid' AND

(privmsgs_type='5' OR privmsgs_type='1')";
   $query = $db->sql_query($sql);
   $newpm = $db->sql_numrows($query);
    }
}

$sql2 = "SELECT title FROM ".$prefix."_blocks WHERE bkey='online'";
$query2 = $db->sql_query($sql2);
list($title) = $db->sql_fetchrow($query2);
if (is_user($user)) {
    $content .= "<br>"._YOUARELOGGED." <b>$uname</b>.<br>";
    if (is_active("Private_Messages")) {
        $sql = "SELECT user_id FROM ".$user_prefix."_users WHERE username='$uname'";
        $query = $db->sql_query($sql);
   list($user_id) = $db->sql_fetchrow($query);
   $uid = intval($user_id);
   $sql = "SELECT privmsgs_to_userid FROM ".$prefix."_bbprivmsgs WHERE

privmsgs_to_userid='$uid' AND (privmsgs_type='1' OR privmsgs_type='5' OR

privmsgs_type='0')";
   $query = $db->sql_query($sql);
   $numrow = $db->sql_numrows($query);
   $content .= ""."<a

href=\"/modules.php?name=Your_Account&op=logout\"><b>"._LOGOUT."</b></a>";
   $content .= ""._YOUHAVE." <a

href=\"messages.html\"><b>$numrow</b></a> "._PRIVATEMSG."";
$content .=""."<a href=\"/modules.php?name=Your_Account&op=logout\"><b>"._LOGOUT."</b></a>";
    }
   $content .= "</span></div>";
}
else {
    $content .= "<br>"._YOUAREANON."</span></div>";
}
?>




So I applied the edits, and it doesnt show when there is an anon. user or when a user is logged in. Any Ideas??

Site address is www.beat2k.org
 
Raven







PostPosted: Fri Oct 07, 2005 3:16 pm Reply with quote

Find
Code:
   $content .= ""."<a


href=\"/modules.php?name=Your_Account&op=logout\"><b>"._LOGOUT."</b></a>";
   $content .= ""._YOUHAVE." <a

href=\"messages.html\"><b>$numrow</b></a> "._PRIVATEMSG."";
$content .=""."<a href=\"/modules.php?name=Your_Account&op=logout\"><b>"._LOGOUT."</b></a>";
    }
   $content .= "</span></div>";
}
else {
    $content .= "<br>"._YOUAREANON."</span></div>";
}
?>

and change it to
Code:
   $content .= ""._YOUHAVE." <a href=\"messages.html\"><b>$numrow</b></a> "._PRIVATEMSG."";

    }
   $content .=""."<a href=\"/modules.php?name=Your_Account&op=logout\"><b>"._LOGOUT."</b></a>";
   $content .= "</span></div>";
}
else {
    $content .= "<br>"._YOUAREANON."</span></div>";
}
?>
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.8

View next topic
View previous topic
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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©