Advertisement:

Author Topic: signature info stats [no more updates and support]  (Read 160691 times)

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,154
  • Gender: Male
Re: signature info stats
« Reply #100 on: August 13, 2007, 04:28:17 PM »
I have removed both codes and mods completely! The errorlog is unaccessible until I have money to switch hosts which I don't have now. We just need to keep fooling around with stuff (making backups).

Offline sebastian

  • Jr. Member
  • **
  • Posts: 204
  • Gender: Male
Re: signature info stats
« Reply #101 on: August 13, 2007, 05:30:09 PM »
Ok brianjw.

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,154
  • Gender: Male
Re: signature info stats
« Reply #102 on: August 13, 2007, 06:21:17 PM »
Man is this complicated.

Offline GC

  • Full Member
  • ***
  • Posts: 440
  • GamingEvo.com
    • GamingEvo.com
Re: signature info stats
« Reply #103 on: August 14, 2007, 12:32:12 AM »
This must be a full time job :)

My problem is this:
Fatal error: Call to undefined function: imagecreatefrompng() in /home/gctim/public_html/signature_info.php on line 33

I am not using the PNG .htaccess thing because it is messing with the rest of my .PNG files.

My current signature_info.php
Code: [Select]
<?php

if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else
die();

signature();

function 
signature()
{
global 
$context$settings$modSettings$db_prefix$boardurl$boarddir;

$result db_query("
SELECT COUNT(session)
FROM 
{$db_prefix}log_online"__FILE____LINE__);
list ($context['users_online']) = mysql_fetch_row($result);
mysql_free_result($result);

$img_url $settings['default_theme_url']; 
$forum_name $context['forum_name'];
$forum_url $boardurl;
$now forum_time();
$timel date("d-M-Y H:i:s",$now);
$total_members $context['common_stats']['total_members'];
$total_posts $context['common_stats']['total_posts'];
$total_topics $context['common_stats']['total_topics'];
$online_members $context ['users_online'];
$last_member $context['common_stats']['latest_member']['name'];

$image "/images/gcsig_info.png"// or where you want
$im imagecreatefrompng($image); 
$green ImageColorAllocate ($im2312417); 
$blue ImageColorAllocate ($im00255); 
$red ImageColorAllocate ($im25500);
$white ImageColorAllocate ($im255255255);
$black ImageColorAllocate ($im000);
$font $boarddir .'/fonts/gunplay.ttf'// change your font path and name here
 
imagettftext($im1201015$blue$font"$forum_name"); 
imagettftext($im1209431$blue$font"$forum_url");
imagettftext($im1209046$green$font"$timel Local Time");
imagettftext($im1209061$red$font"Total Members : $total_members");
imagettftext($im1209076$red$font"Online Members: $online_members");
imagettftext($im12022076$red$font"Total Posts: $total_posts");
imagettftext($im12022061$red$font"Total Topics: $total_topics");
imagettftext($im1209091$red$font"Latest Member: $last_member ");
 
$php PHP_VERSION
header("Content-Type: image/png");
if (@
version_compare(PHP_VERSION'5.1.0'">="))
  {
  
// if PHP v5.1 ++
  
Imagepng($im,'',9);  
  }
else {
    
Imagepng($im,'',90);
  }  

ImageDestroy ($im); 
}
?>


My file locations:
http://www.glitcherscorner.com/signature_info.php
http://www.glitcherscorner.com/images/gcsig_info.png

My .htaccess is blank.

PHP version     4.4.7

What is wrong? :S

I have tried changing
Code: [Select]
$im = imagecreatefrompng($image);to
Code: [Select]
$im = @imagecreatefrompng($image); but then it only displays a blank page and the img does not show up anywhere. Whats wrong?
« Last Edit: August 14, 2007, 12:35:22 AM by GC »

Offline sebastian

  • Jr. Member
  • **
  • Posts: 204
  • Gender: Male
Re: signature info stats
« Reply #104 on: August 14, 2007, 11:26:04 AM »
This is a GD Library problem. Perhaps GD library is not installed on your server. Check your GD Library.

Admin/Support and Credits/

Support Information
.
.
.
GD version: bundled (2.0.34 compatible)  <-- For Example

Offline GC

  • Full Member
  • ***
  • Posts: 440
  • GamingEvo.com
    • GamingEvo.com
Re: signature info stats
« Reply #105 on: August 14, 2007, 01:10:16 PM »
I was afraid of this :(

I use to have GD on my old server, but i recently switched over. I might have to go and install it later today. Thank you for a fast reply.

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,154
  • Gender: Male
Re: signature info stats
« Reply #106 on: August 14, 2007, 01:17:07 PM »
What about my problem lol?

Offline sebastian

  • Jr. Member
  • **
  • Posts: 204
  • Gender: Male
Re: signature info stats
« Reply #107 on: August 14, 2007, 05:37:29 PM »
...also ssi_examples.php gives the same internal error but ssi_examples.shtml works properly.

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,154
  • Gender: Male
Re: signature info stats
« Reply #108 on: August 14, 2007, 05:56:44 PM »
hmmmm i don't know.

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,154
  • Gender: Male
Re: signature info stats
« Reply #109 on: October 10, 2007, 06:33:28 PM »
Well subastian, just to let you know, I got the past problems solved. ^
I have a paid.or.free request for you if possible. Using functions from smf and some custom mods. How would
Quote
I would love to use a signature thing on my website. I have modified my gamer card and would like it to do something like this:

-Where it says '-Username Here-' it actually displays the members display name (not username).
-Where it says 'Rep' put the total karma (whatever option is set in admin panel) of that member.
-Where it says 'Posts' put the number of posts the member has made on the website.
-Where it says 'Gender' put the image for the male or the female.
-Where it says '-Latest 4 Arcade Games Played-' Put the latest 4 games that the member has played.
-Where you see that avatar, put the members avatar. If they have no avatar display an image that says No Avatar and that goes with the colors of the sig.

It looks like this.


I am willing to pay for this. I would also like this private for my site at the time being

Let me know what you can do with this.
I also would like this sig to be added to their signature automatically when they register and they can take it off if they want. ;)

Also it would be awesome if members could access there signature like this - http://www.gamerzgarage.com/sig.php?u=1 (id)

THANKS SO MUCH :)
Brianjw
« Last Edit: October 10, 2007, 06:38:37 PM by brianjw »

