Pages: [1]   Go Down
  Print  
Author Topic: Need help addin stats to layout.php (SOLVED)  (Read 311 times)
jaimck
Jr. Member
**
Offline Offline

Posts: 73



View Profile WWW
« on: October 09, 2011, 12:53:02 AM »

My site is www.fast-ptc.info and i want to add some stats on my layout.php.

stats - total click, total site hits, etc...

So here is a image of where i want the stats



This is where the stats will be in the layout.php

Code:
<center>
<div class="bottom_bg">
<div class="bot_bg_in">

I want stats here!

</div>
</center>


Thanks in advance.
« Last Edit: October 09, 2011, 10:22:44 PM by jaimck » Logged

Upgrade to an SDR 3
Aligroup
Global Moderator
Hero Member
*****
Offline Offline

Posts: 781



View Profile WWW
« Reply #1 on: October 09, 2011, 01:33:45 AM »

just copy your stats code and paste that in footer it will work  Smiley
Logged

Iam Online almost 15 hours Daily
Goldclix " Advertize Your Site Free Check Here"

jaimck
Jr. Member
**
Offline Offline

Posts: 73



View Profile WWW
« Reply #2 on: October 09, 2011, 01:56:29 AM »

For stats code do you mean?

Quote
if($settings[homepage_stats] == 1) {
   $sql=$Db1->query("SELECT COUNT(userid) AS total FROM user");
   $totalmembers=$Db1->fetch_array($sql);
   $sql=$Db1->query("SELECT new_members, hits, clicked FROM stats WHERE date='$today_date'");
   $todaystats=$Db1->fetch_array($sql);
   $sql=$Db1->query("SELECT SUM(amount) AS total, COUNT(amount) AS amount FROM payment_history WHERE status=1");
   $totalpaid=$Db1->fetch_array($sql);
        $sql=$Db1->query("SELECT SUM(stats.clicked) AS clicks FROM stats");
$total_clicks=$Db1->fetch_array($sql);
        $sql=$Db1->query("SELECT SUM(stats.hits) AS total FROM stats");
$total_hits=$Db1->fetch_array($sql);
        $sql=$Db1->query("SELECT SUM(cost) AS total FROM ledger WHERE status='1'","total");
$total_income=$Db1->fetch_array($sql);

   $homepagestats="
   ".number_format($totalmembers[total])."&ensp;Members&ensp;&ensp;
   ".number_format($todaystats[new_members])."&ensp;New Today&ensp;&ensp;
   ".number_format($todaystats[hits])."&ensp;Hits Today&ensp;&ensp;
   ".number_format($total_online)."&ensp;Online&ensp;&ensp;
   ".number_format($totalpaid[amount])."&ensp;Payouts Made&ensp;&ensp;
   $".number_format($totalpaid[total],2)."&ensp;Total Paid&ensp;&ensp;
        ".number_format($total_clicks[clicks])."&ensp;Total PTC Served&ensp;
        ".number_format($total_hits[total])."&ensp;Total Site Hits&ensp;";
I have tried this and failed.

Or

Quote
<?=$h_top;?>
I have tried this and it only shows the stats that are located up top. (Located in layout_header.php
Logged

jaimck
Jr. Member
**
Offline Offline

Posts: 73



View Profile WWW
« Reply #3 on: October 09, 2011, 04:16:48 AM »

Any help will be appreciated.
Logged

wiicker95
Jr. Member
**
Offline Offline

Posts: 69


View Profile WWW
« Reply #4 on: October 09, 2011, 06:31:43 AM »

Add this code : <?php if($settings['homepage_stats']==1) echo $homepagestats; ?>
Logged

Aligroup
Global Moderator
Hero Member
*****
Offline Offline

Posts: 781



View Profile WWW
« Reply #5 on: October 09, 2011, 07:19:08 AM »

Add this code : <?php if($settings['homepage_stats']==1) echo $homepagestats; ?>

add this code
Logged

Iam Online almost 15 hours Daily
Goldclix " Advertize Your Site Free Check Here"

jaimck
Jr. Member
**
Offline Offline

Posts: 73



View Profile WWW
« Reply #6 on: October 09, 2011, 05:28:30 PM »

Instead of this:

Code:
if($settings[homepage_stats] == 1) {
$sql=$Db1->query("SELECT COUNT(userid) AS total FROM user");
$totalmembers=$Db1->fetch_array($sql);
$sql=$Db1->query("SELECT new_members, hits, clicked FROM stats WHERE date='$today_date'");
$todaystats=$Db1->fetch_array($sql);
$sql=$Db1->query("SELECT SUM(amount) AS total, COUNT(amount) AS amount FROM payment_history WHERE status=1");
$totalpaid=$Db1->fetch_array($sql);
        $sql=$Db1->query("SELECT SUM(stats.clicked) AS clicks FROM stats");
$total_clicks=$Db1->fetch_array($sql);
        $sql=$Db1->query("SELECT SUM(stats.hits) AS total FROM stats");
$total_hits=$Db1->fetch_array($sql);
        $sql=$Db1->query("SELECT SUM(cost) AS total FROM ledger WHERE status='1'","total");
$total_income=$Db1->fetch_array($sql);

$homepagestats="
".number_format($totalmembers[total])."&ensp;Members&ensp;&ensp;
".number_format($todaystats[new_members])."&ensp;New Today&ensp;&ensp;
".number_format($todaystats[hits])."&ensp;Hits Today&ensp;&ensp;
".number_format($total_online)."&ensp;Online&ensp;&ensp;
".number_format($totalpaid[amount])."&ensp;Payouts Made&ensp;&ensp;
$".number_format($totalpaid[total],2)."&ensp;Total Paid&ensp;&ensp;
        ".number_format($total_clicks[clicks])."&ensp;Total PTC Served&ensp;
        ".number_format($total_hits[total])."&ensp;Total Site Hits&ensp;";
}

and calling it by:

Code:
<?php if($settings['homepage_stats']==1) echo $homepagestats?>

Can i make another and add it to the header like example:

Code:
if($settings[custom_stats] == 1) {
        $sql=$Db1->query("SELECT SUM(stats.clicked) AS clicks FROM stats");
$total_clicks=$Db1->fetch_array($sql);
        $sql=$Db1->query("SELECT SUM(stats.hits) AS total FROM stats");
$total_hits=$Db1->fetch_array($sql);
        $sql=$Db1->query("SELECT SUM(cost) AS total FROM ledger WHERE status='1'","total");
$total_income=$Db1->fetch_array($sql);

$customstats="
        ".number_format($total_clicks[clicks])."&ensp;Total PTC Served&ensp;
        ".number_format($total_hits[total])."&ensp;Total Site Hits&ensp;";
}

and call it by:

Code:
<?php if($settings['custom_stats']==1) echo $customstats?>



Or can you show me another way i can call stats other then homepage stats please?
Logged

jaimck
Jr. Member
**
Offline Offline

Posts: 73



View Profile WWW
« Reply #7 on: October 09, 2011, 10:22:22 PM »

Worked it out so thanks to everyone trying to help  Smiley

I added this:

include/settings.php

Quote
"custom_stats"=>"2",

And This:

templates/ --- / layout_header.php

Quote
if($settings[custom_stats] == 2) {
        $sql=$Db1->query("SELECT SUM(stats.clicked) AS clicks FROM stats");
$total_clicks=$Db1->fetch_array($sql);
        $sql=$Db1->query("SELECT SUM(stats.xclicked) AS total FROM stats");
$total_ce=$Db1->fetch_array($sql);
        $sql=$Db1->query("SELECT SUM(stats.ptrads) AS total FROM stats");
$total_ptra=$Db1->fetch_array($sql);
       

   $customstats="
        ".number_format($total_clicks[clicks])."&ensp;Total PTC Served&ensp;
        &ensp;-&ensp;
        ".number_format($total_ce[total])."&ensp;Total CE Ads Served&ensp;
        &ensp;-&ensp;
        ".number_format($total_ptra[total])."&ensp;Total PTRA Served&ensp;";
}

And then This:

Templates / --- / layout.php

Quote
<?php if($settings['custom_stats']==2) echo $customstats; ?>
Logged

Get a SDR 3 NOW at http://ptcfactory.info

The best and most up to date Aurora script in the market!!
Pages: [1]   Go Up
  Print  
 
Jump to: