» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Online Users: 42
0 members and 42 guests
No Members online
Most users ever online was 611, 03-21-2008 at 11:10 PM.
» .::.
Web Hosting - web hosting, dedicated servers and web design services
Online Degree - search for 1000+ online degrees, online colleges & online universities.
Tattoo - we are a group of tattoo enthusiasts
Gexa Energy - your absolute best choice in electric service
Texas electricity - save on electric rates
Football Betting - best nfl betting promotions at sportsbook.com.
Oral Chelation - initial cleansing of your veins & arteries
Portatiles - Ofertas en Ordenadores y Portatiles. Increibles Ofertas DELL.

Register Now! Contact Us

About this Page
This is a discussion on NukeMods Site_Visitor Block download within the Nuke 6.5 to 6.9 - Blocks forums, part of the PHP-Nuke 6.5 to 6.9 category; You all need to go through your site visitor php file thats available for download here and replace all the ...


Go Back   Nukemods Forum » PHP-Nuke 6.5 to 6.9 » Nuke 6.5 to 6.9 - Blocks

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-16-2003, 08:33 PM
Junior Member
 
Join Date: May 2003
Posts: 7
NukeMods Site_Visitor Block download
You all need to go through your site visitor php file thats available for download here and replace all the calls to _user table that use $prefix with $user_prefix otherwise folks with shared user tables across sites will have a broken login with this block and also wont see correct members reg'd/online.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-17-2003, 03:55 AM
Junior Member
 
Join Date: May 2003
Posts: 7
ok I had several folks ask for the fixed code. It appears to be working now on my site correctly.

I used the latest version of Site_Visitor block dated May 6th and simply went through and everywhere the sql_query made a call to _users I changed the $prefix to $user_prefix

DO NOT remove the leading and trailing dots "." some lines have it like ._users. while other lines do .$user_prefix. instead. I am not sure what the differances are if any and I left them alone.

DO NOT change the $prefix to $user_prefix on any of the _session calls just the _users calls.

As far as I can tell this works fine...i havent heard any more complaints on my site. If your users still cant log in from the site_visitor block theres something else going on then. I had to remove the info remarks at the begining of file so this message would post within the char limits

Code:
<?php


if ( eregi( "block-Site_Visitors.php", $PHP_SELF ) )
{
   Header(" Location: index.php" );
   die();
}

// Some definitions
global $user, $cookie, $prefix, $dbi, $user_prefix, $username, $stop, $module_name, $redirect, $mode, $t, $f, $admin;
$content = "";

cookiedecode( $user );
$ip = getenv( "REMOTE_ADDR" );
$username = $cookie[1];
if ( !isset( $username ) )
{
   $username = "$ip";
   $guest = 1;
}

// Set Nuke session table
$past = time()-900;
sql_query( "DELETE FROM $user_prefix"._users." WHERE time < '$past'", $dbi);
$result = sql_query( "SELECT time FROM $prefix"._session." WHERE uname='$username'", $dbi );

$ctime = time();
if ( $row = sql_fetch_array( $result , $dbi ) )
{
   sql_query( "UPDATE $prefix"._session." SET uname='$username', time='$ctime', host_addr='$ip', guest='$guest' WHERE uname='$username'", $dbi );
}
else
{
   sql_query( "INSERT INTO $prefix"._session." (uname, time, host_addr, guest) VALUES ('$username', '$ctime', '$ip', '$guest')" , $dbi );
}

// Determine last registered user
$result = sql_query( "select username from $user_prefix"._users." order by user_id DESC limit 0,1", $dbi );
list( $lastuser ) = sql_fetch_row( $result, $dbi );
// Amount of registered users
$numrows = sql_num_rows( sql_query( "select user_id from $user_prefix"._users." where username != 'Anonymous'", $dbi ) );
// Amount of registered users online
$result2 = sql_query( "SELECT uname, guest FROM $prefix"._session." where guest=0", $dbi );
$member_online_num = sql_num_rows( $result2 );

// Assemble the online registered users
$who_online_now = "";
$i = 1;
while ( $session = sql_fetch_array( $result2, $dbi ) )
{
   if ( isset($session["guest"]) and $session["guest"] == 0 )
   {
      // Determine Location for Flag image
      $FlagResult = sql_query( "select user_from from ".$user_prefix."_users where username='$session[uname]'", $dbi );
      $FlagInfo =   sql_fetch_array( $FlagResult, $dbi );
      
      // Check if FLAG.GIF Exists
      $FlagPath = "images/forum/flags/";
      if( ( $FlagInfo[user_from] == "" ) OR ( file_exists( $FlagPath.$FlagInfo[user_from] ) == 0 ) )
      {
         $FlagPathFile = "images/visitors/quest.gif";
      }
      else
      {
         $FlagPathFile = $FlagPath.$FlagInfo[user_from];
      }
      
      // Get user ID's of online registered users
      $resultuser_id = sql_query( "SELECT user_id FROM ".$user_prefix."_users where username='$session[uname]'", $dbi );
      list( $user_id ) = sql_fetch_row( $resultuser_id, $dbi );
      // Merge Flag, online registered user and hyperlink to phpBB viewing profile
      $who_online_now .= "&$i:&<A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\">$session[uname]</a>
\n";
      $who_online_now .= ( $i != $member_online_num ? "  " : "" );
      $i++;
   }
}