Offline sebastian

  • Jr. Member
  • **
  • Posts: 204
  • Gender: Male
Re: signature info stats
« Reply #110 on: October 10, 2007, 10:25:01 PM »
Hi, brianjw.

You have really great ideas. A couple of thinks first.
I dont want money. I will try to do this tip but this does not guarantee any good result or how long will it take.  Also i would like this free for all people.

Conclusion: search also other solutions.

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,154
  • Gender: Male
Re: signature info stats
« Reply #111 on: October 11, 2007, 08:08:54 AM »
Sounds good :)!
Also do you think you can help me make the image above a little cleaner and nicer.

Offline sebastian

  • Jr. Member
  • **
  • Posts: 204
  • Gender: Male
Re: signature info stats
« Reply #112 on: October 12, 2007, 05:52:44 AM »
Example: Copy sign.png & noavatar.png into default image folder.

Themes/default/images/

Make a file. For example: sign.php
sign.php & ssi.php -> Same Path.

Access signature as
access as
Code: [Select]
[img]http://www.mydomain.com/sign.php?u=x[/img]
http://www.mydomain.com/sign.php?u=x

u=x -> user ID

// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want
$noavatar = "$img_url/images/noavatar.png"; // or where you want
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 0; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++


demo here



For SMF 1.1.x

Code: [Select]
<?php

if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else die();

getinfos();
signature();

