No duplicate Nickname

Started on the old forum in January 2017 · view the original in the archive · old links redirect here

2 replies · 127 views · started 9 years ago · 1 min read

3 participants
sweetangel Lead · 885 posts #1

hey guys i have a small problem with last 10 viewers in profile list..

i have this code in list:

  echo "<p class="secd"><u>$whonick - My Profile Viewers:</u>\n";
  echo "<br/>";
  echo "</div>";

  echo "<p align="center">";

    //////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_lastview WHERE whonick='".$who."'")); //changable
    $num_items = $noi[0];
    $items_per_page= 10;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

$sql = "SELECT lastview,ltime FROM ibwf_lastview WHERE whonick='".$who."'ORDER BY ltime DESC LIMIT $limit_start, $items_per_page ";

    echo "<div>";
    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
  $snick = getnick_uid($item[0]);

  if(isonline($item[0]))
  {
    $iml = "<img src="images/onl.gif" alt="+"/>";
  }else{
    $iml = "<img src="images/ofl.gif" alt="-"/>";
  }

$lnk = "<a href="index.php?action=viewuser&sid=$sid&who=$item[0]">$snick</a><br/>";
$newtime =$item[1]+(0 *60 *60);
$dte = "".date("D d M y - h:i:s a",$newtime)."<br/>";
echo "$iml $lnk $dte<br/>";
}
}

and this code in profile view:

$lv=getuid_sid($sid);
$me = getuid_sid($sid);
if ($me != "$who")
{
mysql_query("INSERT INTO ibwf_lastview SET lastview='".$lv."', whonick='".$who."', ltime='".time()."'");
}
  $sql= mysql_fetch_array(mysql_query("SELECT lastview,ltime FROM ibwf_lastview WHERE whonick='".$who."'ORDER BY ltime DESC LIMIT 1"));
  $a = getuid_sid($sql[0]);
  $tm = time();
  $timeout = $tm - 86400; //time out = 1 day
  mysql_query("DELETE FROM ibwf_lastview WHERE ltime <'".$timeout."'");

my problem is: If USER A visit my profile 10 times i show him 10 times in this list. how i can have the most recent viewer by the USER A in only 1 result and not in all 10?

Thanks for help 🙂

if like my post click:

External image (may be gone)

Loony Senior · 258 posts #2

try this

$lv=getuid_sid($sid);
$me = getuid_sid($sid);
if ($me != "$who")
{
mysql_query("INSERT IGNORE INTO ibwf_lastview SET lastview='".$lv."', whonick='".$who."', ltime='".time()."'");
}
  $sql= mysql_fetch_array(mysql_query("SELECT lastview,ltime FROM ibwf_lastview WHERE whonick='".$who."'ORDER BY ltime DESC LIMIT 1"));
  $a = getuid_sid($sql[0]);
  $tm = time();
  $timeout = $tm - 86400; //time out = 1 day
  mysql_query("DELETE FROM ibwf_lastview WHERE ltime <'".$timeout."'");  

Creator of Epix.Mobi

Keep an Eye on us Big things coming soon!!!! Need something for your site hit me up here http://coding-talk.com/forum/main-forums/marketplace/153110-free-features-for-your-wapsite

tupac Developer · 95 posts #3

hey guys i need some help i am trying to get a code for my php site chat.php that will allow you to next pages in the chatroom to view old messages and also allow the message to stay in long enough it's the basic chat.php file can anyone help?

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close