$Today = getdate();
// Formatting Current Date
$month = $Today['month'];
$mday = $Today['mday'];
$year = $Today['year'];

// Formatting Previous Date
$pmonth = $Today['month'];
$pmday = $Today['mday'];
$pmday = $mday-1;
$pyear = $Today['year'];

// Month conversion into numeric mode
if ( $pmonth == "January" ) { $pmonth=1; } else
if ( $pmonth == "February" ) { $pmonth=2; } else
if ( $pmonth == "March" ) { $pmonth=3; } else
if ( $pmonth == "April" ) { $pmonth=4; }; //else
if ( $pmonth == "May" ) { $pmonth=5; } else
if ( $pmonth == "June" ) { $pmonth=6; } else
if ( $pmonth == "July" ) { $pmonth=7; } else
if ( $pmonth == "August" ) { $pmonth=8; } else
if ( $pmonth == "September" ) { $pmonth=9; } else
if ( $pmonth == "October" ) { $pmonth=10; } else
if ( $pmonth == "November" ) { $pmonth=11; } else
if ( $pmonth == "December" ) { $pmonth=12; };
$test = mktime ( 0, 0, 0, $pmonth, $pmday, $pyear, 1 );

// Creating SQL parameter
$curDate2 = "%".$month[0].$month[1].$month[2]."%".$mday."%".$year."%";
$preday = strftime ( "%d", $test );
$premonth = strftime ( "%B", $test );
$preyear = strftime ( "%Y", $test );
$curDateP = "%".$premonth[0].$premonth[1].$premonth[2]."%".$preday."%".$preyear."%";

// Executing SQL Today
$sql2 = "SELECT COUNT(user_id) AS userCount from $user_prefix"._users." WHERE user_regdate LIKE '$curDate2'";
$result2 = sql_query( $sql2, $dbi );
list( $userCount ) = sql_fetch_row( $result2, $dbi );
// end

// Executing SQL Yesterday
$sql3 = "SELECT COUNT(user_id) AS userCount from $user_prefix"._users." WHERE user_regdate LIKE '$curDateP'";
$result3 = sql_query( $sql3, $dbi );
list( $userCount2 ) = sql_fetch_row( $result3, $dbi );
// end

$result = sql_query( "SELECT uname FROM $prefix"._session." where guest=1", $dbi );
$guest_online_num = sql_num_rows( $result );

$result = sql_query( "SELECT uname FROM $prefix"._session." where guest=0", $dbi );
$member_online_num = sql_num_rows( $result );

$who_online_num = $guest_online_num + $member_online_num;

