[REG] Profile picture

Posted on Saturday 26th April 2008 at 09:08 AM
jambomb
jambomb's Avatar
this is the avatar code:

<?
session_start();
include ("config.php");

function BBCODE($content){ //define the function of bbcode
$content = nl2br($content); //replaces returns with br's
$match = array(
'#[b](.*?)[/b]#se',
'#[i](.*?)[/i]#se',
'#[u](.*?)[/u]#se',
'#[url=(.*?)](.*?)[/url]#se',
'#[url](.*?)[/url]#se',
'#[img](.*?)[/img]#se',
'#[code](.*?)[/code]#se',
'#[php](.*?)[/php]#se',
'#[print](.*?)[/print]#se'
); //codes used in posts
$replace = array(
"'<b>\1</b>'",
"'<i>\1</i>'",
"'<u>\1</u>'",
"'<a href="\1" target="_BLANK">\2</a>'",
"'<a href="\1" target="_BLANK">\1</a>'",
"'<img border="0" src="\1">'",
"'<u><b>Code:</b></u>
<div style="border: 1px dotted #000000; background-color: #CCCCCC; overflow: auto;">
'.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'",
"'<u><b>PHP Code:</b></u>
<div style="border: 1px dotted #000000; background-color: #CCCCCC; overflow: auto;"> '.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'",
"'<u><b>Print Out:</b></u>
<div style="border: 1px dotted #000000; background-color: #CCCCCC; overflow: auto;">
'.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'"
); //replacements
return preg_replace($match, $replace, $content); //match, and replace
} //end the function
?>
Posted on Saturday 26th April 2008 at 02:08 PM
ShadowMage
ShadowMage's Avatar
that should be bbcode.php

avatar.php
[php]
<?php
include "config.php";
if($logged[username])
{
switch($_GET[page])
{
default:
echo ("
<form action='?page=upload' enctype='multipart/form-data' method='POST'>
<table border='1'>
<tr>
<td>Avatar</font></td>
<td><input type='file' size='7' name='avatar' id='avatar'></td>
</tr>
<tr>
<td colspan='2' align='center'><input type='submit' name='submit' value='Upload'></td>
</tr>
</table>
</form>
");
break;

case 'upload':
$filename = $_FILES["avatar"]["name"];
$tmp_name = $_FILES["avatar"]["tmp_name"];

$avatar = "images/$filename";
$username = $logged[username];
if (move_uploaded_file($tmp_name, "images/".$filename))
{
$query = mysql_query("UPDATE `members` SET `avatar` = '$avatar' WHERE `username` = '$logged[username]'");
echo ("File uploaded $avatar, $username");
}
else
{
die("Uploading file Failed.");
}
break;
}
}
?>
[/php
failure i sense
Posted on Saturday 26th April 2008 at 03:42 PM
jambomb
jambomb's Avatar
aaaa ok thanks :) i got it up now like the upload thing, but how do i make it go into like a table ? i got liek a picture and put the link to images/$avator but still dont work :P sorry im not that good at php :(
Posted on Saturday 26th April 2008 at 03:52 PM
ShadowMage
ShadowMage's Avatar
On the members profile?
failure i sense
Posted on Saturday 26th April 2008 at 04:02 PM
jambomb
jambomb's Avatar
yeh on login.php and members.php so then when they click on the members name they will see there profile and picture
Posted on Saturday 26th April 2008 at 04:08 PM
ShadowMage
ShadowMage's Avatar
on members.php where it displays information add
Code
<img src="$user[avatar] alt="Avatar" /><br />
failure i sense
Posted on Saturday 26th April 2008 at 04:46 PM
jambomb
jambomb's Avatar
aa ty, but its just a blank image. like its broken sign on it
Posted on Sunday 27th April 2008 at 10:39 PM
Posted on Wednesday 30th April 2008 at 07:39 PM
ShadowMage
ShadowMage's Avatar
right click and hit Properties then tell me what comes up for URL/link or what ever that property is x]
failure i sense
Posted on Wednesday 30th April 2008 at 09:30 PM
jambomb
jambomb's Avatar
"$user[avatar]
Login or register to respond to this forum topic.