Ir para conteúdo
Fórum Script Brasil
  • 0

upload


shelter

Pergunta

Boa galera, tenho um sistema de anuncio em que o cliente coloca o anuncio com figura, qual o drama , aqui em meu servidor local tudo bem TUDO FUNCIONA, mais quando coloco em meu provedor , quando tento fazer o upload de uma figura recebo a seguinte mesnsagem de erro:

Not enough permissions

File ../../imagens/capa/1a287752_570_235.jpg can not be created,

Set the permissions of the parentmap correctly

Please correct and try again

Warning: unlink(../../imagens/capa/1a287752_570_235.jpg) [function.unlink]: No such file or directory in /home/valmir/public_html/g/ScriptLibrary/incPureUpload.php on line 378

<?php
// --- Pure PHP File Upload -----------------------------------------------------
// Copyright 2003 (c) George Petrov, Patrick Woldberg, www.DMXzone.com
//
// Version: 2.1.2
// ------------------------------------------------------------------------------

class pureFileUpload
{
    // Set version
    var $version = '2.1.2';
    var $debugger = false;

    // Define variables
    var $path;
    var $extensions;
    var $redirectURL;
    var $storeType;
    var $sizeLimit;
    var $nameConflict;
    var $minWidth;
    var $minHeight;
    var $maxWidth;
    var $maxHeight;
    var $saveWidth;
    var $saveHeight;
    var $timeout;
    
    var $fullpath;
    var $uploadedFile;
    var $uploadedFiles;
    var $addOns;
    
    function pureFileUpload() {
        global $DMX_debug;
        $this->uploadedFile = new fileInfo($this);
        $this->uploadedFiles = array();
        $this->addOns = array();
        $this->debugger = $DMX_debug;
        $this->debug("<br/><font color=\"#009900\"><b>Pure PHP Upload version ".$this->version."</b></font><br/><br/>");
    }
    
    // Check if version is uptodate
    function checkVersion($version) {
        if ($version < $this->version) {
            $this->error('version');
        }
    }
    
    // Cleanup illegal characters
    function cleanUpFileName(&$file) {
        $this->debug("<b>CleanUp FileName</b><br/>");
        $fileName = $file->getFileName();
        $fileName = substr($fileName, strrpos($fileName, ':'));
        $fileName = preg_replace("/\s+|;|\+|=|\[|\]|'|,|\\|\"|\*|<|>|\/|\?|\:|\|/i", "_", $fileName);
        $this->debug("new filename = <font color=\"#000099\"><b>".$fileName."</b></font><br/>");
        $file->setFileName($fileName);
    }
    
    // Check the dimensions of the image
    function checkImageDimension(&$file) {
        global $HTTP_POST_VARS;
        
        $this->debug("<b>Checking Image Dimension</b><br/>");
        // Get the imageSize
        if ($imageSize = GetImageSize($this->path.'/'.$file->fileName)) {
            $this->debug("imageWidth = <font color=\"#000099\"><b>".$imageSize[0]."</b></font><br/>");
            $this->debug("imageHeight = <font color=\"#000099\"><b>".$imageSize[1]."</b></font><br/>");
            // Check if it isn't to small
            if (($this->minWidth <> '' && $imageSize[0] < $this->minWidth) || ($this->minHeight <> '' && $imageSize[1] < $this->minHeight)) {
                $this->error('smallSize', $file->fileName);
            }
            // Check if it isn't to big
            if (($this->maxWidth <> '' && $imageSize[0] > $this->maxWidth) || ($this->maxHeight <> '' && $imageSize[1] > $this->maxHeight)) {
                $this->error('bigSize', $file->fileName);
            }
            // Set the post vars with the imageSize
            $this->debug("Setting the imagesize in formfields<br/>");
            $file->setImageSize($imageSize[0], $imageSize[1]);
            $HTTP_POST_VARS[$this->saveWidth] = $imageSize[0];
            $HTTP_POST_VARS[$this->saveHeight] = $imageSize[1];
        }
    }
    
    // Check if directory exist and create if needed
    function checkDir($dir) {
        $this->debug("<b>Check path</b><br/>");
        if (!is_dir($dir)) {
            $this->debug("path does not exist<br/>");
            // Break directory apart
            $dirs = explode('/', $dir);
            $tempDir = $dirs[0];
            $check = false;
            
            for ($i = 1; $i < count($dirs); $i++) {
                $this->debug("Checking ".$tempDir."<br/>");
                if (is_writeable($tempDir)) {
                    $check = true;
                } else {
                    $error = $tempDir;
                }
                
                $tempDir .= '/'.$dirs[$i];
                // Check if directory exist
                if (!is_dir($tempDir)) {
                    if ($check) {
                        // Create directory
                        $this->debug("Creating ".$tempDir."<br/>");
                        mkdir($tempDir, 0777);
                        chmod($tempDir, 0777);
                    } else {
                        // Not enough permissions
                        $this->error('permission', $error);
                    }
                }
            }
        }
    }
    
    // Check the fileSize
    function checkFileSize(&$file) {
        $this->debug("<b>Checking fileSize</b><br/>");
        if ($this->sizeLimit < $file->fileSize) {
            $this->error('size', $file->fileName);
        }
    }
    
    // Check if the extension is allowed
    function checkExtension(&$file) {
        $this->debug("<b>Checking extension</b><br/>");
        $allow = false;

        // Loop thrue the extensions
        foreach (split(',', $this->extensions) as $extension) {
            
            // Check if it is allowed
            $this->debug("comparing <font color=\"#000099\"><b>".strtoupper($file->extension)."</b></font> with <font color=\"#000099\"><b>".strtoupper($extension)."</b></font><br/>");
            if (strtoupper($file->extension) == strtoupper($extension)) {
                $allow = true;
            }
        }
        
        // Give error when not allowed
        if (!$allow && $file->fileName <> '') {
            $this->error('extension', $file->fileName);
        }
    }
    
    // Create an unique name if file exists
    function createUniqName($fileName) {
        $this->debug("<b>Creating a unique name</b><br/>");
        $uniq = 0;
        $name = substr($fileName, 0, strrpos($fileName, '.'));
        $extension = substr($fileName, strrpos($fileName, '.')+1);
        
        while (++$uniq) {
            // Check if file does not exist
            $this->debug("Checking <font color=\"#000099\"><b>".$name.'_'.$uniq.'.'.$extension."</b></font><br/>");
            if (!file_exists($this->path.'/'.$name.'_'.$uniq.'.'.$extension)) {
                // Return an uniq filename
                return ($name.'_'.$uniq.'.'.$extension);
            }
        }
    }
    
    // Move the file to the given location
    function moveFile($source, $destination) {
        $this->debug("<b>Moving the file to the destination</b><br/>");
        // Check if you have write permissions
        $this->debug("Checking permissions<br/>");
        if (is_writeable($this->path)) {
            if (move_uploaded_file($source, $destination)) {
                // Change file permissions
                chmod($destination, 0644);
                // Add filename to array with done files
                $this->done[] = $destination;
                $this->debug("file moved to <font color=\"#000099\"><b>".$destination."</b></font><br/>");
            } else {
                // Give an error if no write permissions
                $this->error('writePerm', $destination);
            }
        } else {
            // Give an error if no write permissions
            $this->error('writePerm', $destination);
        }
    }
    
    function error($error, $extra) {
        switch ($error) {
        // Incorrect version
        case 'version':
        echo "<b>You don't have latest version of incPHPupload.php uploaded on the server.</b><br/>";
        echo "This library is required for the current page.<br/>";
            break;
        // Not enough permissions to create folder
        case 'permission':
            echo "<b>Not enough permissions</b><br/><br/>";
            echo "Folder <b>".$extra."</b> can not be created,<br/>";
            echo "Set the permissions of the parentmap correctly<br/>";
            break;
        // Not enough permissions to write an file
        case 'writePerm':
            echo "<b>Not enough permissions</b><br/><br/>";
            echo "File <b>".$extra."</b> can not be created,<br/>";
            echo "Set the permissions of the parentmap correctly<br/>";
            break;
        // The imagesize is to small
        case 'smallSize':
            echo "<b>Imagesize exceeds limit!</b><br/><br/>";
            echo "Uploaded Image ".$extra." is too small!<br/>";
            echo "Should be at least ".$this->minWidth." x ".$this->minHeight."<br/>";
            break;
        // The imagesize is to big
        case 'bigSize':
            echo "<b>Imagesize exceeds limit!</b><br/><br/>";
            echo "Uploaded Image ".$extra." is too big!<br/>";
            echo "Should be max ".$this->maxWidth." x ".$this->maxHeight."<br/>";
            break;
        // Filesize is to big
        case 'size':
            echo "<b>Size exceeds limit!</b><br/><br/>";
            echo "Filename: ".$extra."<br/>";
            echo "Upload size exceeds limit of ".$this->sizeLimit." kb<br/>";
            break;
        // Extension is not allowed
        case 'extension':
            echo "<b>Extension is not allowed!</b><br/><br/>";
            echo "Filename: ".$extra."<br/>";
            echo "Only the following file extensions are allowed: ".$this->extensions."<br/>";
            echo "Please select another file and try again.<br/>";
            break;
        // There was an error with the uploaded file
        case 'empty':        
            echo "<b>An error has occured saving uploaded file!</b><br/><br/>";
            echo "Filename: ".$extra."<br/>";
            echo "File is not uploaded correctly or is empty.<br/>";
            break;
        // File exists
        case 'exist':
            echo "<b>File already exists!</b><br/><br/>";
            echo "Filename: ".$extra."<br/>";
            break;
        }
        
        // Allow to go back and stop the script
        echo "Please correct and <a href=\"java script:history.back(1)\">try again</a>";
        
        $this->failUpload();
        // Stop the script
        exit;
    }
    
    function doUpload() {
        global $HTTP_POST_VARS,$HTTP_SERVER_VARS,$HTTP_POST_FILES;

        // Debugger info
        $this->debug("PHP version(<font color=\"#990000\">".phpversion()."</font>)<br/>");
        $this->debug("path(<font color=\"#990000\">".$this->path."</font>)<br/>");
        $this->debug("extensions(<font color=\"#990000\">".$this->extensions."</font>)<br/>");
        $this->debug("redirectURL(<font color=\"#990000\">".$this->redirectURL."</font>)<br/>");
        $this->debug("storeType(<font color=\"#990000\">".$this->storeType."</font>)<br/>");
        $this->debug("sizeLimit(<font color=\"#990000\">".$this->sizeLimit."</font>)<br/>");
        $this->debug("nameConflict(<font color=\"#990000\">".$this->nameConflict."</font>)<br/>");
        $this->debug("minWidth(<font color=\"#990000\">".$this->minWidth."</font>)<br/>");
        $this->debug("minHeight(<font color=\"#990000\">".$this->minHeight."</font>)<br/>");
        $this->debug("maxWidth(<font color=\"#990000\">".$this->maxWidth."</font>)<br/>");
        $this->debug("maxHeight(<font color=\"#990000\">".$this->maxHeight."</font>)<br/>");
        $this->debug("saveWidth(<font color=\"#990000\">".$this->saveWidth."</font>)<br/>");
        $this->debug("saveHeight(<font color=\"#990000\">".$this->saveHeight."</font>)<br/>");
        $this->debug("timeout(<font color=\"#990000\">".$this->timeout."</font>)<br/>");

        // Set the timeout
        $this->debug("Setting timeout<br/>");
        @set_time_limit($this->timeout);
        
        // Get the fullpath
        $this->fullPath = '/'.substr($HTTP_SERVER_VARS['PHP_SELF'], 1, strrpos($HTTP_SERVER_VARS['PHP_SELF'], '/')).$this->path.'/';
        $this->debug("fullPath = <font color=\"#000099\"><b>".$this->fullPath."</b></font><br/>");
        
        // Check if directory exists and create if needed
        $this->checkDir($this->path);
        
        // Go through all the files
        $this->debug("<b>Starting to progress files</b><br/>");
        foreach ($HTTP_POST_FILES as $field => $value) {
            $file = new fileInfo($this);
            $file->field = $field;
            $file->setfileName($HTTP_POST_FILES[$field]['name'],$HTTP_POST_FILES[$field]['size']);
            $this->debug("field = <font color=\"#000099\"><b>".$file->field."</b></font><br/>");
            $this->debug("filename = <font color=\"#000099\"><b>".$file->fileName."</b></font><br/>");
            
            // Clean file from illegal characters
            $this->cleanUpFileName($file);

            // Check filesize if limit is given
            if ($this->sizeLimit <> '') {
                $this->checkFileSize($file);
            }
            
            // Check the filename extension
            if ($this->extensions <> '') {
                $this->checkExtension($file);
            }
            
            // Check if file is uploaded correctly
            if (is_uploaded_file($HTTP_POST_FILES[$field]['tmp_name'])) {
                // Check if filename exists
                if (file_exists($this->path.'/'.$file->fileName)) {
                    // What to do if filename exists
                    switch ($this->nameConflict) {
                    // Overwrite the file
                    case 'over':
                        $this->debug("Overwrite existing file<br/>");
                        $this->moveFile($HTTP_POST_FILES[$field]['tmp_name'], $this->path.'/'.$file->fileName);
                        break;
                    // Give error message
                    case 'error':
                        $this->debug("Error<br/>");
                        $this->error('exist', $file->fileName);
                        break;
                    // Make an unique name
                    case 'uniq':
                        $file->setFileName($this->createUniqName($file->fileName));
                        $this->moveFile($HTTP_POST_FILES[$field]['tmp_name'], $this->path.'/'.$file->fileName);
                        break;
                    }
                } else {
                    // If filename does not exist
                    $this->moveFile($HTTP_POST_FILES[$field]['tmp_name'], $this->path.'/'.$file->fileName);
                }
                
                // Check the imagesize
                $this->checkImageDimension($file);
                
                // Put fileinfo in array
                $this->uploadedFiles[$field] = $file;
                
            } elseif ($file->fileName <> '') {
                // The file is 0 in size or is not uploaded correctly
                $this->error('empty', $file->fileName);
            } else {
                // No file is uploaded
                $HTTP_POST_VARS[$field] = '';
            }
        }
        
        // Recreate the redirectURL
        if ($this->redirectURL <> '') {
            if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
                $this->redirectURL .= (strpos($this->redirectURL, '?')) ? '&' : '?';
                $this->redirectURL .= $HTTP_SERVER_VARS['QUERY_STRING'];
            }
            header(sprintf("Location: %s", $this->redirectURL));
        }
    }
    
    // Debugger
    function debug($info) {
        if ($this->debugger) {
            echo "<font face=\"verdana\" size=\"2\">".$info."</font>";
        }
    }

    // Register addons and put them in an array
    function registerAddOn(&$addOn) {
        array_push($this->addOns, $addOn);
    }
    
    function failUpload() {
        foreach ($this->addOns as $addOn) {
            $addOn->cleanUp();
        }
        // Check if some files are already uploaded
        if (isset($this->uploadedFiles)) {
            if (count($this->uploadedFiles) > 0) {
                foreach ($this->uploadedFiles as $file) {
                    // Delete the file
                    unlink($this->path.'/'.$file->fileName);
                }
            }
        }
    }
}

