Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
Guillius
Hangin' Around



Joined: Jan 31, 2004
Posts: 31

PostPosted: Sat Jun 12, 2004 12:22 am Reply with quote

What I am trying to do is Add the Avatar at the top. I tried Xfering a portion that looked like it was for that from Raven's Distro but it didn't work.

Code:


if (is_user($user)) {
   $sqlp = "SELECT user_posts AS posts FROM $user_prefix"._users." WHERE username = '$uname'";
   $result = $db->sql_query($sqlp);
   $row = $db->sql_fetchrow($result);
   $posts = $row[posts];
   $sql = "SELECT user_avatar FROM " . $prefix."_users WHERE username='$uname' AND user_avatar IS NOT NULL";
   $result = $db->sql_query($sql);
   if ($result) {
      $userinfo = $db->sql_fetchrow($result);
       if ( ereg( "(http)", $userinfo[user_avatar]) ) {
         $content .= "<br /><center><img src=\"$userinfo[user_avatar]\" /></center>\n";
       }
       else
       if ($userinfo[user_avatar]) {
         $content .= "<br /><center><img src=\"modules/Forums/images/avatars/$userinfo[user_avatar]\" /></center>\n";
       }
   }

It said it had a parse error. I am using nuke 7.2 with Eventcal if that helps. I only noticed a couple of things that were different.. I tried changing them and still got the error... like..
Code:
if (is_user($user)) 
is
Code:
if (!is_user($user)) 
in most blocks for 7.2 but again I'm not sure... here is the block I'm trying to add the avatar to:

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 $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 $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 $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 ".$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 ".$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 .= "&nbsp;$i:&nbsp;<A HREF=\"forums.html?file=profile&mode=viewprofile&u=$user_id\">$session[uname]</a><br>\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 $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 $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 $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> ".Welcome."<b>&nbsp".$username."</b><br>\n";
   $content .= "<img src=images/visitors/arrow.gif>&nbsp&nbsp<a href=\"account-logout.html\">Logout</a>\n";
   $content .= "<HR noShade SIZE=1>\n";
   $content .= "<img src=images/visitors/priv.gif>&nbsp<a href=\"messages.html\"><b>".PRIVMSG."</b></a><br>\n";
   $content .= "<img src=images/visitors/upriv.gif>".Unread." <b>".$MesUnread."</b><br>\n";
   $content .= "<img src=images/visitors/rpriv.gif>".Read." <b>".$MesRead."</b><br>\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=\"account.html\" method=\"post\">\n";
$content .="<b>".UserLogin."</b><br><br>\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")) {
      if (extension_loaded("gd") AND ($gfx_chk == 2 OR $gfx_chk == 4 OR $gfx_chk == 5 OR $gfx_chk == 7)) {
   $content .="<tr><td colspan='2'>".SecurityCode.": <img src='modules.php?name=Your_Account&op=gfx&random_num=$random_num' border='1' alt='".SECURITYCODE."' title='".SECURITYCODE."'></td></tr>\n";
   $content .="<tr><td colspan='2'>".Confirm.": <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><br>\n\n";
}

// Info for users who logged in AND Guests
// $content .= "<a href=\"members.html\"><img src=images/visitors/mem.gif border=\"0\" alt=\"Members List\"></a><b> ".Members."</b><br>\n";

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

// $content .= "<img src=images/visitors/arrow.gif> ".Today." <b>$userCount</b><br>\n";
// $content .= "<img src=images/visitors/arrow.gif> ".Yesterday." <b>$userCount2</b><br>\n";
// $content .= "<img src=images/visitors/arrow.gif> ".Overall." <b>$numrows</b><br>\n";
// $content .= "<HR noShade SIZE=1>\n";
$content .= "<img src=images/visitors/visitors.gif><b> <u>"._BVISIT.":</u> </b><br>\n";
$content .= "<img src=images/visitors/arrow.gif> ".Guests." <b>$guest_online_num</b><br>\n";
$content .= "<img src=images/visitors/arrow.gif> ".Members." <b>$member_online_num</b><br>\n";
$vtotal = $guest_online_num+$member_online_num;
$content .= "<img src=images/visitors/arrow.gif> ".Total." <b>$vtotal</b><br>\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><b> <u>".ONLINE."</u></b><br>$who_online $who_online_now";
}
else
{
   // Show guests how to register
 $content .= "<center><img src=images/visitors/signup.gif><br>"._YOUAREANON."</center>";
}

?>


any hints? help?
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sat Jun 12, 2004 5:00 am Reply with quote

Wouldn't it just have been easier to post the parse error Wink ? Go back to that and let's fix it. In that code at the top, if that is complete, you are missing a closing }. And, by adding the ! to the expression you are saying "Only do this if it is NOT a user", meaning, you will never execute that logic for a registered user.
 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

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 ©