hi ... i need a little help :D .. i want to add in in user profile how many views he had in it and how were the last 10 users who saw her profile .. and a top of the most seen profiles ...
Top Profile Views
Collapse
X
-
hi ... i need a little help :D .. i want to add in in user profile how many views he had in it and how were the last 10 users who saw her profile .. and a top of the most seen profiles ... [/b]
Put this code in ($action=="viewuser") where you want to show
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>//////////// Contor Profil User
$vws = mysql_fetch_array(mysql_query("SELECT prof_vazut FROM ibwf_users WHERE id='".$who."'"));
$views = $vws[0]+1;
echo "Profil vazut de: $views ori
";
/////////Actualizare
if(mypro(getuid_sid($sid), $who))
{
echo "";
}else{
mysql_query("UPDATE ibwf_users SET prof_vazut='".$views."' WHERE id='".$who."'");
}
//////////incheiere contor profil</div>
Last Profile viewer and last 10 viewers
Make one table like this:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>CREATE TABLE `ibwf_ultima_vizualizare` (
`whonick` varchar(20) collate latin1_general_ci NOT NULL,
`id` int(100) NOT NULL auto_increment,
`lastview` varchar(20) collate latin1_general_ci NOT NULL,
`ltime` int(100) NOT NULL default '0',
PRIMARY KEY (`whonick`,`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;</div>
Put this code in ($action=="viewuser") where you want to show
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>//////////Ultima vizualizare profil * de catre cine
$sql = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_ultima_vizualizare WHERE whonick='".$whonick."'"));
if ($sql[0]>10)
{
$sql = mysql_fetch_array(mysql_query("SELECT MAX(id) FROM ibwf_ultima_vizualizare WHERE whonick='".$whonick."'"));
$sql = $sql[0]-9;
mysql_query("DELETE FROM ibwf_ultima_vizualizare WHERE whonick='".$whonick."' AND id <'".$sql."'");
}
$lv=getnick_sid($sid);
$a = getuid_nick($whonick);
if($a!=$uid)
{
mysql_query("INSERT INTO ibwf_ultima_vizualizare SET lastview='".$lv."', whonick='".$whonick."', ltime='".time()."'");
}
$sql= mysql_fetch_array(mysql_query("SELECT lastview,ltime FROM ibwf_ultima_vizualizare WHERE whonick='".$whonick."'ORDER BY ltime DESC LIMIT 1"));
$a = getuid_nick($sql[0]);
$link = "<a href=\"index.php?action=viewuser&sid=$sid&who=$a\" >$sql[0]</a>";
echo "Ultima vizualizare de catre $link | <a href=\"index.php?action=ultimii10&who=$who&sid=$si d\"> + 10</a>
";
////////// Incheiere *vizualizator profil</div>
Here is window for last 10 users where they show:
Create new action called ultimii10 and put where you want in index.php
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>/////////////// Ultimii 10 vizitatori ai profilului
else if($action=="ultimii10")
{
addonline(getuid_sid($sid),"Vizualizare ultimii 10 vizitatori profil","");
if($who==""||$who==0)
{
$mnick = $_POST["mnick"];
$who = getuid_nick($mnick);
}
$whonick = getnick_uid($who);
echo "<card id=\"main\" title=\"Vizualizare ultimii 10 vizitatori profil\">";
echo "<p align=\"center\">";
$nick = getnick_sid($sid);
echo "$nick Aici poti vizualiza ultimii 10 useri care ti-au accesat profilul
";
echo "</p>";
echo "<p align=\"left\">";
$sql= mysql_query("SELECT lastview,ltime FROM wolfy_lastview WHERE whonick='".$whonick."'ORDER BY ltime DESC LIMIT 10");
while($row = mysql_fetch_array($sql))
{
$a = getuid_nick($row[0]);
echo "<a href=\"index.php?action=viewuser&sid=$sid&who=$a\" >$row[0]</a>";
$newtime =$row[1]+(0 *60 *60);
echo " ".date("D d M y - h:i:s a",$newtime)."
";
echo "------------
";
}
echo "</p>";
echo "<p align=\"center\">";
$a = getuid_nick($whonick);
echo "<a href=\"index.php?action=viewuser&sid=$sid&who=$a\" >«Back to $whonick</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\">";
echo "Home</a>";
echo "</p>";
echo "</card>";
}</div>
Here is the top profile viewers Put this in list.php there is the statistics orders or where you want
And link to top profile:
echo "<a href=\"lists.php?action=topprofile&sid=$sid\">Top Profile Viewers</a>
";
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>//////////////////////////////////Top Online
else if($action=="topprofile")
{
addonline(getuid_sid($sid),"Top Profile Vizualizate","lists.php?action=$action");
echo "<card id=\"main\" title=\"Top Profile Vizualizate\">";
echo "<p align=\"center\">";
echo "Top Profile Vizualizate";
echo "</p>";
if($page=="" || $page<=0)$page=1;
$num_items = regmemcount(); //changable
$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 id, name, proviews FROM ibwf_users ORDER BY prof_vazut DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$lnk = "<a href=\"index.php?action=viewuser&who=$item[0]&sid=$sid\">$item[1]</a> Profil vazut de: $item[2] ori";
echo "$lnk
";
}
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"lists.php?action=topprofile&page=$ppage&sid =$sid&view=$view\">«Inapoi</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"lists.php?action=topprofile&page=$npage&sid =$sid&view=$view\">Inainte»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
$rets = "Sari la pagina<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[DU-TE]";
$rets .= "<go href=\"lists.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";
echo $rets;
}
echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=stats&sid=$sid\">«";
echo "Stats</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\">";
echo "Home</a>";
echo "</p>";
echo "</card>";
}</div>
That it is (cam atat, sunt de la mine tre sa-ti mearga) :P
Comment
-
when i want view the profile it give me : "Fatal error: Call to undefined function mypro() in ............/profil.php on line 203" :sad:[/b]
Put this in core.php
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>//////////////////////////////////////////functia contor profil by wolfy
function mypro($uid, $tid)
{
if($uid==$tid)
{
return true;
}
}</div>
Comment
Comment