hello
this is the problem when some try to change guild logo
Warning: move_uploaded_file(guilds/gods_of_olympus.gif) [function.move-uploaded-file]: failed to open stream: No such file or directory in D:\xampp\htdocs\guilds.php on line 1352
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\xampp\tmp\phpDF49.tmp' to 'guilds/gods_of_olympus.gif' in D:\xampp\htdocs\guilds.php on line 1352
and this is the line and some more with change logo script (i think xD)
i hoppe some can help me
this is the problem when some try to change guild logo
Warning: move_uploaded_file(guilds/gods_of_olympus.gif) [function.move-uploaded-file]: failed to open stream: No such file or directory in D:\xampp\htdocs\guilds.php on line 1352
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\xampp\tmp\phpDF49.tmp' to 'guilds/gods_of_olympus.gif' in D:\xampp\htdocs\guilds.php on line 1352
and this is the line and some more with change logo script (i think xD)
PHP:
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if($action == 'changelogo')
{
$guild_name = $_REQUEST['guild'];
if(!check_guild_name($guild_name))
$guild_errors[] = 'Invalid guild name format.';
if(empty($guild_errors))
{
$guild = $ots->createObject('Guild');
$guild->find($guild_name);
if(!$guild->isLoaded())
$guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
}
if(empty($guild_errors))
{
if($logged)
{
$guild_leader_char = $guild->getOwner();
$guild_leader = FALSE;
$account_players = $account_logged->getPlayers();
foreach($account_players as $player)
{
if($guild_leader_char->getId() == $player->getId())
{
$guild_vice = TRUE;
$guild_leader = TRUE;
$level_in_guild = 3;
}
}
if($guild_leader)
{
$max_image_size_b = $config['site']['guild_image_size_kb'] * 1024;
$allowed_ext = array('image/gif', 'image/jpg', 'image/pjpeg', 'image/jpeg', 'image/bmp', 'image/png', 'image/x-png');
$ext_name = array('image/gif' => 'gif', 'image/jpg' => 'jpg', 'image/jpeg' => 'jpg', 'image/pjpeg' => 'jpg', 'image/bmp' => 'bmp', 'image/png' => 'png', 'image/x-png' => 'png');
$save_file_name = str_replace(' ', '_', strtolower($guild->getName()));
$save_path = 'guilds/'.$save_file_name;
if($_REQUEST['todo'] == 'save')
{
$file = $_FILES['newlogo'];
if(is_uploaded_file($file['tmp_name']))
{
if($file['size'] > $max_image_size_b)
$upload_errors[] = 'Uploaded image is too big. Size: <b>'.$file['size'].' bytes</b>, Max. size: <b>'.$max_image_size_b.' bytes</b>.';
$type = strtolower($file['type']);
if(!in_array($type, $allowed_ext))
$upload_errors[] = 'Your file type isn\' allowed. Allowed: <b>gif, jpg, bmp, png</b>. Your file type: <b>'.$type.'</b> If it\'s image contact with admin.';
}
else
$upload_errors[] = 'You didn\'t send file or file is too big. Limit: <b>'.$config['site']['guild_image_size_kb'].' KB</b>.';
if(empty($upload_errors))
{
$extension = $ext_name[$type];
if(!move_uploaded_file($file['tmp_name'], $save_path.'.'.$extension))
$upload_errors[] = 'Sorry! Can\'t save your image.';
}
if(empty($upload_errors))
{
foreach (array("/", "\\", "..") as $char)
{
$guild_logo = str_replace($char, "", $guild->getCustomField('logo_gfx_name'));
}
if (empty($guild_logo) || !file_exists("images/guilds/".$guild_logo))
{
$guild_logo = "default_logo.gif";
}
if($guild_logo != "default_logo.gif" && $guild_logo != $save_file_name.'.'.$extension)
{
unlink('images/guilds/'.$guild_logo);
}
}
//show errors or save file
if(!empty($upload_errors))
{
$main_content .= '<div class="SmallBox" > <div class="MessageContainer" > <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="ErrorMessage" > <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div> <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div> <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
foreach($upload_errors as $guild_error)
$main_content .= '<li>'.$guild_error;
$main_content .= '</div> <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> </div></div><br>';
}
else
{
$guild->setCustomField('logo_gfx_name', $save_file_name.'.'.$extension);
}
}
foreach (array("/", "\\", "..") as $char)
{
$guild_logo = str_replace($char, "", $guild->getCustomField('logo_gfx_name'));
}
if (empty($guild_logo) || !file_exists("images/guilds/".$guild_logo))
{
$guild_logo = "default_logo.gif";
}
$main_content .= '<center><h2>Change guild logo</h2></center>Here you can change logo of your guild.<BR>Actuall logo: <img src="images/guilds/'.$guild_logo.'" HEIGHT="64" WIDTH="64"><BR><BR>';
$main_content .= '<form enctype="multipart/form-data" action="index.php?subtopic=guilds&guild='.$guild->getName().'&action=changelogo" method="POST">
<input type="hidden" name="todo" value="save" />
<input type="hidden" name="MAX_FILE_SIZE" value="'.$max_image_size_b.'" />
Select new logo: <input name="newlogo" type="file" />
<input type="submit" value="Send new logo" /></form>Only <b>jpg, gif, png, bmp</b> pictures. Max. size: <b>'.$config['site']['guild_image_size_kb'].' KB</b><br>';
$main_content .= '<br/><center><form action="index.php?subtopic=guilds&guild='.$guild->getName().'&action=manager" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
}
else
$guild_errors[] = 'You are not a leader of guild!';
}
else
$guild_errors[] = 'You are not logged. You can\'t manage guild.';
}
if(!empty($guild_errors))
{
$main_content .= '<div class="SmallBox" > <div class="MessageContainer" > <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="ErrorMessage" > <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div> <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div> <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
foreach($guild_errors as $guild_error)
$main_content .= '<li>'.$guild_error;
$main_content .= '</div> <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div> <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div> </div></div><br>';
$main_content .= '<br/><center><form action="index.php?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
}
}
i hoppe some can help me