phpbb php sig

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sru
Forum Newbie
Posts: 2
Joined: Mon Mar 28, 2005 8:24 am

phpbb php sig

Post 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??
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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`
sru
Forum Newbie
Posts: 2
Joined: Mon Mar 28, 2005 8:24 am

Post by sru »

but why doesn't it work?
i enabled bbcode and look: Image
and this is one without php:
Image
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post 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. :)
Post Reply