Решил поделится баннером в профиль, благодоря которому в профиле вы можете загрузить картинку как рекламу либо просто картинку
создаем upload_banner.php
В нем пишем это
PHP:
<?php
include "header.php";
if ($user->user_exists !== 0 & !empty($_FILES['photo'])){
if (is_uploaded_file($_FILES['photo']['tmp_name'])) {
if ($_FILES['photo']['type'] == "image/pjpeg" or $_FILES['photo']['type'] == "image/jpeg"){
$source = $_FILES['photo']['tmp_name'];
$target = "uploads_user/1000/".$user->user_info[user_id]."/"."banner_".$user->user_info[user_id].".jpg";
if (move_uploaded_file($source, $target)){
chmod($target, 0777);
?>
<script language="javascript" type="text/javascript">window.top.window.stopUpload('<?php echo $target; ?>');</script>
<?php
} else die ("Cannot move uploaded image. Please notify server admin.");
} else exit ("Sorry, but only jpg/jpeg files allowed!");
} else exit("Possible try to exploit the site!");
}
?>
и фаил для того чтобы удалить del_banner.php
PHP:
<?php
include "header.php";
if ($user->user_exists !== 0){
if (isset ($_REQUEST['uid']) and $_REQUEST['uid'] == $user->user_info[user_id]){
$target = "uploads_user/1000/".$user->user_info[user_id]."/"."banner_".$user->user_info[user_id].".jpg";
if (unlink($target)){
echo ("1");
} else echo ("Cannot delete banner file. Please contact server admin.");
}
}
?>
в profile.tpl в любое удобное место вставляем
PHP:
{* ----- BEGIN USER BANNER FEATURE ----- *}
{literal}
<script type="text/javascript">
function del_banner(the_id) {
var req = new Request({
method: 'post',
url:'del_banner.php',
data: { uid : the_id },
onComplete: function(response) { $('ban_img').style.display ='none'; $('usr_banner').style.display ='none'; $('delbanurl').style.display ='none'; $('upload_banner_form').style.display =''; }
}).send();
}
<!--
function startUpload(){
return true;
}
function stopUpload(baneris){
if (baneris !== ''){
$('upload_banner_form').style.display ='none';
$('ban_img').set('src', './'+baneris);
$('usr_banner').style.display ='';
$('ban_img').style.display ='';
return true;
}
}
//-->
</script>
{/literal}
{if $bannerexists == 1}
{if $owner->user_info.user_id == $user->user_info.user_id} <a id='delbanurl' onclick="javascript:del_banner('{$owner->user_info.user_id}')" href="javascript:void(0);">[{lang_print id=771}]</a>
{* HIDE UPLOAD FORM IF IMAGE ALREADY THERE *}
<div id='upload_banner_form' style='display:none;'>
<a onclick="$('group_box').style.display = ( $('group_box').style.display=='none' ? '' : 'none');" href="javascript:void(0);">
<div class='header'>
User Banner Image
</div>
</a>
<div class='group_box' style='margin-bottom:15px;' id='group_box'>
<table cellpadding='0' cellspacing='0'>
<tr>
<td class='editprofile_photoright'>
<form action='upload_banner.php' method='post' enctype='multipart/form-data' id='bannerform' target='upload_target' onsubmit='startUpload();'>
{lang_print id=772}
<br>
<input type='file' class='text' name='photo' size='30'><input type='submit' class='button' name='button' id='submitter' value='{lang_print id=714}'>
<iframe id="upload_target" name="upload_target" src="#" style="width:0;height:0;border:0px solid #fff;">
</iframe>
</form>
<br>
{lang_print id=715} jpg,jpeg.
<br/>
<b>Max Width</b>
720px and <b>Heigth</b>
120px.
</td>
</tr>
</table>
</div>
</div>
{/if}
{* HIDEN UPLOAD FORM *}
<div id='usr_banner'>
<img id='ban_img' src='./uploads_user/1000/{$owner->user_info.user_id}/banner_{$owner->user_info.user_id}.jpg' border='0' align='absmiddle' style='max-height:120px; max-width:716px'/>
</div> {else}
{if $owner->user_info.user_id == $user->user_info.user_id}
<div id='upload_banner_form'>
<a onclick="$('group_box').style.display = ( $('group_box').style.display=='none' ? '' : 'none');" href="javascript:void(0);">
<div class='header'>
User Banner Image
</div>
</a>
<div class='group_box' style='margin-bottom:15px; display:none' id='group_box'>
<table cellpadding='0' cellspacing='0'>
<tr>
<td class='editprofile_photoright'>
<form action='upload_banner.php' method='post' enctype='multipart/form-data' id='bannerform' target='upload_target' onsubmit='startUpload();'>
{lang_print id=772}
<br>
<input type='file' class='text' name='photo' size='30'><input type='submit' class='button' name='button' id='submitter' value='{lang_print id=714}'>
<iframe id="upload_target" name="upload_target" src="#" style="width:0;height:0;border:0px solid #fff;">
</iframe>
</form>
<br>
{lang_print id=715} jpg,jpeg.
<br/>
<b>Max Width</b>
720px and <b>Heigth</b>
120px.
</td>
</tr>
</table>
</div>
</div>
<div id='usr_banner' style='display:none;'>
<img id='ban_img' src='' border="0" align="absmiddle" style="max-height:120px; max-width:716px"/>
</div> {/if}
{/if}
{* END USER BANNER FEATURE *}
в profile.php
PHP:
// USER BANNER
if (file_exists("uploads_user/1000/".$owner->user_info[user_id]."/banner_".$owner->user_info[user_id].".jpg")) {
$bannerexists = 1;
} else {
$bannerexists = 0;
}
$smarty->assign('bannerexists', $bannerexists);
ну вот все готово кто если его улучшит выкладывайте сюда,
p.s Будь мужиком помог хак поставь спасибо