Re: MOD: Photo thumbnail for avatars in punbb
not exactly .. but like this it works:
<?php
/*
View user thumbnails from anywhere (viewthumb.php)
Author: Steve
Website: [url=http://www.kinkyspace.net]www.kinkyspace.net[/url]
Adapted to 2.5.6 by radioact
*/
// look for server path at config.php line 16
include_once "//PUT HERE THE CONFIG-PATH//";
$db_username = "/PUT HERE THE USERNAME OF THE DB/";
$db_password = "/PUT HERE THE PASSWORD OF THE DB/";
$db_name = "/PUT HERE THE NAME OF THE DB/";
$db_server ="/PUT HERE THE HOST OF DB - 99% is LOCALHOST/";
$table_prefix ="/PUT HERE THE USERNME OF THE VLD TABLES - 99% is vld_/";
$vir_path ="/PUT HERE THE PATH OF YOUR SITE - GET THE INFO IN CONFIG-PHP/";
$vir_pic_path = "/PUT HERE THE PATH OF THE UPLOAD-FOLDER - GET THE INFO IN CONFIG-PHP/";
$vir_nophoto_path ="http://www.domain.com/templates/YOURTEMPLATE/media/user_picture_none.gif";
/*
Don't Edit below this line unless you know what you are doing
*/
$user = trim($_GET['user']);
if (preg_match("/^\w{1,30}$/", $user, $matches)) {
}
else // Could be a SQL injection so we don't go any further, goodbye
{
exit();
}
$dbcnx = @mysql_connect($db_server, $db_username, $db_password);
if (!$dbcnx) {
echo( "<P>Unable to connect to the " .
"database server at this time. Kein Connect!</P>" );
exit();
}
if (! @mysql_select_db($db_name) ) {
echo( "<P>Unable to locate the " .
"database at this time.</P>" );
exit();
}
$sql = "SELECT m.* FROM " . $table_prefix . "members AS m WHERE m.username='$user'";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$photo = $row['picture'];
$member_id = $row['member_id'];
$joindate = $row['joindate'];
$media_path = substr($joindate, -1, 1).'/'.
substr($joindate, -2, 1).'/'.
substr($joindate, -3, 1).'/'.
substr($joindate, -4, 1).'/'.
$member_id.'/';
}
mysql_close($dbcnx);
if($photo){
readfile( $vir_pic_path . $media_path . 't_photo_'.$photo);
}
else
{
readfile($vir_nophoto_path);
}
?>This HEADER dosnt work:
define('DB_SERVER', $conf['db_hostname']);
define('DB_USERNAME', $conf['db_username']);
define('DB_PASSWORD', $conf['db_password']);
define('DB_NAME', $conf['db_name']);
define('TABLE_PREFIX', $conf['db_prefix']);
define('VIR_PATH', $conf['virtual_path']);
define('VIR_PIC_PATH', $conf['virtual_pic_path']);THX a many hugs an kisses from simona!