Page 1 of 1

phpbb php sig

Posted: Mon Mar 28, 2005 8:31 am
by sru
Could anyone give an example of an php image script that i can use in the bbcode at phpbb forums?? Cause i followed some tutorials and it still doesn't work here is the image:
Image
Firefox even says in the title that it is an image!!!!

anywayhere is the code:

.htaccess:

Code: Select all

AddType application/x-httpd-php .png
sig.php:

Code: Select all

<?php

//db info
$db = "******";
$user_ip = $_SERVER['REMOTE_ADDR'];
$curr_page = $_SERVER['REQUEST_URI'];


//databse connect and getting info

$link = mysql_connect("*****", "******", "*****");
mysql_select_db("*****", $link);
$result = mysql_query("SELECT * FROM phpbb_users", $link);
$num_rows = mysql_num_rows($result);
$num_rows -= 1;

//2nd
$result2 = mysql_query("SELECT * FROM phpbb_topics", $link);
$num_rows2 = mysql_num_rows($result2);

//3d
$result3 = mysql_query("SELECT * FROM phpbb_posts", $link);
$num_rows3 = mysql_num_rows($result3);

//create image
$string = "SRU Designs forum status:\n\nphpBB Users: $num_rows\nTopics: $num_rows2\nPosts: $num_rows3" ;
$image = imagecreatefrompng("sig.png");
$white = imagecolorallocate ($image, 255,255,255);
$font = "04B_08__.TTF";

imageTTFtext( $image, 6, 0, 20, 100, $white, $font, $string);

header("Content-type: image/png");
imagepng($image);
?>
i just don't get it what am i doing wrong??

Posted: Mon Mar 28, 2005 10:05 am
by feyd
the new

Code: Select all

and

Code: Select all

tags support labeling. 


your .htaccess code makes .png a php processed file. So, copy sig.php to sig.png or similar. By the way, the following tends to work faster for getting the number of rows in a table

Code: Select all

SELECT COUNT(*) FROM `table`

Posted: Mon Mar 28, 2005 11:57 am
by sru
but why doesn't it work?
i enabled bbcode and look: Image
and this is one without php:
Image

Posted: Mon Mar 28, 2005 12:30 pm
by Roja
sru wrote:but why doesn't it work?
feyd wrote:copy sig.php to sig.png or similar
Change the filename/extension.

Then, learn to read better. :)