Ir para conteúdo
Fórum Script Brasil

wawasurf

Membros
  • Total de itens

    38
  • Registro em

  • Última visita

Posts postados por wawasurf

  1. Eu peguei um script que faz um filtro de palavras, só que ele funciona de uma maneira errada, tipo:

    Esse é o código que peguei:

    $texto = $_POST['msg'];
    function Filtro($texto){
    $filtro = array (
    "viagra" => "xxx",
    "cialis" => "xxx",
    "porn" => "xxx",
    "replica" => "xxx"
    );
    
    foreach ($filtro as $errado => $certo){
    $texto = preg_replace ("/".$errado."/i", $certo, $texto);
    }
    return $texto;
    }
    
    if ($texto == Filtro ($texto)){
    echo"eu";
    
    }else{
    //não acontece nada
    }

    Essas são as palavras-chaves que coloquei por enquanto: viagra, cialis, porn, replica, mais ele não verifica a palavra e sim a letra. Se eu colocar por exemplo a letra "r" no formulario ele não deixa passar porque na lista de plavras-chaves tem palavras com a letra "r". Queria que o script veja a palavra e não as letras, como posso fazer isso?

  2. Olá,

    Estou com um sério problema de span em um mural de recados, fiz a verificação por imagem com o php mais mesmo assim, continuam enviando span!!

    Gostaria de saber quais alternativas posso adotar para evitar esses span

  3. Olá

    Tenho um código aqui que faz uma barra de rolagem em javascript com imagens, só que ele está na vertical ( | ) , queria saber se tem como fazer essa mesma barra de rolagem na horinzonta ( - ). Estou fazendo um album de fotos e quero mostrar as fotos na horizontal com um barra de rolagem personalizada com imagens usando jascritpt.

    Meu coódigo:

    <html>
    <head>
    <title>Rich Edit Component (WebFX)</title>
    </head>
    <body>
    
    <style type="text/css">
    #divUp  {position:absolute; left:170px; top:190px;}
    #divDown {position:absolute; left:170px; top:380px;}
    #divScrollTextCont {position:absolute; left:170px; top:220px;
    width:426px; height:158px; clip:rect(0px 447px 221px 0px); overflow:hidden;}
    #divText {position:absolute; left:700px; top:0px;}
    
    .FormObjects
    {
        COLOR: #000000;
        FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
        FONT-SIZE: 7pt;
        FONT-STYLE: normal;
        FONT-WEIGHT: normal
    }
    
    </style>
    
    <script language="JavaScript" type="text/javascript">
    function lib_bwcheck(){ //Browsercheck (needed)
    this.ver=navigator.appVersion
    this.agent=navigator.userAgent
    this.dom=document.getElementById?1:0
    this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
    this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
    this.ie=this.ie4||this.ie5||this.ie6
    this.mac=this.agent.indexOf("Mac")>-1
    this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
    return this
    }
    var bw=new lib_bwcheck()
    
    var speed = 30
    
    var loop, timer
    
    function makeObj(obj,nest){
        nest=(!nest) ? "":'document.'+nest+'.'
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
    this.up=goUp;this.down=goDown;
    this.moveIt=moveIt; this.x=0; this.y=0;
        this.obj = obj + "Object"
        eval(this.obj + "=this")
        return this
    }
    
    var px = bw.ns4||window.opera?"":"px";
    
    function moveIt(x,y){
    this.x = x
    this.y = y
    this.css.left = this.x+px
    this.css.top = this.y+px
    }
    
    function goDown(move){
    if (this.y>-this.scrollHeight+oCont.clipHeight){
      this.moveIt(0,this.y-move)
      if (loop) setTimeout(this.obj+".down("+move+")",speed)
    }
    }
    function goUp(move){
    if (this.y<0){
      this.moveIt(0,this.y-move)
      if (loop) setTimeout(this.obj+".up("+move+")",speed)
    }
    }
    
    function scroll(speed){
    if (scrolltextLoaded){
      loop = true;
      if (speed>0) oScroll.down(speed)
      else oScroll.up(speed)
    }
    }
    
    function noScroll(){
    loop = false
    if (timer) clearTimeout(timer)
    }
    var scrolltextLoaded = false
    function scrolltextInit(){
    oCont = new makeObj('divScrollTextCont')
    oScroll = new makeObj('divText','divScrollTextCont')
    oScroll.moveIt(0,0)
    oCont.css.visibility = "visible"
    scrolltextLoaded = true
    }
    if (bw.bw) onload = scrolltextInit
    
    </script>
    
      <div align="right"><a href="#" onMouseOver="scroll(-2)" onMouseOut="noScroll()" onClick="return false"><img src="../../cima.gif" width="12" height="6" >
        </a> </div>
    </div>
    <div id="divScrollTextCont" style="left: 317px; top: 150px; width: 447px; height: 221px">
      <div id="divText" style="" >
        <p align=justify> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
          <b>TESTE DE SCROLL AUTOMATICO</b><br><br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>                 
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>
          teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste  teste teste teste teste teste<br>
          linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha linha<br>                                               
          </font>
        <p>&nbsp; </p>
      </div>
    </div>
      <div align="right"><a href="#" onMouseOver="scroll(2)" onMouseOut="noScroll()" onClick="return false"><img src="baixo.gif" width="12" height="6" ></a>
      </div>
    
    </body>
    
    </html>

  4. Olá,

    Estou fazendo um album de fotos, já consegui mostrar todas as imagens de uma determinada pasta do servidor, agora queria saber como faço para mostrar o resultado em colunas com um fundo background em cada imagem tipo como se fosse uma borda ao redor da imagem!!

    Aqui esta meu código

    <?
    require_once ("../admin/conecta.php");
    
    $sql="SELECT * FROM fotos WHERE codigo='$codigo'";
    
    $query=mysql_query($sql);
    
    while($sql = mysql_fetch_array($query)){
    $codigo =         $sql["codigo"];
    $evento =         $sql["evento"];
    $data =         $sql["data"];
    $dir =         $sql["pasta"];
    $foto_por =     $sql["foto_por"];
    
    
    $pasta = "/var/www/casamarketing.com.br/1051/galerias_fotos/fotos/$dir/"; // Pasta de onde estão as fotos (se o arquivo estiver na mesma pasta das fotos bote apenas "./")
    
    $open = opendir("$pasta/"); //Abre a pasta
    while ($foto = readdir($open)) { //Lê a pasta
    if (eregi(".jpg",$foto)) { //Verifica se o arquivo é mesmo JPG
    
    echo "
    <a href=\"fotos/$dir/$foto\" target=\"foto\">
    
    <img border=0 src=\"gerar_thumb.php?filename=fotos/$dir/$foto\" >
    
    </a>"; //Mostra as thumbs
    }
    }
    }
    ?>

  5. Olá,

    Estou fazendo um script para enviar várias fotos de uma vez só redimensionando cada foto para o tamnho desejado, estou usando o for para estrutua de repetição. Esta dando um erro no getmisize: Warning: getimagesize(f): failed to open stream: No such file or directory in /var/www/casamarketing.com.br/1051/galerias_fotos/uploadimage.php on line 29

    Erro no arquivo . Poderiam me dizer o que esta errado no script?

    Função para redimensionar as fotos

    <?php
        require_once "../admin/verifica.php";
        
        function verifica_dimensao_image($img, $max_x, $max_y)
        {
            $dimensaoImage = getimagesize($img["tmp_name"]);
            $dimensao = '';
            // Verifica largura
            if($dimensaoImage[0] > $dimensaoImage[1])
            {
                if($dimensaoImage[0] > $max_x)
                {
                    $dimensao = 'largura';
                }
            }
            else
            {
                if($dimensaoImage[0] < $dimensaoImage[1])
                {
                    if($dimensaoImage[1] > $max_x)
                    {
                        $dimensao = 'altura';
                    }
                }
                else
                {
                    if($dimensaoImage[0] == $dimensaoImage[1])
                    {
                        if($dimensaoImage[0] > $max_x)
                        {
                            $dimensao = 'largura';
                        }
                    }
                }
            }
            return ($dimensao);        
        }//fim verifica_dimensao_image
        
        function reduz_imagem($img, $max_x, $max_y, $nome_foto) 
        {
            //pega o tamanho da imagem ($original_x, $original_y)
            list($width, $height) = getimagesize($img);
            $original_x = $width;
            $original_y = $height;
            // se a largura for maior que altura
            if($original_x > $original_y) {
                   $porcentagem = (100 * $max_x) / $original_x;      
            } 
            else {
                   $porcentagem = (100 * $max_y) / $original_y;
            }
            $tamanho_x = $original_x * ($porcentagem / 100);
            $tamanho_y = $original_y * ($porcentagem / 100);
            $image_p = imagecreatetruecolor($tamanho_x, $tamanho_y);
            $image   = imagecreatefromjpeg($img);
            imagecopyresampled($image_p, $image, 0, 0, 0, 0, $tamanho_x, $tamanho_y, $width, $height);
            return imagejpeg($image_p, $nome_foto, 100);
        }//fim reduz_imagem
        
        function verifica_image($img)
        {
            // Verifica se o mime-type do arquivo é de imagem
            if(eregi("^image\/(pjpeg|jpeg|png|gif|bmp)$", $img["type"]))
            {
                return (TRUE);
            }
            return (FALSE);
        }// fim verifica_image
        
        function verifica_extensao_image($img)
        {
            // Pega extensão do arquivo
            preg_match("/\.(gif|bmp|png|jpg|jpeg){1}$/i", $img["name"], $ext);
            return ($ext[1]);
        }//fim verifica_extensao_imag
        
        
    ?>
    Script para enviar as fotos redimensionadas
    <?
        require_once "../admin/conecta.php";
        require_once "../admin/conecta.php";
        require_once "functionsUpload.php";
    
    
    //Elimita o limite de tempo do php_timeout();
    
    set_time_limit(0);
    
    //Pasta para aonde deve ir os arquivos sem barra do inicio nem final
     $pasta =$_POST['pasta'];
    
     $caminho_dos_arquivos = "/var/www/casamarketing.com.br/1051/galerias_fotos/fotos/$pasta/";
    
     for($i=1; $i<=10; $i++)
    
     {
    
         //pega os nomes dos campos files (prefixo + numero crescente)
    
          $id_arquivo = "foto_$i"; 
    
    $max_image_x = 267;
    $max_image_y = 200;
    
          $nome_arquivo = $_FILES[$id_arquivo]["name"];
    
        $tamanho = getimagesize($id_arquivo["tmp_name"]);
         ini_set ("max_execution_time", 3600); // uma hora
        $err = FALSE;
        if(is_uploaded_file($id_arquivo['tmp_name']))
        {
            if(verifica_image($id_arquivo))
            {
                $tamanho = getimagesize($id_arquivo["tmp_name"]);
                $dimensiona = verifica_dimensao_image($id_arquivo, $max_image_x, $max_image_y);
                if($dimensiona != '')
                {
                    if($dimensiona == 'altura')
                    {
                            $auxImage = $max_image_x;
                            $max_image_x = $max_image_y;
                            $max_image_y = $auxImage;
                    }
                }
                else
                {
                    $max_image_x = $tamanho[0];
                    $max_image_y = $tamanho[1];
                }
                
                $nome_foto  = ('foto'.$i.'_' . time() . '.' . verifica_extensao_image($arquivo));// nome único para foto
                $endFoto = $diretorio . $nome_foto;
                if(reduz_imagem($id_arquivo['tmp_name'], $max_image_x, $max_image_y, $endFoto))
                {
                    $err = TRUE;
                }  
            }
        }
    
          // faz o upload dos arquivos
    
    
    
          if(move_uploaded_file($tamanho, "$caminho_dos_arquivos/$nome_arquivo"))
    
          {
    
              echo "O Arquivo <b>$nome_arquivo</b> foi concluido com sucesso<BR>";
    
          }
    
          else
    
          {
    
               echo "Erro no arquivo <b>$nome_arquivo</b><BR>";
    
         }
    
    }
    
     ?>

  6. não esta dando certo, olha como estou fazendo:

    aqui seleciona a foto

    <input name="foto" type="file" id="foto" class="formtext" />

    aqui pega o nome da foto e grava no banco

    $foto =$_FILES['foto']['name'];

    Mais o campo da foto fica em branco

    Fiz alguma coisa de errado?

  7. Olá,

    Tenho esse imput type:file para enviar o nome foto destaque para o banco de dados:

    <input name="foto" type="file" id="foto" class="formtext" />

    quando eu seleciono a foto, o script envia para o banco o nome do caminho inteiro da foto, tipo esse: C:\Documents and Settings\wagner\Meus documentos\M..., como eu faço para o script pegar somente o nome da foto e não o caminho inteiro?

    Para pegar o valor do imput type: file, já o usei o $_POST, que pega o caminho intero da foto, e depois usei o $_FILES, com esse, não grava nada no banco, fica em branco.

    Obrigado desde já :P

  8. Olá,

    Tenho um banco de dados onde contém as seguintes tabelas: nome_empresa, categoria, cidade, telefone. Como eu poderia fazer um sistema de busca onde o usuário escolha uma cidade e lista todas as empresas da cidade escolhida cadastrada no banco de dados? Tipo ele ecolhe a cidade Criciúma e o script faz uma busca no meu banco de dados, de todas as empresas que estão cadastrada na cidade Criciúma!!

    Valeu!!

  9. Olá,

    Gostaria de saber como eu faço para fazer o redimensionanento automático usando o php quando o tamanho da imagem ultrapassar o tamanho definido pelo script, tenho um código aqui que faz o upload e que se a imagem for maior que 500x375 ele não deixa "upar" a foto. Mais eu queria que ele redimensionasse a foto casa ela pase do tamanho!

    Desde já agradeço

    $foto1_tmp                    =$_FILES['foto1']['tmp_name'];
    $tamanhos_foto1             = getimagesize($foto1_tmp); // Pega os pixels da imagem
    $tamanho_foto1["largura"]    = 500; // Cria array da imagem da largura;
    $tamanho_foto1["altura"]     = 375; // Cria Cria array da imagem da altura;
    $foto1_tipo_imagem            =$_FILES['foto1']['type'];
    $foto1_file_name              =$_FILES['foto1']['name'];
    $foto1_file_name = explode(".",$foto1_file_name);
    $foto1_file_name = mktime()."_1.".$foto1_file_name[1];

  10. Olá,

    Tenho um formulario de cadastro, eu queria que quando fossem gravadas as informações contidas no formulario, gravasse automaticamente em minha página para que outros usuários possam ver. Tem como fazer isso?

    Um abraço, wagner

×
×
  • Criar Novo...