class pureUploadAddon
{
    var $upload;
    
    function pureUploadAddon(&$upload) {
        $this->upload = &$upload;
    }
    
    function cleanUp() {
    }
}

class fileInfo
{
    var $field;
    var $fileName;
    var $fileSize;
    var $filePath;
    var $thumbFileName;
    var $thumbName;
    var $thumbExtension;
    var $thumbSize;
    var $thumbPath;
    var $thumbNaming;
    var $thumbSuffix;
    var $name;
    var $extension;
    var $imageWidth;
    var $imageHeight;
    var $thumbWidth;
    var $thumbHeight;
    
    var $upload;
    
    function fileInfo(&$upload) {
        $this->upload = &$upload;
    }
    
    function setFileName($newFileName, $fileSize = "") {
        global $HTTP_POST_VARS;
        $this->fileName = $newFileName;
        $this->filePath = $this->upload->path;
        $this->name = substr($newFileName, 0, strrpos($newFileName, '.'));
        $this->extension = substr($newFileName, strrpos($newFileName, '.')+1);
        if ($fileSize == "") {
            if (file_exists($this->upload->path."/".$this->fileName)) {
                $this->fileSize = round((filesize($this->upload->path."/".$this->fileName)/1024), 0);
            }
        } else {
            $this->fileSize = round(($fileSize/1024), 0);
        }
        if ($this->upload->storeType == 'path') {
            $HTTP_POST_VARS[$this->field] = $this->upload->fullPath.$this->fileName;
        } else {
            $HTTP_POST_VARS[$this->field] = $this->fileName;
        }
        $this->upload->uploadedFiles[$this->field] = $this;
    }

    function setThumbFileName($newFileName, $path, $naming, $suffix) {
        $this->thumbFileName = $newFileName;
        $this->thumbPath = $path;
        $this->thumbNaming = $naming;
        $this->thumbSuffix = $suffix;
        $this->thumbName = substr($newFileName, 0, strrpos($newFileName, '.'));
        $this->thumbExtension = substr($newFileName, strrpos($newFileName, '.')+1);
        if (file_exists($path."/".$this->thumbFileName)) {
            $this->thumbSize = round((filesize($path."/".$this->thumbFileName)/1024), 0);
        }
        $this->upload->uploadedFiles[$this->field] = $this;
    }

    function setThumbSize($width, $height) {
        $this->thumbWidth = $width;
        $this->thumbHeight = $height;
        $this->upload->uploadedFiles[$this->field] = $this;
    }

    function setImageSize($width, $height) {
        $this->imageWidth = $width;
        $this->imageHeight = $height;
        $this->upload->uploadedFiles[$this->field] = $this;
    }
    
    function getFileName() {
        return $this->fileName;
    }

    function getThumbFileName() {
        return $this->thumbFileName;
    }
}

?>

Então alguém saberia me falar o que posso fazer para coriigir este erro.

Grato aos amigo.

Abraços

Shelter

Link para o comentário
Compartilhar em outros sites

7 respostass a esta questão

Posts Recomendados

  • 0

Amigo

Tente Mudar o "CHMOD" do arquivo e da pasta de upload para

"777"

ou o seguinte Codigo

Coloque o Mesmo na Pasta do arquivo ou No Local onde se encontra a pasta dos uploads

<?php
chmod ("arquivo.php", 0777);
?>

no lugar do arquivo.php pode colocar a pasta

P:

Qual Arquivo ?

R:

O Arquivo Requisitando o UPLOAD e a Pasta onde vão os uploads

Espero Ter Ajudado Você Ate a Proxima ! ;)

Editado por DarknessX
Link para o comentário
Compartilhar em outros sites

  • 0

Se você tivesse buscado apenas a palavra "chmod" no google já teria a resposta, mas vamos lá...

Para alterar o chmod faça como já foi mostrado (pelo próprio PHP), ou pelo gerenciador de arquivos do site (pelo cpanel dá), ou pelo programa de FTP que você usar.

Link para o comentário
Compartilhar em outros sites

  • 0

Chmod não é nada mais nada menos

que um sistema para proteger arquivos

mudando o nivel de acesso como o exemplo abaixo

