Jump to content


André - MundoNX's Content

There have been 8 items by André - MundoNX (Search limited from 29/03/2023)


Ordernar por                Order  

#1007447 Captcha + Javascript ?

Posted by André - MundoNX on 02/02/2011, 10:23 in PHP

DИL, Olá também estou com o mesmo problema tava tentando outro ai hj pela manhã achei este aqui veja se te ajuda melhor.

<html>
<head>
<title>Captcha</title>
    
    <script type="text/javascript">

   //Created / Generates the captcha function    
    function DrawCaptcha()
    {
        var a = Math.ceil(Math.random() * 10)+ '';
        var b = Math.ceil(Math.random() * 10)+ '';       
        var c = Math.ceil(Math.random() * 10)+ '';  
        var d = Math.ceil(Math.random() * 10)+ '';  
        var e = Math.ceil(Math.random() * 10)+ '';  
        var f = Math.ceil(Math.random() * 10)+ '';  
        var g = Math.ceil(Math.random() * 10)+ '';  
        var code = a + ' ' + b + ' ' + ' ' + c + ' ' + d + ' ' + e + ' '+ f + ' ' + g;
        document.getElementById("txtCaptcha").value = code
    }

    // Validate the Entered input aganist the generated security code function   
    function ValidCaptcha(){
        var str1 = removeSpaces(document.getElementById('txtCaptcha').value);
        var str2 = removeSpaces(document.getElementById('txtInput').value);
        if (str1 == str2) return true;        
        return false;
        
    }

    // Remove the spaces from the entered and generated code
    function removeSpaces(string)
    {
        return string.split(' ').join('');
    }
    
 
    </script>
    
    
    
</head>
<body onload="DrawCaptcha();">
<table>
<tr>
    <td>
        Welcome To Captcha<br />
    </td>
</tr>
<tr>
    <td>
        <input type="text" id="txtCaptcha" 
            style="background-image:url(1.jpg); text-align:center; border:none;
            font-weight:bold; font-family:Modern" />
        <input type="button" id="btnrefresh" value="Refresh" onclick="DrawCaptcha();" />
    </td>
</tr>
<tr>
    <td>
        <input type="text" id="txtInput"/>    
    </td>
</tr>
<tr>
    <td>
        <input id="Button1" type="button" value="Check" onclick="alert(ValidCaptcha());"/>
    </td>
</tr>
</table>
</body>
</html>

Attached Images

  • 1.jpg



#1007527 Captcha Validar No Meu Formulario

Posted by André - MundoNX on 04/02/2011, 08:31 in PHP

wochsyp,
Obrigado Vou da uma Olhada sim!



#1007426 Captcha Validar No Meu Formulario

Posted by André - MundoNX on 01/02/2011, 11:40 in PHP

Olá, Pessoal estou com dificuldade em fazer um função no meu formulario usando anti-spam.
Script Anti-span

CaptchaSecurityImages.php
<?php
session_start();

class CaptchaSecurityImages {

	var $font = 'monofont.ttf';

	function generateCode($characters) {
		/* list all possible characters, similar looking characters and vowels have been removed */
		$possible = '234567890bcdfghjkmnpqrstvwxyz';
		$code = '';
		$i = 0;
		while ($i < $characters) { 
			$code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);
			$i++;
		}
		return $code;
	}

	function CaptchaSecurityImages($width='120',$height='40',$characters='6') {
		$code = $this->generateCode($characters);
		/* font size will be 75% of the image height */
		$font_size = $height * 0.75;
		$image = @imagecreate($width, $height) or die('Não é possível inicializar fluxo nova imagem GD');
		/* set the colours */
		$background_color = imagecolorallocate($image, 255, 255, 255);
		$text_color = imagecolorallocate($image, 20, 40, 100);
		$noise_color = imagecolorallocate($image, 100, 120, 180);
		/* generate random dots in background */
		for( $i=0; $i<($width*$height)/3; $i++ ) {
			imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color);
		}
		/* generate random lines in background */
		for( $i=0; $i<($width*$height)/150; $i++ ) {
			imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);
		}
		/* create textbox and add text */
		$textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Erro na função imagettfbbox');
		$x = ($width - $textbox[4])/2;
		$y = ($height - $textbox[5])/2;
		imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code) or die('Erro na função imagettftext');
		/* output captcha image to browser */
		header('Content-Type: image/jpeg');
		imagejpeg($image);
		imagedestroy($image);
		$_SESSION['security_code'] = $code;
	}

}

