Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
m-weisel2
Regular
Regular



Joined: May 22, 2005
Posts: 78

PostPosted: Fri Jun 17, 2005 12:12 am Reply with quote

I have seen people with images in their signatures like on this site one is 64bitguy and it shows the stats of their phpnuke site how can I make one of those for my site and how can I have it show the stats I want in the place I want and making it have my logo and stuff.

Max

PS: I use phpnuke 7.7 patched 3.0 by chatserv
 
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce



Joined:
Posts: 5661

PostPosted: Fri Jun 17, 2005 2:35 pm Reply with quote

Well i also use one..never saw it?
Anyway use the below code...
create your own image...>>>image/png
Copy below code,put it in a file called signature.php..
Then put it in your root and call it as an image...


Code:


require_once("mainfile.php");
global $prefix, $startdate, $db;

list($count) = $db->sql_fetchrow($db->sql_query("SELECT count FROM ".$prefix."_counter WHERE type='total' AND var='hits'"));
list($sitename) = $db->sql_fetchrow($db->sql_query("SELECT sitename FROM ".$prefix."_config"));
list($overall) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$prefix."_users"));
list($lastuser) = $db->sql_fetchrow($db->sql_query("SELECT username FROM ".$prefix."_users order by user_id DESC limit 0,1"));
list($member_online_num) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$prefix."_session WHERE guest = 0"));
list($guest_online_num) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$prefix."_session WHERE guest = 1"));
$who_online_num = $guest_online_num + $member_online_num;
$image = "signature.png";
$im = imagecreatefrompng($image);
$tc = ImageColorAllocate ($im, 5, 50, 250);  // Blue
$now = date("M d,Y H:i:s");
$red  = ImageColorAllocate ($im, 255, 0, 0);
$j = strlen($lastuser);
$space = $j*6+240;
ImageString($im, 3, 140, 5, "$sitename Live! $now", $tc);
ImageString($im, 2, 140, 17, "We received $count page views since $startdate.", $tc);
ImageString($im, 2, 140, 30, "Total Members: $overall", $tc);
ImageString($im, 2, $space, 30, "Latest: $lastuser", $red);
ImageString($im, 2, 140, 40, "Online Now($who_online_num): $member_online_num members and $guest_online_num visitors.", $tc);
header("Content-Type: image/png");
Imagepng($im,'',100);
ImageDestroy ($im);

 
View user's profile Send private message
m-weisel2







PostPosted: Fri Jun 17, 2005 3:32 pm Reply with quote

do I need tags like <?php
 
hitwalker







PostPosted: Fri Jun 17, 2005 3:35 pm Reply with quote

yes... Smile
 
m-weisel2







PostPosted: Fri Jun 17, 2005 3:51 pm Reply with quote

so give me the full code and how can I rearrange it and where exactly do I put what image?
 
hitwalker







PostPosted: Fri Jun 17, 2005 3:56 pm Reply with quote

hi m-weisel2,

you got the full code.
just add the <? at the beginning and end with ?>
Thats all...
The image to be used is shown in the code at bottom...

in images folder,use a png image,and the image should be called as an gif.
the file is called signature.php but called as signature.gif
 
Manuel
Regular
Regular



Joined: May 28, 2005
Posts: 90

PostPosted: Sat Jun 18, 2005 8:19 am Reply with quote

list($overall) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$prefix."_users WHERE user_id > 1"));

or

list($overall) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$prefix."_users WHERE username IS NOT 'Anonymous'"));

_________________
Image 
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
djmaze
Subject Matter Expert



Joined: May 15, 2004
Posts: 727
Location: http://tinyurl.com/5z8dmv

PostPosted: Sat Jun 18, 2005 9:27 am Reply with quote

none of them

$result = $db->sql_query("SELECT COUNT(*) FROM ".$prefix."_users WHERE user_id > 1 AND user_level > 0 AND user_active > 1");
list($overall) = $db->sql_fetchrow($result);

Else all suspended and deleted accounts are also show, good way to fake members though.
 
View user's profile Send private message Visit poster's website
hitwalker







PostPosted: Sat Jun 18, 2005 9:30 am Reply with quote

oh you guys are adding or changing code...lol
nice,but i dont use the above code,i have a different one.
The above is the simple one the reads from phpbb and comes from thainuke.
 
Manuel







PostPosted: Sat Jun 18, 2005 9:36 am Reply with quote

ok... you see that i use a personal code, if you want just ask Smile
 
hitwalker







PostPosted: Sat Jun 18, 2005 9:38 am Reply with quote

well you can just as well post it,it might help others.. Smile
 
Manuel







PostPosted: Sat Jun 18, 2005 9:47 am Reply with quote

Code:


<?

   /*
   # firma.php by Manuel                                                #
   # Copyright (c) 2005 by UltraDigital.it                              #
   # http://www.ultradigital.it                                         #
   # Last update: 18/06/2005                                            #
   #                                                                   */

   require_once('mainfile.php');
   global $db, $prefix, $user, $multilingual;
   
   $at = $db->sql_numrows($db->sql_query("SELECT sid FROM ".$prefix."_stories"));
   $at = number_format($at, 0, ',', '.');

   if ($multilingual == 1) {
      $querylang = "WHERE planguage='$currentlang' AND artid='0'";
   } else {
      $querylang = "WHERE artid='0'";
   }   
   $tmp = $db->sql_fetchrow($db->sql_query("SELECT pollID FROM ".$prefix."_poll_desc $querylang ORDER BY pollID DESC LIMIT 1"));
   $pollID = intval($tmp['pollID']);
   $tmp = $db->sql_fetchrow($db->sql_query("SELECT pollTitle, voters FROM ".$prefix."_poll_desc WHERE pollID='$pollID'"));
    $pollTitle = $tmp['pollTitle'];
    $voters = number_format(intval($tmp['voters']), 0, ',', '.');

   $ts = $db->sql_numrows($db->sql_query("SELECT pollID FROM ".$prefix."_poll_desc"));
   $ts = number_format($ts, 0, ',', '.');
   $tmp = $db->sql_fetchrow($db->sql_query("SELECT SUM(optionCount) as VotiTot FROM ".$prefix."_poll_data"));
   $vt = $tmp['VotiTot']; $vt = number_format($vt, 0, ',', '.');
   
   $tmp =  $db->sql_fetchrow($db->sql_query("SELECT count FROM ".$prefix."_counter WHERE type='total' AND var='hits'", $db));
   $pv = number_format($tmp['count'], 0, ',', '.');
   $tot = $db->sql_numrows($db->sql_query("SELECT user_id FROM ".$prefix."_users")) - 1;   
   $tot = number_format($tot, 0, ',', '.');
   $ris = $db->sql_query("SELECT * FROM ".$prefix."_session");
   $nonline = $db->sql_numrows($ris);
   $nonline = number_format($nonline, 0, ',', '.');
   
   $nt = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_bbtopics"));
   $np = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_bbposts"));
   $tmp = $db->sql_query("SELECT topic_views, topic_replies, topic_vote FROM ".$prefix."_bbtopics");
   while ($tr = $db->sql_fetchrow($tmp)) {
      $nv += $tr['topic_views'];
      $nr += $tr['topic_replies'];
   }
   $ns = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_bbvote_desc"));
   
   $tmp = $db->sql_query("SELECT vote_result FROM ".$prefix."_bbvote_results");
   while ($tr = $db->sql_fetchrow($tmp)) $nvo += $tr['vote_result'];
   $pc = round(($nr*100)/$np,2); $nm = number_format($nm, 0, ',', '.');
   $nm = $db->sql_numrows($db->sql_query("SELECT user_id FROM ".$prefix."_users")) - 1;
   $nt = number_format($nt, 0, ',', '.'); $np = number_format($np, 0, ',', '.');
   $nr = number_format($nr, 0, ',', '.'); $nv = number_format($nv, 0, ',', '.');
   $ns = number_format($ns, 0, ',', '.'); $nvo = number_format($nvo, 0, ',', '.');
   
   if (is_user($user)) {
      if (!is_array($user)) {
         $tmpuser = addslashes($user);
         $tmpuser = base64_decode($tmpuser);
         $tmpuser = explode(":", $tmpuser);
         $uid = "$tmpuser[0]";
      } else {
         $uid = "$user[0]";
      }
      $uid = addslashes($uid);
      $uid = intval($uid);
      $sql = "SELECT username FROM ".$prefix."_users WHERE user_id='$uid'";
      if ($result = $db->sql_query($sql)) {
         $tmp = $db->sql_fetchrow($result);
         $uname = $tmp[username];
         $tmp = $db->sql_fetchrow($db->sql_query("SELECT user_rank FROM ".$prefix."_users WHERE username='$uname'", $db));
         $urank = $tmp['user_rank'];
         $tmp = $db->sql_fetchrow($db->sql_query("SELECT rank_title FROM ".$prefix."_bbranks WHERE rank_id='$urank'", $db));      
         $tipo = $tmp['rank_title'];
      } else {
         $uname = ""; $tipo = "Anonimo";
      }
   } else {
      $uname = ""; $tipo = "Anonimo";
   }
   
   $nf = $db->sql_numrows($db->sql_query("select * from ".$prefix."_downloads_downloads"));
   $tmp = $db->sql_query("select hits from ".$prefix."_downloads_downloads");
   while (list($hits) = sql_fetch_row($tmp, $db)) $dw += $hits;
    $tmp = $db->sql_query("select sum(filesize*hits) as serv from ".$prefix."_downloads_downloads");
    while (list($serv) = sql_fetch_row($tmp)) $served = $serv;
    $gb = 1024*1024*1024; $mb = 1024*1024; $kb = 1024;
    if ($served >= $gb){
        $tr = sprintf ("%01.2f",$served/$gb) . " Gb";
    } elseif ($served >= $mb) {
        $tr = sprintf ("%01.2f",$served/$mb) . " Mb";
    } elseif ($served >= $kb) {
        $tr = sprintf ("%01.2f",$served/$kb) . " Kb";
    } else{
        $tr = $served . " Bytes";
    }
   $nf = number_format($nf, 0, ',', '.'); $dw = number_format($dw, 0, ',', '.');
   
   $tmp = $db->sql_fetchrow($db->sql_query("SELECT count FROM ".$prefix."_counter WHERE type='firma' AND var='imp'", $db));
   $if = $tmp['count'] + 1;
   $db->sql_query("UPDATE ".$prefix."_counter SET count = '$if' WHERE type='firma' AND var='imp'", $db);
   $if = number_format($if, 0, ',', '.');

    $image = imagecreatefrompng("images/firma.png");
    $colore_titolo = imagecolorallocate($image, 255, 255, 255);
    $colore_subtit = imagecolorallocate($image, 0, 255, 0);
   $titolo = "ULTRADIGITAL - LIVESTATS!"; $subtit = "<< $uname - $tipo >>";
   $dim_titolo = 6; $font_titolo = 'titolo.ttf';
   $dim_subtit = 6; $font_subtit = 'default.ttf';

    header("Content-type: image/png");
   
   $arr_null = array(0);

   imagefttext($image, $dim_titolo, 0, 60, 10, $colore_titolo, $font_titolo, $titolo, $arr_null);
   //imagestring($image, $font, 60, 2, $titolo, $colore_titolo);

   if ($uname <> "") imagefttext($image, $dim_subtit, 0, 220, 10, $colore_subtit, $font_subtit, $subtit, $arr_null);
   //imagestring($image, $dim_subtit, 260, 2, $subtit, $colore_subtit);

    $colore_testo = imagecolorallocate($image, 77, 174, 241);
   $dim_testo = 6; $font_testo = 'default.ttf';

   $riga0 = "Membri: $nm - OnLine Adesso: $nonline - Visite: $pv - Articoli: $at";
   imagefttext($image, $dim_testo, 0, 60, 25, $colore_testo, $font_testo, $riga0, $arr_null);
   $riga1 = "Sondaggio corrente: '$pollTitle' - Voti: $voters";
   imagefttext($image, $dim_testo, 0, 60, 35, $colore_testo, $font_testo, $riga1, $arr_null);
   $riga2 = "Sondaggi: $ts - Voti Totali: $vt - Nei Forums: $ns - Voti Forums: $nvo";   
   imagefttext($image, $dim_testo, 0, 60, 45, $colore_testo, $font_testo, $riga2, $arr_null);
   $riga3 = "Topics: $nt - Posts: $np - Risposte: $nr ($pc%) - Letture: $nv";   
   imagefttext($image, $dim_testo, 0, 60, 55, $colore_testo, $font_testo, $riga3, $arr_null);
   $riga4 = "Files: $nf - Downloads: $dw - Traffico: $tr";
   imagefttext($image, $dim_testo, 0, 60, 65, $colore_testo, $font_testo, $riga4, $arr_null);

    // imagestring($image, $dim_testo, 60, 17, "Topics $nt | Posts $np | Risposte $nr ($pc%) | Letture $nv", $colore_testo);
   // imagestring($image, $dim_testo, 60, 31, "Membri $nm | OnLine Adesso $nonline | Visite $pv | Sondaggi $ns | Voti $nvo", $colore_testo);
   // imagestring($image, $dim_testo, 60, 45, "Files $nf | Downloads $dw | Traffico $tr", $colore_testo);

   imagefttext($image, $dim_testo, 90, 454, 49, $colore_testo, $font_testo, 'FIRMA N.', $arr_null);
   $dim = imageftbbox($dim_testo, 0, $font_testo, $if, $arr_null);
   $x =  468 - $dim[3] - 6; $y = 30 + $dim[2] / 2;
   imagefttext($image, $dim_testo, 90, $x, $y, $colore_testo, $font_testo, $if, $arr_null);

    imagepng($image);
    imagedestroy($image);