pasta home ( CHMOD 755 )
7 - O Dono Executa le e edita
5 - os membros de group Le e Executa
5 - pessoal de internet executa e le

7 = Acesso de Leitura , Execução , Edição
5 = Acesso de Leitura e  Execução
0 = Totalmente Restrito
1 = Somente Executa
2 = Somente Le
5 = Executa e Le
6 = Le e Edita

o primeiro Numero é acesso do Owner ( dono )

o segundo numero é acesso do Group ( Grupo )

o terceiro numero é acesso de todos ( Geral )

Editado por DarknessX
Link para o comentário
Compartilhar em outros sites

  • 0

Boa galera aqui mudei a permisão para 777 , agora tenho permisão para efetuar o upload , mais o programa não envia nem cadastra o anuncio, fica a pagina congelada com a seguinte mensagem na barra de end.:

http://www.tonobairro.com.br/g/galeria/adm...;GP_upload=true

boa galera

E desdee já obrigado pela ajuda.

Valmir Lopes

há desculpa o codigo para inserir os dados:

<?php
session_start();
include "functions.php";
session_checker();
?>

<?php require_once('../../../Connections/conection.php'); ?>
<?php
$con = mysql_connect("localhost", "valmir", "1272");
mysql_select_db("valmir_cadastro");
?>

<?php require_once('../../../ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('../../../ScriptLibrary/incResize.php'); ?>
<?php require_once('../../../ScriptLibrary/incPUAddOn.php'); ?>




<?php
// Pure PHP Upload 2.1.2
if (isset($HTTP_GET_VARS['GP_upload'])) {
    $ppu = new pureFileUpload();
    $ppu->path = "../../imagens/capa";
    $ppu->extensions = "GIF,JPG,JPEG,BMP,PNG";
    $ppu->formName = "fm_criaalbum";
    $ppu->storeType = "file";
    $ppu->sizeLimit = "2000";
    $ppu->nameConflict = "uniq";
    $ppu->requireUpload = "true";
    $ppu->minWidth = "";
    $ppu->minHeight = "";
    $ppu->maxWidth = "";
    $ppu->maxHeight = "";
    $ppu->saveWidth = "";
    $ppu->saveHeight = "";
    $ppu->timeout = "6600";
    $ppu->progressBar = "fileCopyProgress.htm";
    $ppu->progressWidth = "300";
    $ppu->progressHeight = "100";
    $ppu->checkVersion("2.1.2");
    $ppu->doUpload();
}
$GP_uploadAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) {
        $GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING']."&GP_upload=true";
    } else {
        $GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING'];
    }
} else {
  $GP_uploadAction .= "?"."GP_upload=true";
}

// Rename Uploaded Files Addon 1.0.3
if (isset($HTTP_GET_VARS['GP_upload'])) {
  $ruf = new renameUploadedFiles($ppu);
  $ruf->renameMask = "capa_album.jpg";
  $ruf->checkVersion("1.0.3");
  $ruf->doRename();
}

