tiktak0068
New Member
سلام
من توی دو تا از فایل های سایتم که با php نوشته شده اند مشکل دارم اگه کسی میتونه این مشکل رو حل کنه ممنون میشم
یکی فایل php زیر هست که بعد از اجرا این ارور رو میده
توی این فایل این ارور رو میده:
Warning: rename(/home/mysite/public_html/timages/post_thumb/,/home/mysite/public_html/timages/post_thumb/tikpix-org_1379280100_) [function.rename]: Invalid argument in /home/tikpixo/public_html/admin/add_post.php on line 32
اگه خطای دیگه هم داره اگه میشه برطرف کنید.
و دومین فایل هم
در فایل بالا بعد از اجرا باید 3 عکس رو در اندازه 150*150 تبدیل کنه ولی الان توی فایل بالا عرض عکس 150 هست ولی ارتفاع اون متغیر می باشد یعنی از 150 پایینتر هست و توضیح دیگه اینکه این دوتا فایل با هم متبط هستند و فایل اول مربوط به قسمت مدیریت و ارسال مطلب می باشد و فایل دوم هم یکی از فایل های ادمین می باشد.
اگه کسی میتونه لطفا کمکم کنه
با تشکر
من توی دو تا از فایل های سایتم که با php نوشته شده اند مشکل دارم اگه کسی میتونه این مشکل رو حل کنه ممنون میشم
یکی فایل php زیر هست که بعد از اجرا این ارور رو میده
PHP:
<?php
ob_start( "ob_gzhandler" );
require_once( "includes/header.php" );
include( "config.php" );
include( "img2.php" );
include( "tarikh.php" );
echo "<meta httpequiv=Content-Type content=\"text/html; charset=utf-8\">";
$ipath = HAM3D_IMS_POST_THUMB_ROOT;
$catname = $_POST['catname'];
if ( !( $result232 = mysql_query( "SELECT * FROM category WHERE ID=".$catname." LIMIT 1" ) ) )
{
exit( "Query failed" );
}
$image232 = mysql_fetch_array( $result232 );
$maincatID = $image232['maincat'];
$author = $_POST['author'];
$title = $_POST['title'];
$keywords = $_POST['keywords'];
$picnum = $_POST['picnum'];
$note_product_short = $_POST['note_product_short'];
$hamed = count( $_FILES['photos']['name'] );
if ( $title != "" && $author != "" )
{
$num = 0;
$key = 0;
for ( ; $key <= $hamed; ++$key )
{
if ( @!is_array( @$_FILES['photos']['name'] ) || !( $_FILES['photos']['tmp_name'][$key] != "none" ) || !( $_FILES['photos']['size'][$key] != 0 ) || !is_uploaded_file( $_FILES['photos']['tmp_name'][$key] ) )
{
move_uploaded_file( $_FILES['photos']['tmp_name'][$key], $ipath.$_FILES['photos']['name'][$key] );
$ifileName[$key] = "tikpix-org_".time( ).$_FILES['photos']['size'][$key]."_".$_FILES['photos']['name'][$key];
rename( $ipath.$_FILES['photos']['name'][$key], $ipath.$ifileName[$key] );
if ( file_exists( $ipath.$ifileName[$key] ) )
{
++$num;
$image_name = $ipath.$ifileName[$key];
resize_image( $image_name, $max_width = 150, $max_height = 150, $scale = null, $relscale = false, $quality = 100 );
chmod( "../timages/post_thumb/".$ifileName[$key], 493 );
}
}
}
$zip_check = !isset( $_POST['zip_check'] ) ? NULL : $_POST['zip_check'];
if ( $zip_check == 1 )
{
$my_base_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$my_base_url = str_replace( basename( $my_base_url ), "", $my_base_url );
$my_base_url = str_replace( "admin/", "", $my_base_url );
include( "class/upload/index.php" );
$my_allow_db = array( ".jpg", ".gif", ".jpeg", ".png" );
$my_upload = new file_upload( );
$my_upload->upload_dir = "../my_upload/";
$my_upload->extensions = array( ".zip", ".tar" );
$my_upload->max_length_filename = 100;
$my_upload->rename_file = false;
$my_upload->the_temp_file = $_FILES['my_file']['tmp_name'];
$my_upload->the_file = $_FILES['my_file']['name'];
$my_upload->http_error = $_FILES['my_file']['error'];
$my_upload->replace = true;
$my_upload->do_filename_check = true;
if ( $my_upload->upload( ) )
{
require_once( "class/zip/dUnzip2.inc.php" );
require_once( "class/zip/dZip.inc.php" );
$zip = new dunzip2( "../my_upload/".$my_upload->file_copy."" );
$zip->unzipall( "../my_unzip/" );
$my_all_file_name = "";
foreach ( $zip->compressedList as $fileName => $item )
{
$my_ext = strtolower( strrchr( $item['file_name'], "." ) );
if ( in_array( $my_ext, $my_allow_db ) )
{
$my_all_file_name[] = $my_base_url."my_unzip/".$item['file_name'];
}
}
$my_all_file_name_db = implode( "|", $my_all_file_name );
$my_to = explode( "|", $my_all_file_name_db );
$long2 = "";
$my_i = 0;
for ( ; $my_i < count( $my_to ); ++$my_i )
{
$long2 .= "<img src=\"".$my_to[$my_i]."\" ><br /><BR>";
}
}
else
{
echo "<br /><br /><br /><center>در موقع آپلود مشکلی ایجاد گردید<br />";
echo $my_upload->show_error_string( );
echo "</center>";
}
}
$note_product_long = $long2;
$note_product_long .= $_POST['note_product_long'];
$date = date( "Y-m-j" );
$query = "INSERT INTO ipost (catID ,\r\n\t\tkeywords,\r\n\t\tmainID ,\r\n\t\tauthor ,\r\n\t\ttitle , \r\n\t\tpicnum ,\r\n\t\tinside , \r\n\t\tshort , \r\n\t\timage_1 ,\r\n\t\timage_2 ,\r\n\t\timage_3 ,\r\n\t\tstart_date )\r\n\t\tVALUES ('".$catname."' ,\r\n\t\t'{$keywords}',\r\n\t\t'{$maincatID}' ,\r\n\t\t'{$author}' ,\r\n\t\t'{$title}' ,\r\n\t\t'{$picnum}' ,\r\n\t\t'{$note_product_long}' ,\r\n\t\t'{$note_product_short}' ,\r\n\t\t'".$ifileName[0]."' ,\r\n\t\t'".$ifileName[1]."' ,\r\n\t\t'".$ifileName[2].( "' ,\r\n\t\t'".$date."')" );
if ( !( $result = mysql_query( $query ) ) )
{
exit( "Query Insert categories Failed" );
}
$uID = farsinum( mysql_insert_id( ) );
$contentes = "<font color='#CF0200'> </font><IMG \r\n src='theme/images/ok.gif' \r\n border=0 name=Cat_add><font color='#CF0200'> </font>پست مورد \r\nنظر با تعداد <span lang='en-us'>".$num."</span> عکس موضوعی با موفقیت ارسال گردید </a> <span lang='fa'><a href='show_post.php'>بازگشت\r\n</a>";
}
else
{
$contentes = "Eror!";
}
$tmpl_file = "theme/home.html";
$thefile = implode( "", file( $tmpl_file ) );
$thefile = addslashes( $thefile );
$thefile = "\$r_file=\"".$thefile."\";";
eval( $thefile );
$r_file = str_replace( "\\'", "'", $r_file );
echo $r_file;
ob_end_flush( );
?>
توی این فایل این ارور رو میده:
Warning: rename(/home/mysite/public_html/timages/post_thumb/,/home/mysite/public_html/timages/post_thumb/tikpix-org_1379280100_) [function.rename]: Invalid argument in /home/tikpixo/public_html/admin/add_post.php on line 32
اگه خطای دیگه هم داره اگه میشه برطرف کنید.
و دومین فایل هم
PHP:
<?php
function file_extension( $filename )
{
$extension = substr( $filename, strrpos( $filename, "." ) + 1 );
$extension = strtolower( $extension );
return $extension;
}
function resize_image( $image_name, $max_width = null, $max_height = null, $scale = null, $relscale = false, $quality = 100 )
{
$img = null;
$ext = file_extension( $image_name );
if ( $ext == "jpg" || $ext == "jpeg" )
{
$img = @imagecreatefromjpeg( $image_name );
}
else if ( $ext == "png" )
{
$img = @imagecreatefrompng( $image_name );
}
else if ( $ext == "gif" )
{
$img = @imagecreatefromgif( $image_name );
}
if ( $img )
{
list( $oldwidth, $oldheight ) = getimagesize( $image_name );
if ( $relscale == true && ( $max_width || $max_height ) )
{
if ( $oldwidth < $oldheight || !$max_width )
{
$sizefactor = ( double )( $max_height / $oldheight );
$width = ( integer )( $oldwidth * $sizefactor );
$height = ( integer )( $oldheight * $sizefactor );
}
else if ( $oldheight < $oldwidth || !$max_height )
{
$sizefactor = ( double )( $max_width / $oldwidth );
$width = ( integer )( $oldwidth * $sizefactor );
$height = ( integer )( $oldheight * $sizefactor );
}
else
{
$width = $max_width;
$height = $max_height;
}
}
else if ( $max_width )
{
if ( !$max_height || $relscale == false )
{
$width = $max_width;
$height = $oldheight * ( $max_width / $oldwidth );
}
else
{
if ( $max_width && $max_height && $relscale == false )
{
$width = $max_width;
$height = $max_height;
}
else
{
}
}
}
else if ( !$scale && !$max_width && !$max_height )
{
$width = ( integer )( $oldwidth * ( $scale / 100 ) );
$height = ( integer )( $oldheight * ( $scale / 100 ) );
}
else
{
return false;
}
$tmp_img = imagecreatetruecolor( $width, $height );
imagecopyresampled( $tmp_img, $img, 0, 0, 0, 0, $width, $height, $oldwidth, $oldheight );
imagedestroy( $img );
$img = $tmp_img;
if ( $ext == "png" )
{
imagepng( $img, $image_name );
}
else if ( $ext == "gif" )
{
imagegif( $img, $image_name );
}
else
{
imagejpeg( $img, $image_name, $quality );
}
}
}
?>
در فایل بالا بعد از اجرا باید 3 عکس رو در اندازه 150*150 تبدیل کنه ولی الان توی فایل بالا عرض عکس 150 هست ولی ارتفاع اون متغیر می باشد یعنی از 150 پایینتر هست و توضیح دیگه اینکه این دوتا فایل با هم متبط هستند و فایل اول مربوط به قسمت مدیریت و ارسال مطلب می باشد و فایل دوم هم یکی از فایل های ادمین می باشد.
اگه کسی میتونه لطفا کمکم کنه
با تشکر
آخرین ویرایش: