| Подскажите пожалуйста почему возникает эта ошибка?
Fatal error: Call to undefined function: resizeimg() in x:\home\port.ru\www\add_news.php on line 76
|
Код программы
<?php
session_start();
include "config.php";
if(@$nnic!="")
{
$pravo=@file("$news_admins");
$c_p=count($pravo)-1;
for ($i=$c_p;$i>=0;$i--)
{
if ($nnic==$pravo[$i])
{
$dostup="1";
}
}
if (@$stt=="vadmin" or @$stt=="moder" or @$dostup=="1")
{
if($titl=="" or $short=="" or $news=="")
{
$er="нужно заполнить все поля!";
@header("Location: http://$HTTP_HOST/news.php?add_news=add&er=$er"); exit;
}
else
{
$nickk=strip_tags($nickk,"");
$nickk = stripslashes ($nickk);
$titl= str_replace("|","¡",$titl);
$titl=strip_tags($titl,"");
$titl= str_replace("\r\n","",$titl);
$titl= str_replace("\n","",$titl);
$titl = stripslashes ($titl);
$short= str_replace("|","¡",$short);
$short=strip_tags($short,"");
$short= str_replace("\r\n","",$short);
$short= str_replace("\n","",$short);
$short = stripslashes ($short);
$news= str_replace("|","¡",$news);
$news=strip_tags($news,"<b><i><u><center><font>");
$news= str_replace("\r\n","<br>",$news);
$news= str_replace("\n","<br>",$news);
$news = stripslashes ($news);
$date=date("d.m.Y H:i");
if(@$nickk!="")
{
$avtor=@$nickk;
}
else
{
$avtor="неизвестно";
}
if (@$m_img=="")
{
$m_img="";
$b_img="";
}
if(@$filename!="")
{
if($_FILES["filename"]["size"] > 40*1024)
{
@header("Location: http://$HTTP_HOST/news_admin.php?error=1");exit;
}
$ext=strrchr($HTTP_POST_FILES['filename']['name'],".");
$time=time();
$put="$time$ext";
if($ext!='.gif' && $ext!='.GIF' && $ext!='.jpg' && $ext!='.JPG' && $ext!='.jpeg' && $ext!='.JPEG')
{
@header("Location: http://$HTTP_HOST/news_admin.php?error=2");exit;
}
if(!move_uploaded_file($_FILES["filename"]["tmp_name"], "$news_imgb$put"))
{
@header("Location: http://$HTTP_HOST/news_admin.php?error=3");exit;
}
$img1="$news_imgb$put";
$img2="$news_imgm$put";
$bigimage = "$img1";
$smallimage = "$img2";
resizeimg($bigimage, $smallimage, 133, 100);//Эта строчка на которую указывает ошибка
function resizeimg($filename1, $smallimage, $w, $h)
{
$ratio = $w/$h;
$size_img = getimagesize($filename1);
if (($size_img[0]<$w) && ($size_img[1]<$h)) return true;
$src_ratio=$size_img[0]/$size_img[1];
if ($ratio<$src_ratio)
{
$h = $w/$src_ratio;
}
else
{
$w = $h*$src_ratio;
}
$dest_img = imagecreatetruecolor($w, $h);
$white = imagecolorallocate($dest_img, 255, 255, 255);
if ($size_img[2]==2) $src_img = imagecreatefromjpeg($filename1);
else if ($size_img[2]==1) $src_img = imagecreatefromgif($filename1);
else if ($size_img[2]==3) $src_img = imagecreatefrompng($filename1);
imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $w, $h, $size_img[0], $size_img[1]);
if ($size_img[2]==2) imagejpeg($dest_img, $smallimage);
else if ($size_img[2]==1) imagegif($dest_img, $smallimage);
else if ($size_img[2]==3) imagepng($dest_img, $smallimage);
imagedestroy($dest_img);
imagedestroy($src_img);
return true;
}
}
$open=@fopen("$news_base","a+");
@fwrite($open,"$titl||$news||$date||$short||$nnic||$avtor||$m_img||$b_img||\r\n");
@fclose($open);
@header("Location: http://$HTTP_HOST/news_admin.php");exit;
}
}
else
{
if($titl=="" or $short=="" or $news=="")
{
$er="Íóæíî çàïîëíèòü âñå ïîëÿ!";
@header("Location: http://$HTTP_HOST/news.php?add_news=add&er=$er"); exit;
}
else
{
$nickk=strip_tags($nickk,"");
$nickk = stripslashes ($nickk);
$titl= str_replace("|","¡",$titl);
$titl=strip_tags($titl,"");
$titl= str_replace("\r\n","",$titl);
$titl= str_replace("\n","",$titl);
$titl = stripslashes ($titl);
$short= str_replace("|","¡",$short);
$short=strip_tags($short,"");
$short= str_replace("\r\n","",$short);
$short= str_replace("\n","",$short);
$short = stripslashes ($short);
$news= str_replace("|","¡",$news);
$news=strip_tags($news,"<b><i><u><center>");
$news= str_replace("\r\n","<br>",$news);
$news= str_replace("\n","<br>",$news);
$news = stripslashes ($news);
$date=date("d.m.Y H:i");
if(@$nickk!="")
{
$avtor=@$nickk;
}
else
{
$avtor="íåèçâåñòíî";
}
if (@$m_img=="")
{
$m_img="";
$b_img="";
}
$open=@fopen("$temp_news","a+");
@fwrite($open,"$titl||$news||$date||$short||$nnic||$avtor||$m_img||$b_img||\r\n");
@fclose($open);
@header("Location: http://$HTTP_HOST/news.php");exit;
}
}
}
else
{
header("Location: http://$HTTP_HOST/index.php");exit;
}
?>
|
Подскажите пожалуста если не сложно! | |