Forum PHP Signatures

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
User avatar
fresh
Forum Contributor
Posts: 259
Joined: Mon Jun 14, 2004 10:39 am
Location: Amerika

Forum PHP Signatures

Post by fresh »

ever seen anyones signature that is a picture that must have php embeded in it or something, and the img echos your IP and sometimes more... I was wondering if anyone knew how they did this and if you could show me how... thanks :)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

umm i believe they include a script outside the server which outputs the users IP
User avatar
fresh
Forum Contributor
Posts: 259
Joined: Mon Jun 14, 2004 10:39 am
Location: Amerika

i know that

Post by fresh »

I mean how do they make it echo inside of a picture???

and also, how would I add the php highlight syntax tag to my phpbb forum, I have a code:

Code: Select all

$bbcode=preg_replace("/(\їphp])(.*)(\ї\/php\])/siUe", "highlite('\\2')",$bbcode);

function highlite($text)
{ ob_start();
highlight_string(stripslashes($text));
$buffer = ob_get_contents();
ob_end_clean();

return nl2br($buffer);
}
sorry it wouldn't parse right using php tags for some reason this should work right?? The reason I ask how to add it is, last time I edited one of the forums php files, and uploaded it, it wouldn't parse the file, I don't know if it has something to do with bbcode, or not... so I was wondering if there is some special way to edit phpbb forum code???

Thanks :)
User avatar
fresh
Forum Contributor
Posts: 259
Joined: Mon Jun 14, 2004 10:39 am
Location: Amerika

figured it out

Post by fresh »

you do this:

Code: Select all

їurl=http://myhost.com]їimg]http://myhost.com/signature.phpї/img]ї/url]
and your code would be like this:

Code: Select all

<?php
define('CPG_NUKE', 1);
$phpver = phpversion();
$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;
if ($phpver >= '4.0.4pl1' && extension_loaded('zlib')) {
//    ob_start('ob_gzhandler');
}
require_once('config.php');
require_once('db/db.php');

$result[0] = $db->sql_query("SELECT topic_views, topic_replies FROM ".$prefix."_bbtopics");
    while( $post = $db->sql_fetchrow($result[0]) ) {
    
   $numviews[0] = $numviews[0] + $post[topic_views];
   $numreplies[0] = $numreplies[0] + $post[topic_replies];
   $numtopics[0]++;
}
$numposts[0] = $numtopics[0]+$numreplies[0];
$user = $_COOKIE['user'];
if ($user) {
    if (!is_array($user)) {
        $user = base64_decode($user);
        $user = explode(":", $user);
    }
    $uid[0] = $user[0];
    $pwd[0] = $user[2];
    $uid[0] = intval($uid[0]);
    if ($uid[0] != "" AND $pwd[0] != "") {
        $result[0] = $db->sql_query("SELECT user_password, username, user_new_privmsg, user_unread_privmsg FROM ".$user_prefix."_users WHERE user_id='$uid[0]'");
        $row = $db->sql_fetchrow($result[0]);
        if ($row[user_password] == $pwd[0] && $row[user_password] != "") {
            $slogan = $row[username]." you have $row[user_new_privmsg] new & $row[user_unread_privmsg] unread PM's";
        }
        $db->sql_freeresult($result[0]);
    }
    } Else {
    $hello = Hello;
    $anonymous = Anonymous;
    $slogan2 = "Only Other Site dedicated to CPG-Nuke Stuff";
    $slogan3 = "** Powered by the latest CPG-Nuke CVS **";
    }


$image[0] = "images/signature.png";
$im = imagecreatefrompng($image[0]);
$tc = ImageColorAllocate ($im, 0, 0, 0);
$tc2 = ImageColorAllocate ($im, 0, 0, 255);
ImageString($im, 3, 62, 55, "$hello", $tc);
ImageString($im, 3, 45, 65, "$anonymous", $tc);
ImageString($im, 3, 260, 5, "Live statistics", $tc);
ImageString($im, 2, 200, 20, "Total Topics :", $tc);
ImageString($im, 2, 290, 20, "$numtopics[0]", $tc2);
ImageString($im, 2, 200, 30, "Total Posts  :", $tc);
ImageString($im, 2, 290, 30, "$numposts[0]", $tc2);
ImageString($im, 2, 200, 40, "Total Views  :", $tc);
ImageString($im, 2, 290, 40, "$numviews[0]", $tc2);
ImageString($im, 2, 200, 55, "$slogan", $tc);
ImageString($im, 2, 180, 55, "$slogan2", $tc);
ImageString($im, 2, 188, 65, "$slogan3", $tc2);


header("Content-Type: image/png");
Imagepng($im,'',100);
ImageDestroy ($im);
?>
taken from : cpgnuke.com

now how bout the bbcode question ;)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I should be posting a code snippet soon with a new improved

Code: Select all

highlighting engine.. We'll be rolling it out here first. Once we get it bug free, I'll post the code.
Post Reply