function 
getinfos()
{
global 
$context$db_prefix$memberContext;

$mommy '';

if (
$_GET['u'] >= 1)
    
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();

$result db_query("
SELECT memberName
FROM 
{$db_prefix}members
WHERE ID_MEMBER = " 
. (int) $id_mem "
AND is_activated = 1
LIMIT 1"
__FILE____LINE__);

     if (
db_affected_rows($result) > 0)  
{

 $mprofile[] = (int) $id_mem;

loadMemberData($mprofilefalse'profile');

foreach ($mprofile as $profile)
{
loadMemberContext($profile);


$context['item_comms'] = array();

$context['item_comms'][] = array(
    'lbuser' => $memberContext[$id_mem]
);

foreach ($context['item_comms'] as $item_comm)
    {
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
    
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
    }

} else die();


  
$mommy = isset($context['avatar']) ? $context['avatar'] : ''
  
$mommy preg_split('/;/',$mommy, -1PREG_SPLIT_OFFSET_CAPTURE);
  
$mommy $mommy [1][0];
  
$mommy trim(substr(strrchr($mommy'='), 1));

$result2 db_query("
SELECT filename
FROM 
{$db_prefix}attachments
WHERE ID_ATTACH = " 
. (int) $mommy "
LIMIT 1"
__FILE____LINE__);

     if (
db_affected_rows($result2) > 0)  
 {

 $context['avatar_sign_id'] = array();
    while (
$row_items mysql_fetch_assoc($result2))
{

$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
    
}  

foreach ($context['avatar_sign_id'] as $avatar_item)
{
  $context['filename_avatar'] = $avatar_item['filename'];
}

  } 
unset($mommy);

mysql_free_result($result);
mysql_free_result($result2);

 }


function 
signature()
{
global 
$context$settings$modSettings$db_prefix;

$lemo '';
$img_url $settings['default_theme_url']; 

$membername $context['membername'];
$posts $context['posts'];

    if (
$context['filename_avatar'] != ''
     {
       
$lemo $context['filename_avatar'];
     }
    else {
       
$lemo '';
     } 

$avatar $context['avatar'];
$gender $context['gender'];

if (
preg_match'/Male/'$gender))
{
    
$gender "male";
$img_gender "$img_url/images/Male.gif";

elseif (
preg_match'/Female/'$gender)) {
    
$gender "female";
    
$img_gender "$img_url/images/Female.gif"; }
else {
$gender "n/a"$img_gender "$img_url/images/star.gif";}

$karmaBad $context['karmaBad'];
$karmaGood $context['karmaGood'];   
if (
$modSettings['karmaMode'] == '1'

$karma $karmaGood $karmaBad;
} elseif (
$modSettings['karmaMode'] == '2')
{
$karma '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif (
$modSettings['karmaMode'] == '0'
{
$karma 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++ 
$backimg "$img_url/images/sign.png"// or where you want 
$noavatar "$img_url/images/noavatar.png"// or where you want 
$set_avatar_height 0//move avatar up/down
$set_avatar_width 0//move avatar left/right
$set_gender_style 0// 0 text , 1 image
$set_gender_height = -92//move gender up/down
$set_gender_width = -230//move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++

if ($avatar != '') {$avatar $avatar;}
else {
$avatar $noavatar;}

if (
$lemo != '') { $ext substr(strrchr($lemo'.'), 1); }
else {
$ext substr(strrchr($avatar'.'), 1);}

unset(
$lemo);

if (
$ext == 'png') {$img_bgr imagecreatefrompng($avatar); }
elseif (
$ext == 'jpg') {$img_bgr imagecreatefromjpeg($avatar); }
elseif (
$ext == 'gif') {$img_bgr imagecreatefromgif($avatar); }
else die();

$size getimagesize($backimg);

if (
$set_gender_style == 1) {
$img_bgr_gender imagecreatefromgif($img_gender);
$image_width_gender imagesx($img_bgr_gender);  
$image_height_gender imagesy($img_bgr_gender);
$dest_x_gender $size[0] - $image_width_gender $set_gender_width;  
$dest_y_gender $size[1] - $image_height_gender $set_gender_height;
}

$image_width imagesx($img_bgr);  
$image_height imagesy($img_bgr);

//______________avatar  width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
  {
$set_avatar_width =  $set_avatar_width + (($image_width 101) * 0.35);
$set_avatar_height =  $set_avatar_height + (($image_height 101) * 0.35);
 }
else { die();}

$image imagecreatetruecolor($image_width$image_height); 
$image imagecreatefrompng($backimg);  

$dest_x $size[0] - $image_width $set_avatar_width;  
$dest_y $size[1] - $image_height $set_avatar_height
imagecopymerge($image$img_bgr,  $dest_x$dest_y00$image_width$image_height100);
if (
$set_gender_style == 1) {
imagecopymerge($image$img_bgr_gender,  $dest_x_gender$dest_y_gender00$image_width_gender$image_height_gender100);
}
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

 
ImageString($image42035"Posts: $posts"$black);
ImageString($image42051"Karma: $karma"$black);
if (
$set_gender_style == 0) {
ImageString($image5314"$membername"$black);
ImageString($image42066"Genter: $gender"$black);
} else {
ImageString($image5444"$membername"$black);}

header("Content-Type: image/png"); 

$php PHP_VERSION
if (@
version_compare(PHP_VERSION'5.1.0'">="))
  {
  
// if PHP v5.1 ++
Imagepng($image,null,9,null); 
  }
else {
Imagepng($image,null,90,null); 
  }    
ImageDestroy ($image);
ImageDestroy ($img_bgr);  
}


?>


For SMF 2.x.x

Code: [Select]
<?php

if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(
dirname(__FILE__) . '/SSI.php');
}
else die();

getinfos();
signature();

function 
getinfos()
{
global 
$smcFunc$context$memberContext;

$mommy '';

if (
$_GET['u'] >= 1)
    
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();

    
$result $smcFunc['db_query']('''
        SELECT member_name
        FROM {db_prefix}members
        WHERE id_member = '
. (int) $id_mem.' AND is_activated = 1
        LIMIT 1
        '
,
        array()
    );

     if (
$smcFunc['db_fetch_row']($result) > 0)  
{

 
$mprofile[] = (int) $id_mem;

loadMemberData($mprofilefalse'profile');

foreach (
$mprofile as $profile)
{
loadMemberContext($profile);


$context['item_comms'] = array();

$context['item_comms'][] = array(
    
'lbuser' => $memberContext[$id_mem]
);

foreach (
$context['item_comms'] as $item_comm)
    {
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
    }

} else die();

if (!empty(
$context['avatar']))
  {
  
$mommy = !empty($context['avatar']) ? $context['avatar'] : ''
  
$mommy preg_split('/;/',$mommy, -1PREG_SPLIT_OFFSET_CAPTURE);
  
$mommy $mommy [1][0];
  
$mommy trim(substr(strrchr($mommy'='), 1));

$result2 $smcFunc['db_query']('','
SELECT filename
FROM {db_prefix}attachments
WHERE id_attach = ' 
. (int) $mommy ' AND attachment_type = 0 AND approved = 1
LIMIT 1'
,
array()
);

list(
$count_result) = $smcFunc['db_fetch_row']($result2);

   
$context['filename_avatar'] = $count_result;
   
$smcFunc['db_free_result']($result2);
      
  }
  
  
$smcFunc['db_free_result']($result);
 }
 

function 
signature()
{
global 
$context$settings$modSettings;

$lemo '';
$img_url $settings['default_theme_url']; 

$membername $context['membername'];
$posts $context['posts'];

    if (!empty(
$context['filename_avatar'])) 
     {
       
$lemo $context['filename_avatar'];
     }
    else {
       
$lemo '';
     } 

$avatar $context['avatar'];
$gender $context['gender'];

if (
preg_match'/Male/'$gender))
{
    
$gender "male";
$img_gender "$img_url/images/Male.gif";

elseif (
preg_match'/Female/'$gender)) {
    
$gender "female";
    
$img_gender "$img_url/images/Female.gif"; }
else {
$gender "n/a"$img_gender "$img_url/images/star.gif";}

$karmaBad $context['karmaBad'];
$karmaGood $context['karmaGood'];   
if (
$modSettings['karmaMode'] == '1'

$karma $karmaGood $karmaBad;
} elseif (
$modSettings['karmaMode'] == '2')
{
$karma '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif (
$modSettings['karmaMode'] == '0'
{
$karma 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++ 
$backimg "$img_url/images/sign.png"// or where you want 
$noavatar "$img_url/images/noavatar.png"// or where you want
$set_avatar_height 0//move avatar up/down
$set_avatar_width 0//move avatar left/right
$set_gender_style 0// 0 text , 1 image
$set_gender_height = -92//move gender up/down
$set_gender_width = -230//move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++

if (!empty($avatar)) {$avatar $avatar;}
else {
$avatar $noavatar;}

if (!empty(
$lemo)) { $ext substr(strrchr($lemo'.'), 1); }
else {
$ext substr(strrchr($avatar'.'), 1);}

unset(
$lemo);

if (
$ext == 'png') {$img_bgr imagecreatefrompng($avatar); }
elseif (
$ext == 'jpg') {$img_bgr imagecreatefromjpeg($avatar); }
elseif (
$ext == 'gif') {$img_bgr imagecreatefromgif($avatar); }
else die();

$size getimagesize($backimg);

if (
$set_gender_style == 1) {
$img_bgr_gender imagecreatefromgif($img_gender);
$image_width_gender imagesx($img_bgr_gender);  
$image_height_gender imagesy($img_bgr_gender);
$dest_x_gender $size[0] - $image_width_gender $set_gender_width;  
$dest_y_gender $size[1] - $image_height_gender $set_gender_height;
}

$image_width imagesx($img_bgr);  
$image_height imagesy($img_bgr);

//______________avatar  width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
  {
$set_avatar_width =  $set_avatar_width + (($image_width 101) * 0.35);
$set_avatar_height =  $set_avatar_height + (($image_height 101) * 0.35);
 }
else { die();}

$image imagecreatetruecolor($image_width$image_height); 
$image imagecreatefrompng($backimg);  

$dest_x $size[0] - $image_width $set_avatar_width;  
$dest_y $size[1] - $image_height $set_avatar_height
imagecopymerge($image$img_bgr,  $dest_x$dest_y00$image_width$image_height100);
if (
$set_gender_style == 1) {
imagecopymerge($image$img_bgr_gender,  $dest_x_gender$dest_y_gender00$image_width_gender$image_height_gender100);
}
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

ImageString($image42035"Posts: $posts"$black);
ImageString($image42051"Karma: $karma"$black);
if (
$set_gender_style == 0) {
ImageString($image5314"$membername"$black);
ImageString($image42066"Genter: $gender"$black);
} else {
ImageString($image5444"$membername"$black);}

header("Content-Type: image/png"); 

$php PHP_VERSION
if (@
version_compare(PHP_VERSION'5.1.0'">="))
  {
  
// if PHP v5.1 ++
Imagepng($image,null,9,null); 
  }
else {
Imagepng($image,null,90,null); 
  }    
ImageDestroy ($image);
ImageDestroy ($img_bgr);  
}


?>
« Last Edit: November 05, 2008, 07:30:13 PM by sebastian »

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,154
  • Gender: Male
Re: signature info stats [new features]
« Reply #113 on: October 13, 2007, 02:16:28 PM »
I am getting a blank page while accessing - http://www.gamerzgarage.com/sig.php?u=1
I didn't change anything out of the file. I have uploaded the images to the default/images.

brianjw

Offline sebastian

  • Jr. Member
  • **
  • Posts: 204
  • Gender: Male
Re: signature info stats [new features]
« Reply #114 on: October 13, 2007, 03:42:26 PM »
Εrror occurred. There is 7 die().

Make a file & run like sign_error.php?u=1

Code: [Select]
<?php

if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else { echo 
'No SSI'; die(); }

error_reporting(E_ALL E_NOTICE);

getinfos();
signature();

function 
getinfos()
{
global 
$context$db_prefix$memberContext;

$mommy '';
$context['error_sign'] = '';

if (
$_GET['u'] >= 1)
    
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : $context['error_sign'] = 'No ID';
else 
$context['error_sign'] = 'No ID';

$result db_query("
SELECT memberName
FROM 
{$db_prefix}members
WHERE ID_MEMBER = " 
. (int) $id_mem "
AND is_activated = 1
LIMIT 1"
__FILE____LINE__);

     if (
db_affected_rows($result) > 0)  
{

 $mprofile[] = (int) $id_mem;

loadMemberData($mprofilefalse'profile');

foreach ($mprofile as $profile)
{
loadMemberContext($profile);


$context['item_comms'] = array();

$context['item_comms'][] = array(
    'lbuser' => $memberContext[$id_mem]
);

foreach ($context['item_comms'] as $item_comm)
    {
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
    
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
    }
} else { 
$context['error_sign'] = 'No member ID';}

  
$mommy = isset($context['avatar']) ? $context['avatar'] : ''
  
$mommy preg_split('/;/',$mommy, -1PREG_SPLIT_OFFSET_CAPTURE);
  
$mommy $mommy [1][0];
  
$mommy trim(substr(strrchr($mommy'='), 1));

$result2 db_query("
SELECT filename
FROM 
{$db_prefix}attachments
WHERE ID_ATTACH = " 
. (int) $mommy "
LIMIT 1"
__FILE____LINE__);

     if (
db_affected_rows($result2) > 0)  
 {

 $context['avatar_sign_id'] = array();
    while (
$row_items mysql_fetch_assoc($result2))
{

$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
    
}  

foreach ($context['avatar_sign_id'] as $avatar_item)
{
  $context['filename_avatar'] = $avatar_item['filename'];
}

  } 
unset($mommy);

mysql_free_result($result);
mysql_free_result($result2);
 }


function 
signature()
{
global 
$context$settings$modSettings$db_prefix;

$lemo '';
$img_url $settings['default_theme_url']; 

$membername $context['membername'];
$posts $context['posts'];

    if (
$context['filename_avatar'] != ''
     {
       
$lemo $context['filename_avatar'];
     }
    else {
       
$lemo '';
     } 

$avatar $context['avatar'];
$gender $context['gender'];

if (
preg_match'/Male/'$gender))
{
    
$gender "male";

elseif (
preg_match'/Female/'$gender)) {
    
$gender "female"; }
else {
$gender "n/a";}

$karmaBad $context['karmaBad'];
$karmaGood $context['karmaGood'];   
if (
$modSettings['karmaMode'] == '1'

$karma $karmaGood $karmaBad;
} elseif (
$modSettings['karmaMode'] == '2')
{
$karma '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif (
$modSettings['karmaMode'] == '0'
{
$karma 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++Don't  SAVE your images as  web & devices / images must be .png 
$backimg "$img_url/images/sign.png"// or where you want -> http://www.yourdomain.com/Themes/Default/images/sign.png
$noavatar "$img_url/images/noavatar.png"// or where you want -> http://www.yourdomain.com/Themes/Default/images/noavatar.png
$set_avatar_height 0//move avatar up/down
$set_avatar_width 0//move avatar left/right
// Your settings +++++++++++++++++++++++++++++++++++

//$backimg = checkurl($backimg);
//$noavatar = checkurl($noavatar);

if ($avatar != '') {$avatar $avatar;}
else {
$avatar $noavatar;}

if (
$lemo != '') { $ext substr(strrchr($lemo'.'), 1); }
else {
$ext substr(strrchr($avatar'.'), 1);}

unset(
$lemo);

if (
$ext == 'png') {$img_bgr imagecreatefrompng($avatar); }
elseif (
$ext == 'jpg') {$img_bgr imagecreatefromjpeg($avatar); }
elseif (
$ext == 'gif') {$img_bgr imagecreatefromgif($avatar); }
else { echo 
'No extension'; die();}

$image_width imagesx($img_bgr);  
$image_height imagesy($img_bgr);

//______________avatar  width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
  {
$set_avatar_width =  $set_avatar_width + (($image_width 101) * 0.35);
$set_avatar_height =  $set_avatar_height + (($image_height 101) * 0.35);
 }
else { echo 
'Wrong width/height'; die();}

$image imagecreatetruecolor($image_width$image_height); 

$image imagecreatefrompng($backimg); 
$size getimagesize($backimg); 
$dest_x $size[0] - $image_width $set_avatar_width;  
$dest_y $size[1] - $image_height $set_avatar_height
imagecopymerge($image$img_bgr,  $dest_x$dest_y00$image_width$image_height100);
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

if (
$context['error_sign'] == '') { $error 'No errors'; } else {
$error $context['error_sign']; }

ImageString($image5334"$membername"$black); 
ImageString($image42035"Posts: $posts"$black);
ImageString($image42051"Gender: $gender"$black);
ImageString($image42066"Karma: $karma"$black);
ImageString($image42086"Error: $error"$black);

header("Content-Type: image/png"); 

$php PHP_VERSION
if (@
version_compare(PHP_VERSION'5.1.0'">="))
  {
  
// if PHP v5.1 ++
Imagepng($image,'',9); 
  }
else {
Imagepng($image,'',90); 
  }    
ImageDestroy ($image);
ImageDestroy ($img_bgr);  
}

function 
checkurl($url)
{
  
$getHeaders = @get_headers($url);
  if (
preg_match("|200|"$getHeaders[0])) {
  return 
$url;
  unset(
$getHeaders);
  } else {  echo 
'File not exist'; die();}

}
?>
« Last Edit: October 17, 2007, 01:18:49 AM by sebastian »

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,154
  • Gender: Male
Re: signature info stats [new features]
« Reply #115 on: October 13, 2007, 08:47:32 PM »
I used your code, saved it as sign_error.php
then went to http://www.gamerzgarage.com/sign_error.php?u=1 and yet.. it still is blank.. :(

Any other ideas?

Offline sebastian

  • Jr. Member
  • **
  • Posts: 204
  • Gender: Male
Re: signature info stats [new features]
« Reply #116 on: October 13, 2007, 10:04:22 PM »
...well your server again...
Try my sign.png file. Re upload the updated sign_error.php <-- check

... next delete all the die();  functions. <-- check

... next delete 2 lines <-- check
$backimg = checkurl($backimg);
$noavatar = checkurl($noavatar);

... original sign.php file also updated
« Last Edit: October 13, 2007, 11:02:51 PM by sebastian »

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,154
  • Gender: Male
Re: signature info stats [new features]
« Reply #117 on: October 14, 2007, 12:46:19 AM »
Ok, last problems - It is working except the errors are showing on the card like the image below:

I would also like to know how to make it so it shows the ™ properly (unlike image above). Also how to make images be transparent when they are supposed to be ;) (background). How would I make it show the "image" of the male/female other than the word. And How would I add the arcade part of it like I posted/requested above.

Here is my code:
Code: [Select]
<?php

if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else { echo 
'No SSI'; }

error_reporting(E_ALL E_NOTICE);

getinfos();
signature();

function 
getinfos()
{
global 
$context$db_prefix$memberContext;

$mommy '';
$context['error_sign'] = '';

if (
$_GET['u'] >= 1)
    
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : $context['error_sign'] = 'No ID';
else 
$context['error_sign'] = 'No ID';

$result db_query("
SELECT memberName
FROM 
{$db_prefix}members
WHERE ID_MEMBER = " 
. (int) $id_mem "
AND is_activated = 1
LIMIT 1"
__FILE____LINE__);

     if (
db_affected_rows($result) > 0)  
{

 $mprofile[] = (int) $id_mem;

loadMemberData($mprofilefalse'profile');

foreach ($mprofile as $profile)
{
loadMemberContext($profile);


$context['item_comms'] = array();

$context['item_comms'][] = array(
    'lbuser' => $memberContext[$id_mem]
);

foreach ($context['item_comms'] as $item_comm)
    {
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['good'];
    
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
    }
} else { 
$context['error_sign'] = 'No member ID';}

  
$mommy = isset($context['avatar']) ? $context['avatar'] : ''
  
$mommy preg_split('/;/',$mommy, -1PREG_SPLIT_OFFSET_CAPTURE);
  
$mommy $mommy [1][0];
  
$mommy trim(substr(strrchr($mommy'='), 1));

$result2 db_query("
SELECT filename
FROM 
{$db_prefix}attachments
WHERE ID_ATTACH = " 
. (int) $mommy "
LIMIT 1"
__FILE____LINE__);

     if (
db_affected_rows($result2) > 0)  
 {

 $context['avatar_sign_id'] = array();
    while (
$row_items mysql_fetch_assoc($result2))
{

$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
    
}  

foreach ($context['avatar_sign_id'] as $avatar_item)
{
  $context['filename_avatar'] = $avatar_item['filename'];
}

  } 
unset($mommy);

mysql_free_result($result);
mysql_free_result($result2);
 }


function 
signature()
{
global 
$context$settings$modSettings$db_prefix;

$lemo '';
$img_url $settings['default_theme_url']; 

$membername $context['membername'];
$posts $context['posts'];

    if (
$context['filename_avatar'] != ''
     {
       
$lemo $context['filename_avatar'];
     }
    else {
       
$lemo '';
     } 

$avatar $context['avatar'];
$gender $context['gender'];

if (
preg_match'/Male/'$gender))
{
    
$gender "male";

elseif (
preg_match'/Female/'$gender)) {
    
$gender "female"; }
else {
$gender "n/a";}

$karmaBad $context['karmaBad'];
$karmaGood $context['karmaGood'];   
if (
$modSettings['karmaMode'] == '1'

$karma $karmaGood $karmaBad;
} elseif (
$modSettings['karmaMode'] == '2')
{
$karma '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif (
$modSettings['karmaMode'] == '0'
{
$karma 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++Don't  SAVE your images as  web & devices / images must be .png 
$backimg "$img_url/images/sign.png"// or where you want -> http://www.yourdomain.com/Themes/Default/images/sign.png
$noavatar "$img_url/images/noavatar.png"// or where you want -> http://www.yourdomain.com/Themes/Default/images/noavatar.png
$set_avatar_height 0//move avatar up/down
$set_avatar_width 0//move avatar left/right
// Your settings +++++++++++++++++++++++++++++++++++

//$backimg = checkurl($backimg);
//$noavatar = checkurl($noavatar);

if ($avatar != '') {$avatar $avatar;}
else {
$avatar $noavatar;}

if (
$lemo != '') { $ext substr(strrchr($lemo'.'), 1); }
else {
$ext substr(strrchr($avatar'.'), 1);}

unset(
$lemo);

if (
$ext == 'png') {$img_bgr imagecreatefrompng($avatar); }
elseif (
$ext == 'jpg') {$img_bgr imagecreatefromjpeg($avatar); }
elseif (
$ext == 'gif') {$img_bgr imagecreatefromgif($avatar); }
else { echo 
'No extension'; }

$image_width imagesx($img_bgr);  
$image_height imagesy($img_bgr);

//______________avatar  width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
  {
$set_avatar_width =  $set_avatar_width + (($image_width 101) * 0.35);
$set_avatar_height =  $set_avatar_height + (($image_height 101) * 0.35);
 }
else { echo 
'Wrong width/height'; }

$image imagecreatetruecolor($image_width$image_height); 

$image imagecreatefrompng($backimg); 
$size getimagesize($backimg); 
$dest_x $size[0] - $image_width $set_avatar_width;  
$dest_y $size[1] - $image_height $set_avatar_height
imagecopymerge($image$img_bgr,  $dest_x$dest_y00$image_width$image_height100);
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

if (
$context['error_sign'] == '') { $error 'No errors'; } else {
$error $context['error_sign']; }

ImageString($image5334"$membername"$black); 
ImageString($image42035"Posts: $posts"$black);
ImageString($image42051"Genter: $gender"$black);
ImageString($image42066"Karma: $karma"$black);
ImageString($image42086"Error: $error"$black);

header("Content-Type: image/png"); 

$php PHP_VERSION
if (@
version_compare(PHP_VERSION'5.1.0'">="))
  {
  
// if PHP v5.1 ++
Imagepng($image,'',9); 
  }
else {
Imagepng($image,'',90); 
  }    
ImageDestroy ($image);
ImageDestroy ($img_bgr);  
}

function 
checkurl($url)
{
  
$getHeaders = @get_headers($url);
  if (
preg_match("|200|"$getHeaders[0])) {
  return 
$url;
  unset(
$getHeaders);
  } else {  echo 
'File not exist'; }

}
?>


Offline sebastian

  • Jr. Member
  • **
  • Posts: 204
  • Gender: Male
Re: signature info stats [new features]
« Reply #118 on: October 14, 2007, 03:34:40 AM »
Ok, last problems - It is working except the errors are showing on the card like the image below:

What happen with updated sign.php? sign_error.php its only for tracing errors.

Also how to make images be transparent when they are supposed to be ;) (background)

Yes they are supposed to be transparent. Save as WEB / PNG-8 / NO-DITHER / 256 COLORS / .

How would I make it show the "image" of the male/female other than the word

sign.php updated
$set_gender_style = 1; // 0 text , 1 image


I would also like to know how to make it so it shows the ™ properly (unlike image above).

Like this ?


And How would I add the arcade part of it like I posted/requested above.

Did You mean SMF Arcade?
« Last Edit: October 14, 2007, 09:05:33 AM by sebastian »

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,154
  • Gender: Male
Re: signature info stats [new features]
« Reply #119 on: October 14, 2007, 10:24:13 AM »
sign.php updated
$set_gender_style = 1; // 0 text , 1 image
I have updated sign.php with that code and it displays blank :(
Like this ?

I ment showing the TM symbol correctly. ;)

Did You mean SMF Arcade?
Yes :)