$width = isset($_GET['width']) ? $_GET['width'] : '120';
$height = isset($_GET['height']) ? $_GET['height'] : '40';
$characters = isset($_GET['characters']) && $_GET['characters'] > 1 ? $_GET['characters'] : '6';

$captcha = new CaptchaSecurityImages($width,$height,$characters);

?>

Formulario:
<?php 
session_start();

if( isset($_POST['submit'])) {
   if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
		// Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
		echo 'Thank you. Your message said "'.$_POST['message'].'"';
		unset($_SESSION['security_code']);
   } else {
		// Insert your code for showing an error message here
		echo 'Sorry, you have provided an invalid security code';
   }
} else {
?>

	<form action="form.php" method="post">
		<img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" /><br />
		<label for="security_code">Security Code: </label><input id="security_code" name="security_code" type="text" /><br />
		<input type="submit" name="submit" value="Submit" />
	</form>

<?php
	}
?>

Esta parte de cima o codigo do anti-spam

Agora o condigo do meu fomulario que estou querendo fazer a junção.
<form action="?pg=comentarios" method=post enctype="multipart/form-data" name=formMaker onsubmit="return validar(this)">
<input name="acao" type="hidden" value="add_comentario">
<input name="id" type="hidden" value="<? echo $id?>">

<table border="0" align="center" cellpadding="2" cellspacing="0"> 


<tr valign=middle> 
<td align=right style="border-bottom:1px solid #cccccc;border-top:1px solid #cccccc;">Nome:</td> 
<td width="300" style="border-bottom:1px solid #cccccc;border-top:1px solid #cccccc;"> 
    <input name="nome" type="text" size="45"></td> 
</tr>
<tr valign=middle>
  <td align=right style="border-bottom:1px solid #cccccc">Coment&aacute;rio</td>
  <td style="border-bottom:1px solid #cccccc"><textarea name="comentarios" cols="44" rows="5" id="comentarios"></textarea></td>
</tr>
<tr valign=middle>
  <td align=right style="border-bottom:1px solid #cccccc">C&oacute;digo de Seguran&ccedil;a:</td>
  <td style="border-bottom:1px solid #cccccc"><img src="estrutura/captcha/CaptchaSecurityImages.php?width=100&height=40&characters=5" />&nbsp;<input id="security_code" name="security_code" type="text" /></td>
</tr>
<tr align="center" valign=middle>
  <td colspan="2"><input type=submit name=Submit value="Cadastrar">
    <input type=reset name=Submit2 value="Limpar"></td>
  </tr>
</table> 
</form> 

//Aqui seria onde eu coloca o codigo para fazer a verificação da img não estou conseguindo fazer isto.
Alguém poderia me ajudar qual melhor forma de fazer isto.
<? 
}
if($acao == "add_comentario"){
$sql = "INSERT INTO noticias_comentarios VALUES ('', '$id', '$nome', '$cidade', '$data', '$comentarios')";
$sql = mysql_query($sql);
//echo $sql;
echo "
<br>
<br>
<center><h4>Comentário enviado com Sucesso!</h4></center>
<meta http-equiv='refresh' content='2;URL=?pg=ler_noticia&id=$id'>
";

}
?>



#996578 Css Erro Na Margem Do Menu Ie8 E Mozila

Posted by André - MundoNX on 16/03/2010, 11:05 in HTML, CSS e Metodologias

Olá, gente só meio novato ainda em CSS mais to com um dúvida ou melhor problema. tem meu CSS ele tem um menu que era pra ficar afastado no maximo 5px da margem só que ele ta muito separado gostaria de saber o que estou fazendo de errado.


