How Do I Get The Dynamic Stats Button To Show For Members.

pauline

Member
Hi All,

I've almost got my toplist finished at last and it's been a blast learning the script and being able to fix a of stuff myself now....except one thing. I can't get the dynamic stats button to show on the link code page.

I uploaded a new image to /images named it ranking.png ticked the show dynamic stats button in admin settings and the image shows in the admin button settings but not on the site itself. I also downloaded the original ranking.php to my pc and deleted it in cpanel

I've tried changing the name of the image as that usually works on my TE but I'm guessing I can't change the name. I've uploaded a fresh button.php as suggested and it still won't work.

The code I'm getting on the link code page is for the stats button not the rank button, and the stats button is not enabled in the admin button settings, so I think I'm missing something. I've checked all posts here on the subject and every file in cpanel I can think of that I might need to change something in but I couldn't see anything.


My eyes and my brain are no longer responding so I figure after trying to work it out myself for hours I'd ask the experts. lol

Thanks in advance,

Pauline
 

Basti

Administrator
Staff member
Your post is confusing. You ask how to make the stats button show.
Yet you say that stats button is not enabled

Might it be that you enabled rank on buttons but used ranking.png for the "rank on button"?

What does your link code page say? in the textarea?
buttontype=rank ?

Other then that a screenshot of your admin settings might help
 

pauline

Member
Sorry to Confuse you Basti, I was pretty tired when I tried to explain that. I want the dynamic button to show on the link code page for members. I made a new ranking button to replace the ranking.png.

I uploaded my button LTE1.jpg (see attachments) and renamed it ranking.png to replace the original ranking.png

I've attached screenshots.

<?php
if (!defined('VISIOLIST')) {
die("This file cannot be accessed directly.");
}

$TMPL = $DB->fetch("SELECT *
FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats
WHERE sites.username = stats.username AND sites.username = '{$username}'", __FILE__, __LINE__);
if ($rank) {
$TMPL['rank'] = $rank;
}
else {
$TMPL['rank'] = $TMPL['old_rank'];
}

$TMPL['average_rating'] = $TMPL['num_ratings'] > 0 ? round($TMPL['total_rating'] / $TMPL['num_ratings'], 0) : 0;

$ranking_periods = array('daily', 'weekly', 'monthly');
$ranking_methods = array('unq_pv', 'tot_pv', 'unq_in', 'tot_in', 'unq_out', 'tot_out');
foreach ($ranking_periods as $ranking_period) {
foreach ($ranking_methods as $ranking_method) {
$TMPL["{$ranking_method}_avg_{$ranking_period}"] = 0;
for ($i = 0; $i < 10; $i++) {
$TMPL["{$ranking_method}_avg_{$ranking_period}"] = $TMPL["{$ranking_method}_avg_{$ranking_period}"] + $TMPL["{$ranking_method}_{$i}_{$ranking_period}"];
}
$TMPL["{$ranking_method}_avg_{$ranking_period}"] = $TMPL["{$ranking_method}_avg_{$ranking_period}"] / 10;
}
}

$TMPL['average_rating'] = $TMPL['num_ratings'] > 0 ? round($TMPL['total_rating'] / $TMPL['num_ratings'], 0) : 0;

$img = imagecreatefrompng("{$CONF['path']}/images/ranking.png");
$color1 = imagecolorallocate($img, 255, 255, 255); //Set your colors (RGB values)
$color2 = imagecolorallocate($img, 255, 255, 255); //Set your colors
header ("Content-type: image/png");

imagestring($img, 2, 80, 75, $TMPL['tot_pv_0_daily'], $color1); // Stats size and position
imagestring($img, 2, 80, 90, $TMPL['unq_in_0_daily'], $color1); // Stats size and position
//imagestring($img, 2, 80, 84, "{$TMPL['average_rating']}/5", $color1);
imagestring($img, 5, 75 - ((strlen($TMPL['rank']) - 1) * 4), 50, $TMPL['rank'], $color2); // Rank Position
imagepng($img);
?>



Thanks,

Pauline
 

Attachments

Last edited:

pauline

Member
Hi Basti,

I just got this reply from my host re button.php

no, there are no block on your site

what I can see is button.php is not in your root folder, maybe it is redirect and show somewhere in other folders.

I suggest you check and verify the permission (normally 0644)

I tought it may be the mod security rules for the server, but I have disabled the security for few of your sites, few months ago or when you emailed me to let me know your clients sometimes can't get access to your sites.

now in your error file it show resource, boolean given in /home/ltehitci/public_html/tepc/pc.php on line 373 [20-Mar-2014 17:20:04 America/Montreal] PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/ltehitci/public_html/tepc/pc.php on line 359

and there are tons of lines like it you should also check it while you are with your script support, thats fillup your error file (now +15 megs) since january

Patrick
I will check the error file and also the root directory,

Thanks in advance,

Pauline
 
Last edited:

pauline

Member
I just looked at cpanel home/ltehitci/public_html/tepc/pc.php on line 359, it says this directory is empty.

I checked the error codes and I didn't see the error mentioned in Patriks email to me. I did clean out my error file though but I looked at all the error codes before the clean out, the only error code in there now is this and I'm not sure if it is even related to this issue:

[17-Mar-2014 19:38:51 Australia/Victoria] PHP Notice: Undefined index: p_terms in /home/bgciwqbk/public_html/sources/admin/settings.php(217) : eval()'d code on line 329

Pauline
 

pauline

Member
oops forgot to mention this is line 329 in sources/admin/settings.php

<label for="description_length">{$LNG['a_s_description_length']}</label>
 

Mark

Administrator
Staff member
looks like your server has some sensitive and silly permission configurations, it would be wise for your server admin to install suPHP, its a much more secure and flexible handler for shared hosts.

If they are unwilling or unable make sure the following files are chmod 644

button.php
button_settings.php (note you wont be able to write to this file or save admin settings)
settings_sql.php

it looks like your server throws internal server error 500 when a writable file is executed, I believe you also had this issue when trying to run the installer.
 

Basti

Administrator
Staff member
Whats with that guy?? We ask for button.php and he mentions pc.php ???
Guess i have to look myself in the error logs and see what button.php does exactly.

Nothing but trouble with that host ;)
 

