The Five-Minute Forums  

Go Back   The Five-Minute Forums > FiveMinute.net > 5MV Talk

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 01-21-2006, 04:58 PM
whoiam whoiam is offline
whathistitleis
Member
 
Join Date: Jun 2005
Location: Birmingham Uni
Posts: 832
Send a message via MSN to whoiam
Default

Okay, I just spent awhile sketching out the first half of an idea...
(this needs mod_rewrite - ask your host if that's available)

First up, the two example files I made you can find at http://thirdcursus.com/partial-mod.zip

Now, the way I made this section of the mod work is to move all the contents of the /templates//images/ folder to a new folder (I used /templates//target/ when I was writing it). Then edit the .htaccess file so that it contains the proper URL for the folder you moved the images to. (There's only one URL in the file, so just change that to the URL you've used), and place it in the now-empty images folder.

Next, you need to edit the spic.php file. The 6 variables at the top will need to be replaced with ones that will allow read access to the phpbb_users table (or whatever you named your equivalent).

The first variable ($field) needs to be set to the field in the users table that will be used to store the person's choice of picture. the second, $default, is the picture you want someone to see if they haven't made a selection yet.

The spic.exe file then goes into the 'target' folder along with the images.

This system also needs you to add one field to the user table (remember to allow this to be null, or you'll have to modify the signup process as well), and to modify the profile page to allow people to chose options from a drop-down box to go into that field.

*grins* That was an hour well-wasted, I think.

Anyway, this is the code from the two files, feel free to play around with it.

Quote:
Originally Posted by .htaccess
Options All
RewriteEngine on
RewriteRule ^(.*)/?$ http://www.thirdcursus.com/forum/templates/subsilver/target/spic.php?file=$1 [R=301,L]
Quote:
Originally Posted by spic.php
$field = "replace_me";
$default = "defaultpic.gif";
$hostname_con1 = "localhost";
$database_con1 = "forum";
$table_con1 = "phpbb_users";
$username_con1 = "root";
$password_con1 = "xxx";

// File
$filename = $_GET['file'];


if (eregi ("logo_phpbb.gif", $filename)) {

define('IN_PHPBB', true);
$phpbb_root_path = '../../../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_PROFILE);
init_userprefs($userdata);

$user = $userdata['user_id'];

$con1 = mysql_connect($hostname_con1, $username_con1, $password_con1) or trigger_error(mysql_error(),E_USER_ERROR);

$query_Recordset1 = "SELECT `$field` FROM `$table_con1` where `user_id` = '$user'";
$Recordset1 = mysql_query($query_Recordset1, $con1) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$filename = $row_Recordset1[$field];
if($filename=='') { $filename = $default; }
// Content type
header('Content-type: image/gif');

// Load
$source = imagecreatefromgif($filename);

// Output
imagegif($source);

}elseif (eregi ("\.jpg", $filename)) {

header('Content-type: image/jpg');

// Load
$source = imagecreatefromjpeg($filename);

// Output
imagejpeg($source);

}elseif(eregi ("\.gif", $filename))
{
// Content type
header('Content-type: image/gif');

// Load
$source = imagecreatefromgif($filename);

// Output
imagegif($source);
}elseif(eregi ("\.htm", $filename)) {
include('index.htm');
}
?>
__________________
Me, singing: Krieg, huh... wozu ist der gut?
Um Europa zu übernehmen!

Vote Morphine - the party for Not Crushing Opium!

Yoda, to his ice-cream: The sauce is upon you, and soon, sprinkles must fall!
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 09:27 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.