?>



Smile if you use this code please give me some credits Smile

this is a forum related: [ Only registered users can see links on this board! Get registered or login! ]

feel free to ask in english, remember to translate strings in my code obviously
 
hitwalker







PostPosted: Sat Jun 18, 2005 9:49 am Reply with quote

well im happy with the one i use but more and more people want to use it,so it might help them..
 
m-weisel2







PostPosted: Sat Jun 18, 2005 12:11 pm Reply with quote

ok I am a newbie I just want the script to show info from my PHPNUKE site also want someone to tell me an english version I can't translate anything. Can also someone tell me all of the different things I can put on it and how to change placement and text sizes.
 
hitwalker







PostPosted: Sat Jun 18, 2005 12:19 pm Reply with quote

maybe its a good idea to mail member Manuel...and ask if he can translate some italian stuff..
 
benson
Worker
Worker



Joined: May 15, 2004
Posts: 119
Location: Germany

PostPosted: Sat Jun 18, 2005 2:28 pm Reply with quote

Hi,

my signature (strange self made code) works on my HP, but not on my local installation on linux and apache2.
What do I have to set up in apache ? I allways get an error :

Quote:
Die Grafik "http://nuke.basis.local/signature.png" kann nicht angezeigt werden, weil sie Fehler enthält.
'The graphic ... can not be shown because it has errors ...'