Basti

Administrator
Staff member
I believe you also had this issue when trying to run the installer
Good catch, that was exactly the issue there.

Please do as Mark said pauline, and let us know if button.php loads
 

pauline

Member
Thanks Guys,

I'll ask the host but I'm thinking it might just be faster and easier to change the toplist to OS hosting. I was just looking at the prices and they are the same as I'm paying now.

Pauline
 

pauline

Member
I'll get back to you and let you know if button.php works trying Marks suggestion, I'm about to get on my lappy now will try then.
 

pauline

Member
I tried changing the permissions but no go the button is still not showing in the members link code page.:(:)

Pauline
 

Basti

Administrator
Staff member
Troublesome host, really... :p
If you dont mind send over ftp again ( old info not working anymore ) and ill have a closer look
 

Basti

Administrator
Staff member
Ok pauline, 2 things went wrong.

1) You deleted from settings_buttons.php
Code:
$img = imagecreatefrompng("{$CONF['path']}/images/ranking.png");
Its a required line. If you are unsure about anything, we are here, but dont go deleting lines of php code ( same as you did in link_code.php before ) ;)

2)
I uploaded my button LTE1.jpg (see attachments) and renamed it ranking.png to replace the original ranking.png
This was wrong. The php functions dont see it as a png, althought ftp shows it as such. That settings_buttons.php file explictly require a png saved file.

Open you jpg image with any photo editor and save it instead as png, but not rename it. That seems to lead to issues.
I have uploaded the core ranking.png for now, so you see it works now.

Seb
 

pauline

Member
You are the best thank you so much. I know how that line was deleted, oops my bad I was trying to see if I could work it out and although I was far from getting it right, I did delete a couple of lines but I made a copy of what I deleted and thought I added it all back to that file. I had a funny feeling it may have been something I did wrong.

I can do all this stuff on my other script but I need to learn this one is new to me and I need to ask if I need help.

I have my button showing now again thank you I couldn't have done it without your help.

Pauline
 

Attachments

Top