// Smart Image Processor 1.0.3
if (isset($HTTP_GET_VARS['GP_upload'])) {
  $sip = new resizeUploadedFiles($ppu);
  $sip->component = "GD";
  $sip->resizeImages = "true";
  $sip->aspectImages = "true";
  $sip->maxWidth = "300";
  $sip->maxHeight = "300";
  $sip->quality = "300";
  $sip->makeThumb = "false";
  $sip->pathThumb = "";
  $sip->aspectThumb = "true";
  $sip->naming = "suffix";
  $sip->suffix = "_small";
  $sip->maxWidthThumb = "";
  $sip->maxHeightThumb = "";
  $sip->qualityThumb = "70";
  $sip->checkVersion("1.0.3");
  $sip->doResize();
}

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if (isset($editFormAction)) {
  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
      if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) {
        $editFormAction .= "&GP_upload=true";
        }
  } else {
    $editFormAction .= "?GP_upload=true";
  }
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "fm_criaalbum")) {
  $insertSQL = sprintf("INSERT INTO Anuncio_Autos (Data_anuncio, IDUsuario, Capa, Fabricante, Fabricante_modelo, Modelo, Ano, Combustivel, Bairro, Valor, Parcelamento, Telefone_Fixo, Telefone_Celular, Site, Email, Contato, `Descricao`) VALUES (now(),  $IDUsuario, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s  )",
                       GetSQLValueString($HTTP_POST_VARS['Capa'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['categoria'], "text"),
                       GetSqlValueString($HTTP_POST_VARS['subcategoria'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Modelo'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Ano'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Combustivel'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Bairro'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Valor'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Parcelamento'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Telefone_Fixo'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Telefone_Celular'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Site'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Email'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Contato'],"text"),
                       GetSqlValueString($HTTP_POST_VARS['Descricao'],"text"));
                       $IDUsuario = $_GET[IDUsuario];


  mysql_select_db($database_conection, $conection);
  $Result1 = mysql_query($insertSQL, $conection) or die(mysql_error());


 if ($insertSQL) {


      //aqui  recupero o id do cadastro
      $IAn = mysql_insert_id($conection);

      //echo "<meta http-equiv='Refresh' content='0; url=recebe_strg.php?IdAnuncio=$IAn'>";
      echo "<meta http-equiv='Refresh' content='0; url=incluir_foto2.php?IdAnuncio=$IAn'>";

      /* Passando toString
      echo "<meta http-equiv='Refresh' content='0; url=acompanhar_validar.php?translate=$pid&session=$passw'>";
      */
   }


}


//antigo
/*local que direciona pagina apos insert
  $insertGoTo = "editar_albuns.php";
  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
*/


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Cadastro de anuncio:</title>
<style type="text/css">
<!--
.style5 {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
}

.style6 {
        font-family: Arial, Helvetica, sans-serif;
        color:#999999;
        font-size: 11px;
}


.TituloFieldset {
        font-family:Arial, Helvetica, sans-serif;
        font-size: 16px;
        color:#FF0000;

}




.fieldset {
         border: solid #CCCCCC 1px;
         width: 600px;
         
}
-->
</style>
<script language='javascript' src='../../../ScriptLibrary/incPureUpload.js'></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>

<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />

<!-- script ajax-->
<script language="javascript">function list_dados( valor )
{
http.open("GET", "result_passeio.php?id=" + valor, true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}

function handleHttpResponse()
{
campo_select = document.forms[0].subcategoria;
if (http.readyState == 4) {    campo_select.options.length = 0;
results = http.responseText.split(",");
for( i = 0; i < results.length; i++ )    {       string = results[i].split( "|" );
campo_select.options[i] = new Option( string[0], string[1] );
}
}
}



function getHTTPObject()
{var req; try { if (window.XMLHttpRequest) {  req = new XMLHttpRequest();
if (req.readyState == null) {   req.readyState = 1;
req.addEventListener("load", function () {   req.readyState = 4;
if (typeof req.onReadyStateChange == "function")    req.onReadyStateChange();
}, false);
}   return req;
}  if (window.ActiveXObject) {  var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"];
for (var i = 0; i < prefixes.length; i++) {
try {    req = new ActiveXObject(prefixes[i] + ".XmlHttp");    return req;   } catch (ex) {};   } }} catch (ex) {} alert("XmlHttp Objects not supported by client browser");}var http = getHTTPObject();// Logo aps fazer a verificao,  chamada a funo e passada // o valor  varivel global http.


</script>





</head>

<body>
<fieldset class="fieldset">
<legend  class="TituloFieldset">Cadastrar anúncio de autos</legend>
  
    <form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" name="fm_criaalbum" id="fm_criaalbum" >
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        
        
        
        <tr>
          <td align="right">&nbsp;</td>
          <td>&nbsp;</td>
          <td><span class="style6">* Arquivo de fotos suportados: .gif, .jpg e png tamanho maximo 1000Kb</span></td>
        </tr>
        <tr>
          <td width="140" align="right"><span class="style5">Foto Capa do Anúncio:</span></td>
          <td width="10">&nbsp;</td>
          <td><input name="Capa" type="file" id="Capa" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',true,2000,'','','','','','')" size="40" /></td>
        </tr>
        
        <!-- menu TIPO -->
        <tr>
          <td width="140" align="right"><span class="style5">Fabricante:</span></td>
          <td width="10">&nbsp;</td>
          <td><span id="spryselect3">
            <label>
          <select name="categoria" style="width:150px" onChange="list_dados( this.value )">


            <?php $consulta = mysql_query("SELECT * FROM tbl_categorias where tipo = 'Passeio' ORDER BY nome ASC");
                    while( $row = mysql_fetch_assoc($consulta) )
                    {
                    echo "<option value=\"{$row['codigo']}\">{$row['nome']}</option>\n";}?>
            </select>

            </label>

            <span class="selectRequiredMsg">Obrigatório!</span></span></td>
        </tr>
       <!-- fim menu TIPO -->
       


        <!-- fabricante -->
         <tr>
          <td width="140" align="right"><span class="style5">Modelo fabricante:</span></td>
          <td width="10">&nbsp;</td>
          <td><span id="spryselect1">
            <label>

            <select name="subcategoria" style="width:150px">
            </select>
            </label>
            <span class="selectRequiredMsg">Obrigatório!</span></span></td>
        </tr>
          

        <!-- Marca modelo -->

        <tr>
          <td width="140" align="right"><span class="style5">Modelo:</span></td>
          <td width="10">&nbsp;</td>
          <td><span id="sprytextfield2">
            <input name="Modelo" type="text" id="Modelo" size="19" />
          <span class="textfieldRequiredMsg">Obrigatório!</span></span></td>
        </tr>
         
           <!-- Ano fabricação -->
          <tr>
          <td width="140" align="right"><span class="style5">Ano fabricação:</span></td>
          <td width="10">&nbsp;</td>
           <td><span id="spryselect2">
            <select name="Ano" id="Ano" style="width:150px">
              <option selected="selected"></option>
              <option value="1960">1960</option>
              <option value="1961">1961</option>
              <option value="1962">1962</option>
              <option value="1963">1963</option>
              <option value="1964">1964</option>
              <option value="1965">1965</option>
              <option value="1966">1966</option>
              <option value="1967">1967</option>
              <option value="1968">1968</option>
              <option value="1969">1969</option>
              <option value="1970">1970</option>
              <option value="1971">1971</option>
              <option value="1972">1972</option>
              <option value="1973">1973</option>
              <option value="1974">1974</option>
              <option value="1975">1975</option>
              <option value="1976">1976</option>
              <option value="1977">1977</option>
              <option value="1978">1978</option>
              <option value="1979">1979</option>
              <option value="1980">1980</option>
              <option value="1981">1981</option>
              <option value="1982">1982</option>
              <option value="1983">1983</option>
              <option value="1984">1984</option>
              <option value="1985">1985</option>
              <option value="1986">1986</option>
              <option value="1987">1987</option>
              <option value="1988">1988</option>
              <option value="1989">1989</option>
              <option value="1990">1990</option>
              <option value="1991">1991</option>
              <option value="1992">1992</option>
              <option value="1993">1993</option>
              <option value="1994">1994</option>
              <option value="1995">1995</option>
              <option value="1996">1996</option>
              <option value="1997">1997</option>
              <option value="1998">1998</option>
              <option value="1999">1999</option>
              <option value="2000">2000</option>
              <option value="2001">2001</option>
              <option value="2002">2002</option>
              <option value="2003">2003</option>
              <option value="2004">2004</option>
              <option value="2005">2005</option>
              <option value="2006">2006</option>
              <option value="2007">2007</option>
              <option value="2008">2008</option>
              <option value="2009">2009</option>
            </select>
            <span class="selectRequiredMsg">Obrigatório!</span></span></td>
        </tr>
          
          <!-- Esta com erro -->
          <!-- Combustivel -->
           <tr>
             <td align="right"><span class="style5">Combustível:</span></td>
             <td>&nbsp;</td>
             <td><span id="spryselect7">
               <label>
               <select name="Combustivel" id="Combustivel" style="width:150px">

               <option selected="selected"></option>
              <option value="Alcool">Alcool</option>
              <option value="Diesel">Diesel</option>
              <option value="Flex">Flex</option>
              <option value="Gasolina">Gasolina</option>
              <option value="Gasolina/GNV">Gasolina/GNV</option>
               </select>
               </label>
             <span class="selectRequiredMsg">Obrigatório!</span></span></td>
           </tr>


           <!-- Bairro -->
           <tr>
          <td width="140" align="right"><span class="style5">Bairro:</span></td>
          <td width="10">&nbsp;</td>
        <td><span id="spryselect4">
            <select name="Bairro" id="Bairro" style="width:150px">
              <option selected="selected"></option>
              <option value="bangu">Bangu</option>
              <option value="barra de guaratiba">Barra de Guaratiba</option>
              <option value="campo grande">Campo Grande</option>
              <option value="ilha de guaratiba">Ilha de Guaratiba</option>
              <option value="magarça">Magarça</option>
              <option value="padre miguel">Padre Miguel</option>
              <option value="pedra de guaratiba">Pedra de Guaratiba</option>
              <option value="realengo">Realengo</option>
              <option value="santa cruz">Santa Cruz</option>
              <option value="sulacap">Sulacap</option>
            </select>
            <span class="selectRequiredMsg">Obrigatório!</span></span></td>
           </tr>
           
        <!-- Valor -->
        <tr>
          <td width="140" align="right"><span class="style5">Valor R$:</span></td>
          <td width="10">&nbsp;</td>
          <td><span id="sprytextfield3">
          <input name="Valor" type="text" id="Valor" size="19" />
          <span class="textfieldRequiredMsg">Obrigatório!</span><span class="textfieldInvalidFormatMsg">*Separar centavos por ponto Ex.:1000.30</span></span></td>
          </tr>
         <tr>
          <td width="140" align="right"><span class="style5">Condições & Parcelamentos:</span></td>
          <td width="10">&nbsp;</td>
      <td><span id="spryselect5">
          <select name="Parcelamento" id="Parcelamento" style="width:280px">
            <option selected="selected"></option>
            <option value="A Vista">À vista</option>
            <option value="Em até 12X">Parcelamos em até 12X</option>
            <option value="Em até 18X">Parcelamos em até 18X</option>
            <option value="Em até 24X">Parcelamos em até 24X</option>
            <option value="Em até 36X">Parcelamos em até 36X</option>
            <option value="Em até 48X">Parcelamos em até 48X</option>
            <option value="Em até 60X">Parcelamos em até 60X</option>
            <option value="Consulte">Consulte outros parcelamentos</option>
          </select>
          <span class="selectRequiredMsg">Obrigatório.</span></span></td>
        </tr>
        
        
        
        
        <!-- telefone -->
        <tr>
          <td width="140" align="right"><span class="style5">Telefone:</span></td>
          <td width="10">&nbsp;</td>
        <td><span id="sprytextfield4">
        <input name="Telefone_Fixo" type="text" id="Telefone_Fixo" size="19" />
        <span class="textfieldRequiredMsg">Obrigatório!</span><span class="textfieldInvalidFormatMsg">Inválido, Ex.:2222-2222!</span></span></td>
        </tr>

        <!-- Celular -->
        <tr>
          <td width="140" align="right"><span class="style5">Celular:</span></td>
          <td width="10">&nbsp;</td>
          <td><span id="sprytextfield7">
          <input name="Telefone_Celular" type="text" id="Telefone_Celular" size="19" />
          <span class="textfieldInvalidFormatMsg">Inválido, Ex.:2222-2222!</span></span></td>
          </tr>
          
          <!-- Site -->
          <tr>
          <td width="140" align="right"><span class="style5">Site:</span></td>
          <td width="10">&nbsp;</td>
          <td><span id="sprytextfield8">
            <input name="Site" type="text" id="Site" size="40" />
          <span class="textfieldRequiredMsg">Obrigatório!</span><span class="textfieldInvalidFormatMsg">Inválido! Ex. http://www.tonobairro.com.br</span></span></td>
        </tr>

        <!-- email -->
        <tr>
          <td width="140" align="right"><span class="style5">E-mail:</span></td>
          <td width="10">&nbsp;</td>
          <td><span id="sprytextfield9">
          <input name="Email" type="text" id="Email" size="40" />
          <span class="textfieldRequiredMsg">Obrigatório!.</span><span class="textfieldInvalidFormatMsg">E-mail inválido!</span></span></td>
           </tr>
          
          <!-- Contato -->
          <tr>
          <td width="140" align="right"><span class="style5">Contato:</span></td>
          <td width="10">&nbsp;</td>
        <td><span id="sprytextfield5">
            <input name="Contato" type="text" id="Contato" size="40" />
        <span class="textfieldRequiredMsg">Obrigatório!</span></span></td>
          </tr>
          

          <!-- descrição -->
          <tr>
            <td align="right">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="right">&nbsp;</td>
            <td>&nbsp;</td>
            <td><span class="style6">* Espaço reservado para descrição de acessórios e outros.</span></td>
          </tr>
          <tr>
          <td width="140" align="right"><span class="style5">Descrição:</span></td>
          <td width="10">&nbsp;</td>
          <td><span id="sprytextfield5"><span id="sprytextarea1">
        <label>
        <textarea name="Descricao" id="Descricao" cols="50" rows="5"></textarea>
        <span id="countsprytextarea1">&nbsp;</span>        <span class="textareaMinCharsMsg">Descrição mínima com 20 caracter!</span> <span class="textareaMaxCharsMsg">Máxímo de caracter 250.</span></label>
            </span>            <span class="textfieldRequiredMsg">Obrigatório!</span></span></td>
          </tr>
        
          <tr>
            <td align="right">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        <tr>
          <td width="140" align="right"><span class="style6"></span></td>
          <td width="10">&nbsp;</td>
          <td><input type="submit" name="btn_criaalbum" id="btn_criaalbum" value="Enviar Anúncio" />
          <label></label></td>
        </tr>
        <tr>
          <td align="right">&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
      <input type="hidden" name="MM_insert" value="fm_criaalbum">
    </form>
   </fieldset>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["blur"]});
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {validateOn:["blur"]});
var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {validateOn:["blur"]});
var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {validateOn:["blur"]});
var spryselect4 = new Spry.Widget.ValidationSelect("spryselect4", {validateOn:["blur"]});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "currency", {validateOn:["blur"]});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "phone_number", {validateOn:["blur"], format:"phone_custom", pattern:"0000-0000"});
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "none", {validateOn:["blur"]});
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield6", "none", {validateOn:["blur"]});
var spryselect5 = new Spry.Widget.ValidationSelect("spryselect5", {validateOn:["blur"]});
var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "phone_number", {format:"phone_custom", pattern:"0000-0000", validateOn:["blur"], isRequired:false});
var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "url", {validateOn:["blur"], isRequired:false});
var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9", "email", {validateOn:["blur"], isRequired:false});
var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1", {isRequired:false, minChars:20, maxChars:250, counterId:"countsprytextarea1", counterType:"chars_count", validateOn:["blur"]});
var spryselect6 = new Spry.Widget.ValidationSelect("spryselect6", {validateOn:["blur"]});
var spryselect7 = new Spry.Widget.ValidationSelect("spryselect7", {validateOn:["blur"]});
//-->
</script>
</body>
</html>

Boa galera Vlw

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...