Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Custom Background
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2011-07-25 17:29:14
Hello torrenttrader community.

This is a simple mod that allow each user to choice their own background image.

Lets start the modifications.

First,

Run SQL commands in your database

" by the link of other background image you want.



Save it and open account.php



Find

ALTER TABLE `users` ADD `userbg` VARCHAR( 500 ) NOT NULL DEFAULT ''
Now, in your main theme folder open header.php

add


style="background: url(<?=$userbg2?>) 50% no-repeat fixed;"





after



<BODY





and after



</head>





add



<?



$id = $CURUSER['id'];

$get = mysql_query("SELECT * FROM users WHERE id=$id") or die(mysql_error());

$got = mysql_fetch_array($get);



$userbg = $got['userbg'];

if ($userbg == '')

$userbg2 = "http://demo.dzinerstudio.com/smf2/Themes/zone99_20/images/custom/body_bg.jpg";

else

$userbg2 = $userbg;



?>



or you can replace "

print("<TR><TD align=right class=table_col2><B>" . AVATAR_URL . ":</b> </td><TD align=left class=table_col2><input name=avatar size=50 value=\"" . htmlspecialchars($CURUSER["avatar"]) .

 "\"><br />\n<i>Link to your externally hosted avatar image: 80x80px</i></td></tr>");





and after add



print("<TR><TD align=right class=table_col2><B>Background:</b> </td><TD align=left class=table_col2><input name=userbg size=50 value=\"" . htmlspecialchars($CURUSER["userbg"]) .

 "\"><br />\n<i>Link to your externally hosted background image.</i></td></tr>");





Now find



$avatar = $_POST["avatar"];





and after add



if(!$imgtype['mime']){

show_error_msg(("FAILED"), 'file is not an image');

}elseif(

$imgtype['mime'] = 'image/gif' |

$imgtype['mime'] = 'image/jpeg' |

$imgtype['mime'] = 'image/png' |

$imgtype['mime'] = 'image/psd' |

$imgtype['mime'] = 'image/bmp' |

$imgtype['mime'] = 'image/tiff' |

$imgtype['mime'] = 'image/tiff' |

$imgtype['mime'] = 'image/jp2' |

$imgtype['mime'] = 'image/iff' |

$imgtype['mime'] = 'image/vnd.wap.wbmp' |

$imgtype['mime'] = 'image/xbm' |

$imgtype['mime'] = 'image/vnd.microsoft.icon'

){

$userbg = $_POST["userbg"];

}else{

show_error_msg(("FAILED"), 'file is not an image');

}





Then find



$updateset[] = "avatar = " . sqlesc($avatar);





and add after



$updateset[] = "userbg = " . sqlesc($userbg);



Save it and you're done!

Hope you like it   :angry:  :D
Unknown User
2011-07-25 19:15:26
Its not really a secure mod...

You should at least check its a valid image / check the extenstion
Unknown User
2011-07-25 19:21:21
Good work! Add more security and it is probably something that could be popular :angry:
Unknown User
2011-07-25 19:39:31
"djhowarth, post: 73775":
Its not really a secure mod...
You should at least check its a valid image / check the extenstion

i'll do that.

then i'll post here the result.

thanks for the tip :angry:
Unknown User
2011-07-26 09:35:22
yes. it works  :angry:

but your code should be

if(!$imgtype['mime']){

show_error_msg(("FAILED"), 'file is not an image');

}elseif(

$imgtype['mime'] = 'image/gif' |

$imgtype['mime'] = 'image/jpeg' |

$imgtype['mime'] = 'image/png' |

$imgtype['mime'] = 'image/psd' |

$imgtype['mime'] = 'image/bmp' |

$imgtype['mime'] = 'image/tiff' |

$imgtype['mime'] = 'image/tiff' |

$imgtype['mime'] = 'image/jp2' |

$imgtype['mime'] = 'image/iff' |

$imgtype['mime'] = 'image/vnd.wap.wbmp' |

$imgtype['mime'] = 'image/xbm' |

$imgtype['mime'] = 'image/vnd.microsoft.icon'

){

$userbg = $_POST["fundo"];

}else{

show_error_msg(("FAILED"), 'file is not an image');

}
Unknown User
2011-07-26 11:47:13
if(!$imgtype['mime']){

show_error_msg(("FAILED"), 'file is not an image');

}elseif(

$imgtype['mime'] = 'image/gif' |

$imgtype['mime'] = 'image/jpeg' |

$imgtype['mime'] = 'image/png' |

$imgtype['mime'] = 'image/psd' |

$imgtype['mime'] = 'image/bmp' |

$imgtype['mime'] = 'image/tiff' |

$imgtype['mime'] = 'image/tiff' |

$imgtype['mime'] = 'image/jp2' |

$imgtype['mime'] = 'image/iff' |

$imgtype['mime'] = 'image/vnd.wap.wbmp' |

$imgtype['mime'] = 'image/xbm' |

$imgtype['mime'] = 'image/vnd.microsoft.icon'

){

$userbg = $_POST["userbg"];

}else{

show_error_msg(("FAILED"), 'file is not an image');

}
this is the right code according to my first post.



i use


$userbg = $_POST["userbg"];



because it's portuguese and more easy for me..

but it works good. :angry:
Unknown User
2011-07-26 14:48:47
your code worked good..

but i needed to remove the T_() function from it to make it work..

so the strings used in my source are with other texts but they still the same thing like my first post.

first post was updated and ow everything works good.

:angry:
Unknown User
2011-07-26 21:45:46
yeh , no T function in 2.05 i still use :angry:
Unknown User
2011-07-26 21:53:03
"SJC2TK, post: 73821":
yeh , no T function in 2.05 i still use  :angry:

you can port it from 2.07 to 2.05

but you don't need it for this mod :D
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728