// Display all information
if ( is_user( $user ) )
{
   // Determine how many READ Messages and how many UNREAD Messages
   $result = sql_query( "select user_id from $user_prefix"._users." where username='$username'", $dbi );
   list( $user_id ) = sql_fetch_row( $result, $dbi );
   $result2 = sql_query( "select privmsgs_type from $prefix"._bbprivmsgs." where privmsgs_to_userid='$user_id' AND (privmsgs_type='1' or privmsgs_type='5')", $dbi );
   $MesUnread = sql_num_rows( $result2 );
   $result3 = sql_query( "select privmsgs_type from $prefix"._bbprivmsgs." where privmsgs_to_userid='$user_id' AND (privmsgs_type='0')", $dbi );
   $MesRead = sql_num_rows( $result3 );

   // Info for users which is logged in
   $content .= "<img src=images/visitors/anon.gif>"._SV_WELCOME."ÂÂ*".$username."
\n";
   $content .= "<img src=images/visitors/arrow.gif>ÂÂ*ÂÂ*<a href=\"modules.php?name=Your_Account&op=logout\">Logout</a>\n";
   $content .= "<HR noShade SIZE=1>\n";
   $content .= "<img src=images/visitors/priv.gif>ÂÂ*<a href=\"modules.php?name=Private_Messages\">"._SV_PRIVMSG."</a>
\n";
   $content .= "<img src=images/visitors/upriv.gif>"._SV_UNREAD."".$MesUnread."
\n";
   $content .= "<img src=images/visitors/rpriv.gif>"._SV_READ."".$MesRead."
\n";
   $content .= "<HR noShade SIZE=1>\n";
}
else
{
   // Info for guests (users who didn't log in)
	if (!is_user($user)) {
	    mt_srand ((double)microtime()*1000000);
	    $maxran = 1000000;
	    $random_num = mt_rand(0, $maxran);
	}
$content .="<form action=\"modules.php?name=Your_Account\" method=\"post\">\n";
$content .=""._SV_USERLOGIN."

\n";
$content .="<table border=\"0\"><tr><td>\n";
$content .=""._NICKNAME.":</td></tr>\n";
$content .="<tr><td><input type=\"text\" name=\"username\" size=\"15\" maxlength=\"25\"></td></tr>\n";
$content .="<tr><td>"._PASSWORD.":</td></tr>\n";
$content .="<tr><td><input type=\"password\" name=\"user_password\" size=\"15\" maxlength=\"20\"></td></tr>\n";
	    if (extension_loaded("gd")) {
$content .="<tr><td colspan='2'>"._SV_SECURITYCODE.": [img]modules.php?name=Your_Account&op=gfx&random_num=$random_num[/img]</td></tr>\n";
$content .="<tr><td colspan='2'>"._SV_TYPESECCODE.": <input type=\"text\" NAME=\"gfx_check\" SIZE=\"15\" MAXLENGTH=\"10\"></td></tr>\n";
$content .="<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">\n";
	    }
$content .="</table><input type=\"hidden\" name=\"redirect\" value=$redirect>\n";
$content .="<input type=\"hidden\" name=\"mode\" value=$mode>\n";
$content .="<input type=\"hidden\" name=\"f\" value=$f>\n";
$content .="<input type=\"hidden\" name=\"t\" value=$t>\n";
$content .="<input type=\"hidden\" name=\"op\" value=\"login\">\n";
$content .="<input type=\"submit\" value=\""._LOGIN."\"></form>
\n\n";
}

// Info for users who logged in AND Guests
$content .= "<a href=\"modules.php?name=Members_List\"><img src=images/visitors/mem.gif border=\"0\" alt=\"Members List\"></a>"._SV_MEMBERS."
\n";

// Hyperlink last registered user to phpBB viewing profile
$resultName = sql_query( "SELECT user_id FROM ".$user_prefix."_users where username='$lastuser'", $dbi );
list( $Lastuser_id ) = sql_fetch_row( $resultName, $dbi );
$content .= "<img src=images/visitors/arrow.gif>"._SV_LATEST."<A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$Lastuser_id\">$lastuser</a>
\n";

$content .= "<img src=images/visitors/arrow.gif>"._SV_TODAY."$userCount
\n";
$content .= "<img src=images/visitors/arrow.gif>"._SV_YESTERDAY."$userCount2
\n";
$content .= "<img src=images/visitors/arrow.gif>"._SV_OVERALL."$numrows
\n";
$content .= "<HR noShade SIZE=1>\n";
$content .= "<img src=images/visitors/visitors.gif>"._SV_VISITORS1."
\n";
$content .= "<img src=images/visitors/arrow.gif>"._SV_VISITORS2."$guest_online_num
\n";
$content .= "<img src=images/visitors/arrow.gif>"._SV_VMEMBERS."$member_online_num
\n";
$vtotal = $guest_online_num+$member_online_num;
$content .= "<img src=images/visitors/arrow.gif>"._SV_TOTAL."$vtotal
\n";
$content .= "<HR noShade SIZE=1>\n";

if ( is_user( $user ) )
{
   // Show only registered online users to users who logged in
   $content .= "<img src=images/visitors/online.gif>"._SV_ONLINE."
$who_online $who_online_now";
}
else
{
   // Show guests how to register
   $content .= "<center><img src=images/visitors/signup.gif>
"._YOUAREANON."</center>";
}

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-17-2003, 10:39 PM
Senior Member
 
Join Date: Sep 2002
Posts: 2,905
Thanks jojstar, we'll take a look at this. We haven't had any complaints yet from our users on the logging in part of the Site visitors block, but I do agree that the prefix should go back to user_prefix for the user calls to the database.

mikem
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Login block as in nukemods doneandoner Nuke 7.x - Blocks 7 02-27-2005 06:45 AM
The nukemods, block creator.......how to use it. Colin_da_Killer Site design 3 04-29-2003 10:21 PM
Add My_eGallery 2.79 Media Download To Download Stats Block empty_clips Open topics 0 04-25-2003 02:25 PM
nukemods.com menu block? Zathu_Koon Purged Topics 12 02-10-2003 01:36 PM
The Menu block for nukemods Suzie Purged Topics 7 01-25-2003 05:30 AM


All times are GMT -5. The time now is 04:29 AM.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31