Форум: Форум PHPФорум ApacheФорум Регулярные ВыраженияФорум MySQLHTML+CSS+JavaScriptФорум FlashРазное
Новые темы: 0000000
PHP Puzzles. Авторы: Кузнецов М.В., Симдянов И.В. Программирование. Ступени успешной карьеры. Авторы: Кузнецов М.В., Симдянов И.В. Объектно-ориентированное программирование на PHP. Авторы: Кузнецов М.В., Симдянов И.В. MySQL на примерах. Авторы: Кузнецов М.В., Симдянов И.В. Самоучитель PHP 5 / 6 (3 издание). Авторы: Кузнецов М.В., Симдянов И.В.
ВСЕ НАШИ КНИГИ
Консультационный центр SoftTime

Форум PHP

Выбрать другой форум

 

Здравствуйте, Посетитель!

вид форума:
Линейный форум Структурный форум

тема: проблема с вызовом функции
 
 автор: m@rchello   (12.03.2006 в 18:07)   письмо автору
 
 

Подскажите пожалуйста почему возникает эта ошибка?

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);
      
$titlstr_replace("|","&iexcl",$titl);
      
$titl=strip_tags($titl,"");
      
$titlstr_replace("\r\n","",$titl);
      
$titlstr_replace("\n","",$titl);
      
$titl stripslashes ($titl);
      
$shortstr_replace("|","&iexcl",$short);
      
$short=strip_tags($short,"");
      
$shortstr_replace("\r\n","",$short);
      
$shortstr_replace("\n","",$short);
      
$short stripslashes ($short);
      
$newsstr_replace("|","&iexcl",$news);
      
$news=strip_tags($news,"<b><i><u><center><font>");
      
$newsstr_replace("\r\n","<br>",$news);
      
$newsstr_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$smallimage133100);//Эта строчка на которую указывает ошибка
  
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_img255255255);
    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_img0000$w$h$size_img[0], $size_img[1]);
    if (
$size_img[2]==2)  imagejpeg($dest_img$smallimage);
    else if (
$size_img[2]==1imagegif($dest_img$smallimage);
    else if (
$size_img[2]==3imagepng($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="&#205;&#243;&#230;&#237;&#238; &#231;&#224;&#239;&#238;&#235;&#237;&#232;&#242;&#252; &#226;&#241;&#229; &#239;&#238;&#235;&#255;!";
      @
header("Location: http://$HTTP_HOST/news.php?add_news=add&er=$er"); exit;
      }
      else
      {
      
$nickk=strip_tags($nickk,"");
      
$nickk stripslashes ($nickk);
      
$titlstr_replace("|","&iexcl",$titl);
      
$titl=strip_tags($titl,"");
      
$titlstr_replace("\r\n","",$titl);
      
$titlstr_replace("\n","",$titl);
      
$titl stripslashes ($titl);
      
$shortstr_replace("|","&iexcl",$short);
      
$short=strip_tags($short,"");
      
$shortstr_replace("\r\n","",$short);
      
$shortstr_replace("\n","",$short);
      
$short stripslashes ($short);
      
$newsstr_replace("|","&iexcl",$news);
      
$news=strip_tags($news,"<b><i><u><center>");
      
$newsstr_replace("\r\n","<br>",$news);
      
$newsstr_replace("\n","<br>",$news);
      
$news stripslashes ($news);
      
$date=date("d.m.Y  H:i");
      if(@
$nickk!="")
      {
      
$avtor=@$nickk;
      }
      else
      {
      
$avtor="&#237;&#229;&#232;&#231;&#226;&#229;&#241;&#242;&#237;&#238;";
      }
      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;
}
?>

Подскажите пожалуста если не сложно!

   
 
 автор: Евгений Петров   (12.03.2006 в 18:37)   письмо автору
 
   для: m@rchello   (12.03.2006 в 18:07)
 

Поместите функцию resizeimg после строчки include "config.php";

   
Rambler's Top100
вверх

Rambler's Top100 Яндекс.Метрика Яндекс цитирования