<!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>Untitled Document</title>

<style type="text/css">
/* Default Theme CSS */
html{
}

*{margin:0;outline:0;list-style:none}
a:link{text-decoration:none;color: #000000;}
a:visited{text-decoration:none;color: #000000}
a:hover{text-decoration:underline}
.clear{clear:both !important}
.nobd{border:none !important}

body {
	margin: 0;
	font-family: Verdana;
	font-size: 11px;
}
/* MENU */
#menu{
	clear:both;
	float:left;
	padding:0 5px 10px;
	width:160px
}
#menu li{
	border-bottom: 1px solid #000;
	padding: 1px;
}
#menu li a strong{
	color:#F6821F;
}
/* Menu 2 */
.menutitle{
cursor:pointer;
margin-bottom: 5px;
color:#000000;
width:140px;
padding:2px;
text-align:left;
font-weight:bold;
/*/*/border:1px none #000000;/* */
}

-->
</style></head>

<body>
<div id="menu">
<div>
<ul>
<li>
	<div class="menutitle" ><a href="cadastro.asp?form=1">Imóveis Rurais</a></div>
	</li>
	<li><div class="menutitle"><a href="cadastro.asp?form=2">Produtos Agrícolas</a></div>
	</li>
	<li>
	<div class="menutitle"><a href="cadastro.asp?form=3">Animais Corte Leite</a></div>
	</li>
	<li>
	<div class="menutitle"><a href="cadastro.asp?form=4">M&aacute;quinas Usadas</a></div>
</li>
</ul>
</div>
</div>
</body>
</html>



#1003979 Função Ler Apenas Arquivo Jpg

Posted by André - MundoNX on 27/09/2010, 11:52 in PHP

KILLME, tava com um sistemade slides faz mais de ano com este bug não tava funcionando agora ta Joia..
veja o no link: http://www.hotbarra....r.evento&id=908
Melhor visualização no IE os demais também funciona só quem sem animação.



#1003928 Função Ler Apenas Arquivo Jpg

Posted by André - MundoNX on 25/09/2010, 13:07 in PHP

Salve pessoal beleza.. Seguinte tenho esta função só que ela esta lendo sub-pastas e outros arquivo, gostaria de fazer ela ler apenas JPG. Alguém poderia me ajudar.? Abraços..


$fotos = array_diff( scandir( $dir ), array( ".", ".." ) );
$fotosSize = count( $fotos );

for ( $i = 0; $i < $fotosSize; $i++ )
{
	echo "photo_urls[" . ($i + 1) . "] = \"" . $dir . '/' . $fotos[ $i ] . "\"; photo_captions[" . ($i + 1 ) . "] = \"\";\n";
}




#1004049 Galeria Brasil

Posted by André - MundoNX on 29/09/2010, 23:46 in Artigos, Dicas e Tutoriais de PHP

Olá pessoal tive afastado um tempão da galeria brasil, fiz algumas evolução na minha galeria.
1 enviou de fotos zipadas, Cria Thumbs, Foto Grande com logo, ajax basico, slides com animação visivel IE demais navegadores apenas muda pagina.
veja exemplo:
Veja ai depois você me fala o que acharam?
thumbs
Posted Image

normal com logo
Posted Image

Link do Slides:
http://www.hotbarra....des.php?&id=901

Link do meu site:
http://www.hotbarra.com.br



#995961 Pago Por: Player Flash Streaming

Posted by André - MundoNX on 04/03/2010, 21:38 in Vagas

Olá, Gostaria de contrar os trabalho de alguém para fazer um player para rádio em player.
gostaria deste player ter as seguintes informações:
Todos os comando: Play - Stop - Aumentar Volume - Diminuir Volume.
Cantor e Musica.

Exemplo de um programação já feita.
http://www.3scriptz..../flexampv10.zip

Só quero o player + ou - igual do meu site.
www.hotnx.com.br

contato msn/e-mail: andresilva@hotnx.com.br




IPB Skin By Virteq