If I access to the same file with extension .php it works ...

My .htaccss looks like this:

Code:
<FilesMatch signature.png>

   SetHandler application/x-httpd-php
</FilesMatch>

_________________
Best regards, Norbert

gebiet51.de & fellpartner.de 
View user's profile Send private message Visit poster's website
hitwalker







PostPosted: Sat Jun 18, 2005 2:32 pm Reply with quote

well im not the guru on that,but if its set wrong in your .htaccess then it doesnt work...
i have this...
RewriteRule ^signature.(png|jpg|jpeg|gif) /signature.php
 
benson







PostPosted: Sat Jun 18, 2005 3:50 pm Reply with quote

Hello,

same error with your settings ..

as you can see here, the same file works ! Just if I change the extension to .png I do have the error (on my local system).

hmmmmmmmmmmmmmmmmmm ???
 
m-weisel2







PostPosted: Sat Jun 18, 2005 5:09 pm Reply with quote

ok can someone give me an english page of where everyone found this or a script that has EVERYTHING and when I mean everything I mean all of the info possible so I can remove what I don't want. also how do you set where the text is located on the image.
 
hitwalker







PostPosted: Sat Jun 18, 2005 5:31 pm Reply with quote

Well my advice is dont overdo it...to much isnt funny anymore..

The code like this you see above..


Code:


ImageString($im, 3, 140, 5, "$sitename Live! $now", $tc);
ImageString($im, 2, 140, 17, "We received $count page views since $startdate.", $tc);
ImageString($im, 2, 140, 30, "Total Members: $overall", $tc);
ImageString($im, 2, $space, 30, "Latest: $lastuser", $red);
ImageString($im, 2, 140, 40, "Online Now($who_online_num): $member_online_num members and



You see the rows with numbers?
Well that prints the text where it should be,the possition.

so look at first row like....3, 140, 5...that determines the spaces like from top,left,right..etc..etc..
 
benson







PostPosted: Sun Jun 19, 2005 3:55 am Reply with quote

Hi,

can I change the font used in my signature ?

(I mean not only the build in ones ...)
 
hitwalker







PostPosted: Sun Jun 19, 2005 4:26 am Reply with quote

well i dont know italian but if you look at the code you see things like...fonts...
perhaps you can...
 
benson







PostPosted: Sun Jun 19, 2005 4:31 am Reply with quote

Hi, it should be something like 'imageloadfont' ...
If I could find a hint to use a more aliasing font it would be great !
 
hitwalker







PostPosted: Sun Jun 19, 2005 4:36 am Reply with quote

well if you see font_testo and look for that on google i get 2 results on italian pages where they discuss that..
like .... font_testo { font-family: arial, verdana;
 
benson







PostPosted: Sun Jun 19, 2005 5:06 am Reply with quote

Hi,

I found something:

Code:
<?php

$font = imageloadfont('bmreceipt.gdf');

/* I use .gdf as its extension to represents "GD Fonts" */
/* But, if your server not allow .gdf, you can change it*/
/* to any extension .jpg, .bmp, .txt, .bmf, .etc        */

$fontWidth = imagefontwidth($font);
$fontHeight = imagefontheight($font);
$text = 'Jackdaws Love My Big Sphinx Of Quartz 0123456789';
$im = imagecreate(strlen($text) * $fontWidth, $fontHeight);
$bgColor = imagecolorallocate($im, 255, 255, 255);
$fgColor = imagecolorallocate($im,   0,   0, 255);
imagestring($im, $font, 0, 0, $text, $fgColor);
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>


and I changed my signature Smile Look at the cat on the left side ...

You may find some good fonts here GD Fonts for PHP imageloadfont()
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

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 ©