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

Форум PHP

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

 

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

вид форума:
Линейный форум (новые сообщения вниз) Структурный форум

тема: проблема с вызовом функции

Сообщения:  [1-2] 

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

Поместите функцию resizeimg после строчки include "config.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);
      
$titl= str_replace("|","&iexcl",$titl);
      
$titl=strip_tags($titl,"");
      
$titl= str_replace("\r\n","",$titl);
      
$titl= str_replace("\n","",$titl);
      
$titl = stripslashes ($titl);
      
$short= str_replace("|","&iexcl",$short);
      
$short=strip_tags($short,"");
      
$short= str_replace("\r\n","",$short);
      
$short= str_replace("\n","",$short);
      
$short = stripslashes ($short);
      
$news= str_replace("|","&iexcl",$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="&#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);
      
$titl= str_replace("|","&iexcl",$titl);
      
$titl=strip_tags($titl,"");
      
$titl= str_replace("\r\n","",$titl);
      
$titl= str_replace("\n","",$titl);
      
$titl = stripslashes ($titl);
      
$short= str_replace("|","&iexcl",$short);
      
$short=strip_tags($short,"");
      
$short= str_replace("\r\n","",$short);
      
$short= str_replace("\n","",$short);
      
$short = stripslashes ($short);
      
$news= str_replace("|","&iexcl",$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="&#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;
}
?>

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

   

Сообщения:  [1-2] 

Форум разработан IT-студией SoftTime
Rambler's Top100
вверх

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