FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » script php with <img scr...../>
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
script php with <img scr...../> [message #180221] Thu, 31 January 2013 18:11 Go to next message
sferreira1979 is currently offline  sferreira1979
Messages: 3
Registered: January 2013
Karma: 0
Junior Member
Hi,

i'm a portuguese's student and i'm trying to learn php by myself (with books and php.net) but i'm experiencing a problem on one of my test:
i have two files: registar_mail.php and captcha.php
captcha.php display an image witch should appear on my file registar_mail.php using
<img src="captcha.php"/> but the image doesn't appear :(
i have been looking for a solution in forums but i don't find anything witch works with me... i'm working with netbeans and xampp

////// script registar_mail.php//////////
!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=iso-8859-1" />
<title>MAILING LIST</title>
<style type="text/css">
@import url("estilo_mailinglist.css");
</style>
</head>
<body>


<?php
// Ligação à base de dados
//phpinfo();
include("ligacao_bd.php");

// verifica se foi clicado o botão de registar
if(isset($_REQUEST['registar'])) {

// verifica se o código captcha está correto
if($_SESSION['codigo'] == $_POST['codigo']){

// verifica se o campo de email está por preencher
if (empty($_POST['email'])) {
echo "<tr>O campo de endereço de correio eletrónico está vazio! </tr>";
echo "<tr><a href='registar_mail.php'>Clique para tentar de novo!</a></tr>";
}
else {

// verifica se endereço de correio eletrónico esta correto
$email = $_POST['email'];
if(filter_var($email, FILTER_VALIDATE_EMAIL)){

// regista o email
$sql = "INSERT INTO emails(endereco_email, data_registo) VALUES ( '$email' , NOW() ) ";
$consulta = mysql_query($sql);

echo "<table>";
echo "<tr>Obrigado por se registar!</tr>";
echo "<tr><a href='registar_mail.php'>Clique para voltar à página principal!</a></tr>";

} else {
echo "<tr>O endereço de correio eletrónico não é válido! </tr>";
echo "<tr><a href='registar_mail.php'>Clique para tentar de novo!</a></tr>";
} } } }
?>
<table width="800 px" border="0" align="center" class="tabela_geral" cellspacing="0">
<form id="form_registo" name="form_registo" action="registar_mail.php" method="POST">
<tr class="tabela_geral">
<td> Introduza o seu endereço de correio eletrónico para se registar na nossa<i> mailing list</i>!
</td>
</tr>
<tr><td class="tabela_geral">
Endereço de correio eletrónico: <input type="text" size=40 name="email">
</td><tr>
<td>
<img scr='captcha.php' alt="imagem ausente"/> <input type="text" name="codigo"/>
<img src="imagens/imagemcaptcha.png" width="230" height="50" alt="imagemcaptcha"/>

</td>
</tr>
<td>
<input type="submit" name="registar" value="Registar">
<input type="reset" name="apagar" value="Apagar"></td>
</form>
</table>
</body>
</html>

/////script captcha.php//////////////////
<?php
//inicia sessão
session_start();

//definição do tipo de imagem a gerar
header("Content-type:image/png");

//geração da chave
$chave=rand(0,500);

//codificação da chave e apresentacao de 8 carateres
$codigo=substr(sha1($chave),0,8);

$_SESSION['codigo']=$codigo;

//definicao imagem e cor
$imagem= imagecreatefrompng("imagens/imagemcaptcha.png");
$cores= imagecolorallocate($imagem, 255, 55, 0);

//centrar código na figura
imagestring($imagem, 5, 75, 20, $codigo, $cores);

//gerar imagem:Outputs or saves a PNG image from the given image.
imagepng($imagem);

//DESTRUIR IMAGEM
imagedestroy($imagem);

?>

could someone help me to understand what is the problem???

thanks :)
Re: script php with <img scr...../> [message #180222 is a reply to message #180221] Thu, 31 January 2013 19:57 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 31/01/13 19:11, sferreira1979(at)gmail(dot)com wrote:

> i have two files: registar_mail.php and captcha.php
> captcha.php display an image witch should appear on my file registar_mail.php using
> <img src="captcha.php"/> but the image doesn't appear :(
> i have been looking for a solution in forums but i don't find anything witch works with me... i'm working with netbeans and xampp

I won't go into the registar_mail.php

> /////script captcha.php//////////////////
> <?php
> //inicia sessão
> session_start();
>
> //definição do tipo de imagem a gerar
> header("Content-type:image/png");
>
> //geração da chave
> $chave=rand(0,500);
>
> //codificação da chave e apresentacao de 8 carateres
> $codigo=substr(sha1($chave),0,8);
>
> $_SESSION['codigo']=$codigo;
>
> //definicao imagem e cor
> $imagem= imagecreatefrompng("imagens/imagemcaptcha.png");
> $cores= imagecolorallocate($imagem, 255, 55, 0);
>
> //centrar código na figura
> imagestring($imagem, 5, 75, 20, $codigo, $cores);
>
> //gerar imagem:Outputs or saves a PNG image from the given image.
> imagepng($imagem);
>
> //DESTRUIR IMAGEM
> imagedestroy($imagem);
>
> ?>
>
> could someone help me to understand what is the problem???

The code itself is okey to add a easy to automatically read text and
generate a new image, the issue may be with the
imagens/imagemcaptcha.png which has to be in a sub directory to the
captcha.php

I do recommend you use a professional solution for captcha, take a look
at this one:

http://www.google.com/recaptcha

--

//Aho
Re: script php with <img scr...../> [message #180223 is a reply to message #180221] Thu, 31 January 2013 20:09 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 1/31/2013 1:11 PM, sferreira1979(at)gmail(dot)com wrote:
> Hi,
>
> i'm a portuguese's student and i'm trying to learn php by myself (with books and php.net) but i'm experiencing a problem on one of my test:
> i have two files: registar_mail.php and captcha.php
> captcha.php display an image witch should appear on my file registar_mail.php using
> <img src="captcha.php"/> but the image doesn't appear :(
> i have been looking for a solution in forums but i don't find anything witch works with me... i'm working with netbeans and xampp
>
<snip code>
>
> could someone help me to understand what is the problem???
>
> thanks :)
>

You have a typo in your html:

<img scr='captcha.php' alt="imagem ausente"/>
^^^

Should be "src"

A good way to determine whether the problem is in your html or the
captcha code is to try to load the image in your browser, i.e.,

http://www.example.com/captcha.php

If the image displays, the problem is *probably* in your html (there's
always that bug... :) ). If the image doesn't show, you *probably* have
a problem in your captcha php file.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: script php with <img scr...../> [message #180224 is a reply to message #180221] Thu, 31 January 2013 20:37 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 31/01/13 18:11, sferreira1979(at)gmail(dot)com wrote:
> Hi,
>
> i'm a portuguese's student and i'm trying to learn php by myself (with books and php.net) but i'm experiencing a problem on one of my test:
> i have two files: registar_mail.php and captcha.php
> captcha.php display an image witch should appear on my file registar_mail.php using
> <img src="captcha.php"/> but the image doesn't appear :(
> i have been looking for a solution in forums but i don't find anything witch works with me... i'm working with netbeans and xampp
>
> ////// script registar_mail.php//////////
> !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=iso-8859-1" />
> <title>MAILING LIST</title>
> <style type="text/css">
> @import url("estilo_mailinglist.css");
> </style>
> </head>
> <body>
>
>
> <?php
> // Ligação à base de dados
> //phpinfo();
> include("ligacao_bd.php");
>
> // verifica se foi clicado o botão de registar
> if(isset($_REQUEST['registar'])) {
>
> // verifica se o código captcha está correto
> if($_SESSION['codigo'] == $_POST['codigo']){
>
> // verifica se o campo de email está por preencher
> if (empty($_POST['email'])) {
> echo "<tr>O campo de endereço de correio eletrónico está vazio! </tr>";
> echo "<tr><a href='registar_mail.php'>Clique para tentar de novo!</a></tr>";
> }
> else {
>
> // verifica se endereço de correio eletrónico esta correto
> $email = $_POST['email'];
> if(filter_var($email, FILTER_VALIDATE_EMAIL)){
>
> // regista o email
> $sql = "INSERT INTO emails(endereco_email, data_registo) VALUES ( '$email' , NOW() ) ";
> $consulta = mysql_query($sql);
>
> echo "<table>";
> echo "<tr>Obrigado por se registar!</tr>";
> echo "<tr><a href='registar_mail.php'>Clique para voltar à página principal!</a></tr>";
>
> } else {
> echo "<tr>O endereço de correio eletrónico não é válido! </tr>";
> echo "<tr><a href='registar_mail.php'>Clique para tentar de novo!</a></tr>";
> } } } }
> ?>
> <table width="800 px" border="0" align="center" class="tabela_geral" cellspacing="0">
> <form id="form_registo" name="form_registo" action="registar_mail.php" method="POST">
> <tr class="tabela_geral">
> <td> Introduza o seu endereço de correio eletrónico para se registar na nossa<i> mailing list</i>!
> </td>
> </tr>
> <tr><td class="tabela_geral">
> Endereço de correio eletrónico: <input type="text" size=40 name="email">
> </td><tr>
> <td>
> <img scr='captcha.php' alt="imagem ausente"/> <input type="text" name="codigo"/>
> <img src="imagens/imagemcaptcha.png" width="230" height="50" alt="imagemcaptcha"/>
>
> </td>
> </tr>
> <td>
> <input type="submit" name="registar" value="Registar">
> <input type="reset" name="apagar" value="Apagar"></td>
> </form>
> </table>
> </body>
> </html>
>
> /////script captcha.php//////////////////
> <?php
> //inicia sessão
> session_start();

Bad move. Nio sessions pelae!
>
> //definição do tipo de imagem a gerar
> header("Content-type:image/png");
>
> //geração da chave
> $chave=rand(0,500);
>
> //codificação da chave e apresentacao de 8 carateres
> $codigo=substr(sha1($chave),0,8);
>
> $_SESSION['codigo']=$codigo;
>
> //definicao imagem e cor
> $imagem= imagecreatefrompng("imagens/imagemcaptcha.png");
> $cores= imagecolorallocate($imagem, 255, 55, 0);
>
> //centrar código na figura
> imagestring($imagem, 5, 75, 20, $codigo, $cores);
>
> //gerar imagem:Outputs or saves a PNG image from the given image.
> imagepng($imagem);
>
> //DESTRUIR IMAGEM
> imagedestroy($imagem);
>
> ?>
>
> could someone help me to understand what is the problem???
>
> thanks :)
>


The simplest php script to send a picture is this
<? php5
header("Content-Type: image/jpeg");
$fh = fopen("myfile.jpg", "r");
fpassthru($fh);
flose($fh)';

// and leave the ?> OUT of things.
// and sessions.


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: script php with <img scr...../> [message #180225 is a reply to message #180224] Thu, 31 January 2013 20:42 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 1/31/2013 3:37 PM, The Natural Philosopher wrote:
> On 31/01/13 18:11, sferreira1979(at)gmail(dot)com wrote:
>> Hi,
>>
>> i'm a portuguese's student and i'm trying to learn php by myself (with
>> books and php.net) but i'm experiencing a problem on one of my test:
>> i have two files: registar_mail.php and captcha.php
>> captcha.php display an image witch should appear on my file
>> registar_mail.php using
>> <img src="captcha.php"/> but the image doesn't appear :(
>> i have been looking for a solution in forums but i don't find anything
>> witch works with me... i'm working with netbeans and xampp
>>
>> ////// script registar_mail.php//////////
>> !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=iso-8859-1" />
>> <title>MAILING LIST</title>
>> <style type="text/css">
>> @import url("estilo_mailinglist.css");
>> </style>
>> </head>
>> <body>
>>
>>
>> <?php
>> // Ligação à base de dados
>> //phpinfo();
>> include("ligacao_bd.php");
>>
>> // verifica se foi clicado o botão de registar
>> if(isset($_REQUEST['registar'])) {
>>
>> // verifica se o código captcha está correto
>> if($_SESSION['codigo'] == $_POST['codigo']){
>>
>> // verifica se o campo de email está por preencher
>> if (empty($_POST['email'])) {
>> echo "<tr>O campo de endereço de correio eletrónico está vazio!
>> </tr>";
>> echo "<tr><a href='registar_mail.php'>Clique para tentar de
>> novo!</a></tr>";
>> }
>> else {
>>
>> // verifica se endereço de correio eletrónico esta correto
>> $email = $_POST['email'];
>> if(filter_var($email, FILTER_VALIDATE_EMAIL)){
>>
>> // regista o email
>> $sql = "INSERT INTO emails(endereco_email, data_registo) VALUES (
>> '$email' , NOW() ) ";
>> $consulta = mysql_query($sql);
>>
>> echo "<table>";
>> echo "<tr>Obrigado por se registar!</tr>";
>> echo "<tr><a href='registar_mail.php'>Clique para voltar à página
>> principal!</a></tr>";
>>
>> } else {
>> echo "<tr>O endereço de correio eletrónico não é válido! </tr>";
>> echo "<tr><a href='registar_mail.php'>Clique para tentar de
>> novo!</a></tr>";
>> } } } }
>> ?>
>> <table width="800 px" border="0" align="center" class="tabela_geral"
>> cellspacing="0">
>> <form id="form_registo" name="form_registo" action="registar_mail.php"
>> method="POST">
>> <tr class="tabela_geral">
>> <td> Introduza o seu endereço de correio eletrónico para se registar
>> na nossa<i> mailing list</i>!
>> </td>
>> </tr>
>> <tr><td class="tabela_geral">
>> Endereço de correio eletrónico: <input type="text" size=40 name="email">
>> </td><tr>
>> <td>
>> <img scr='captcha.php' alt="imagem ausente"/> <input type="text"
>> name="codigo"/>
>> <img src="imagens/imagemcaptcha.png" width="230" height="50"
>> alt="imagemcaptcha"/>
>>
>> </td>
>> </tr>
>> <td>
>> <input type="submit" name="registar" value="Registar">
>> <input type="reset" name="apagar" value="Apagar"></td>
>> </form>
>> </table>
>> </body>
>> </html>
>>
>> /////script captcha.php//////////////////
>> <?php
>> //inicia sessão
>> session_start();
>
> Bad move. Nio sessions pelae!
>>
>> //definição do tipo de imagem a gerar
>> header("Content-type:image/png");
>>
>> //geração da chave
>> $chave=rand(0,500);
>>
>> //codificação da chave e apresentacao de 8 carateres
>> $codigo=substr(sha1($chave),0,8);
>>
>> $_SESSION['codigo']=$codigo;
>>
>> //definicao imagem e cor
>> $imagem= imagecreatefrompng("imagens/imagemcaptcha.png");
>> $cores= imagecolorallocate($imagem, 255, 55, 0);
>>
>> //centrar código na figura
>> imagestring($imagem, 5, 75, 20, $codigo, $cores);
>>
>> //gerar imagem:Outputs or saves a PNG image from the given image.
>> imagepng($imagem);
>>
>> //DESTRUIR IMAGEM
>> imagedestroy($imagem);
>>
>> ?>
>>
>> could someone help me to understand what is the problem???
>>
>> thanks :)
>>
>
>
> The simplest php script to send a picture is this
> <? php5
> header("Content-Type: image/jpeg");
> $fh = fopen("myfile.jpg", "r");
> fpassthru($fh);
> flose($fh)';
>
> // and leave the ?> OUT of things.
> // and sessions.
>
>

Which has nothing to do with his problem (or a solution to it).

And in your example, the simplest way to do it is to not use PHP at all.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: script php with <img scr...../> [message #180226 is a reply to message #180224] Thu, 31 January 2013 22:19 Go to previous messageGo to next message
Christoph Becker is currently offline  Christoph Becker
Messages: 91
Registered: June 2012
Karma: 0
Member
The Natural Philosopher wrote:
>
> On 31/01/13 18:11, sferreira1979(at)gmail(dot)com wrote:
>>
>> session_start();
>
> Bad move. Nio sessions pelae!

Why is starting a session a bad move?

-- Christoph M. Becker
Re: script php with <img scr...../> [message #180227 is a reply to message #180226] Fri, 01 February 2013 00:34 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 31/01/13 22:19, Christoph Becker wrote:
> The Natural Philosopher wrote:
>>
>> On 31/01/13 18:11, sferreira1979(at)gmail(dot)com wrote:
>>>
>>> session_start();
>>
>> Bad move. Nio sessions pelae!
>
> Why is starting a session a bad move?
>
> -- Christoph M. Becker
>
I dont thinks a strict file download can set a cookie.

I could be wrong in that.
--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: script php with <img scr...../> [message #180228 is a reply to message #180227] Fri, 01 February 2013 01:16 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 1/31/2013 7:34 PM, The Natural Philosopher wrote:
> On 31/01/13 22:19, Christoph Becker wrote:
>> The Natural Philosopher wrote:
>>>
>>> On 31/01/13 18:11, sferreira1979(at)gmail(dot)com wrote:
>>>>
>>>> session_start();
>>>
>>> Bad move. Nio sessions pelae!
>>
>> Why is starting a session a bad move?
>>
>> -- Christoph M. Becker
>>
> I dont thinks a strict file download can set a cookie.
>
> I could be wrong in that.

Wrong answer (as usual).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: script php with <img scr...../> [message #180236 is a reply to message #180228] Fri, 01 February 2013 20:11 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
On 1/31/2013 5:16 PM, Jerry Stuckle wrote:
> On 1/31/2013 7:34 PM, The Natural Philosopher wrote:
>> On 31/01/13 22:19, Christoph Becker wrote:
>>> The Natural Philosopher wrote:
>>>>
>>>> On 31/01/13 18:11, sferreira1979(at)gmail(dot)com wrote:
>>>> >
>>>> > session_start();
>>>>
>>>> Bad move. Nio sessions pelae!
>>>
>>> Why is starting a session a bad move?
>>>
>>> -- Christoph M. Becker
>>>
>> I dont thinks a strict file download can set a cookie.
>>
>> I could be wrong in that.
>
> Wrong answer (as usual).
>

*puts the popcorn on*
Re: script php with <img scr...../> [message #180237 is a reply to message #180223] Sat, 02 February 2013 11:11 Go to previous messageGo to next message
sferreira1979 is currently offline  sferreira1979
Messages: 3
Registered: January 2013
Karma: 0
Junior Member
Quinta-feira, 31 de Janeiro de 2013 20:09:40 UTC, Jerry Stuckle escreveu:
> On 1/31/2013 1:11 PM, sferreira1979(at)gmail(dot)com wrote:
>
>> Hi,
>
>>
>
>> i'm a portuguese's student and i'm trying to learn php by myself (with books and php.net) but i'm experiencing a problem on one of my test:
>
>> i have two files: registar_mail.php and captcha.php
>
>> captcha.php display an image witch should appear on my file registar_mail.php using
>
>> <img src="captcha.php"/> but the image doesn't appear :(
>
>> i have been looking for a solution in forums but i don't find anything witch works with me... i'm working with netbeans and xampp
>
>>
>
> <snip code>
>
>>
>
>> could someone help me to understand what is the problem???
>
>>
>
>> thanks :)
>
>>
>
>
>
> You have a typo in your html:
>
>
>
> <img scr='captcha.php' alt="imagem ausente"/>
>
> ^^^
>
>
>
> Should be "src"
>
>
>
> A good way to determine whether the problem is in your html or the
>
> captcha code is to try to load the image in your browser, i.e.,
>
>
>
> http://www.example.com/captcha.php
>
>
>
> If the image displays, the problem is *probably* in your html (there's
>
> always that bug... :) ). If the image doesn't show, you *probably* have
>
> a problem in your captcha php file.
>
>
>
> --
>
> ==================
>
> Remove the "x" from my email address
>
> Jerry Stuckle
>
> JDS Computer Training Corp.
>
> jstucklex(at)attglobal(dot)net
>
> ==================

hi!? thanks :)
i have correct the img attribute but i'm still having the problem... captcha.php runs correctly in browser, the problems seems to be in registar_mail.php...
in debug mode the file captcha.php is not calling by the programe and i don't know why...
others sugestions?
thanks for your time
Re: script php with <img scr...../> [message #180238 is a reply to message #180223] Sat, 02 February 2013 11:20 Go to previous messageGo to next message
sferreira1979 is currently offline  sferreira1979
Messages: 3
Registered: January 2013
Karma: 0
Junior Member
Quinta-feira, 31 de Janeiro de 2013 20:09:40 UTC, Jerry Stuckle escreveu:
> On 1/31/2013 1:11 PM, sferreira1979(at)gmail(dot)com wrote:
>
>> Hi,
>
>>
>
>> i'm a portuguese's student and i'm trying to learn php by myself (with books and php.net) but i'm experiencing a problem on one of my test:
>
>> i have two files: registar_mail.php and captcha.php
>
>> captcha.php display an image witch should appear on my file registar_mail.php using
>
>> <img src="captcha.php"/> but the image doesn't appear :(
>
>> i have been looking for a solution in forums but i don't find anything witch works with me... i'm working with netbeans and xampp
>
>>
>
> <snip code>
>
>>
>
>> could someone help me to understand what is the problem???
>
>>
>
>> thanks :)
>
>>
>
>
>
> You have a typo in your html:
>
>
>
> <img scr='captcha.php' alt="imagem ausente"/>
>
> ^^^
>
>
>
> Should be "src"
>
>
>
> A good way to determine whether the problem is in your html or the
>
> captcha code is to try to load the image in your browser, i.e.,
>
>
>
> http://www.example.com/captcha.php
>
>
>
> If the image displays, the problem is *probably* in your html (there's
>
> always that bug... :) ). If the image doesn't show, you *probably* have
>
> a problem in your captcha php file.
>
>
>
> --
>
> ==================
>
> Remove the "x" from my email address
>
> Jerry Stuckle
>
> JDS Computer Training Corp.
>
> jstucklex(at)attglobal(dot)net
>
> ==================

hi again?!
my mistake... i have an other error when i test others issues...
i correct the img tag attribute end it's working :)
<img src='captcha.php'alt="imagem ausente"/>

the session is needing to make this verification: // verifica se o código captcha está correto
if($_SESSION['codigo'] == $_POST['codigo'])

finally solved :)
thanks
Re: script php with <img scr...../> [message #180367 is a reply to message #180227] Tue, 05 February 2013 22:57 Go to previous messageGo to next message
Christoph Becker is currently offline  Christoph Becker
Messages: 91
Registered: June 2012
Karma: 0
Member
The Natural Philosopher wrote:

> On 31/01/13 22:19, Christoph Becker wrote:
>>
>> Why is starting a session a bad move?
>>
> I dont thinks a strict file download can set a cookie.
>
> I could be wrong in that.

According to RFC 2109 section 4.2.1 a session (not to be confused with a
PHP session) is initiated by sending an extra request header
(Set-Cookie) in the response. And even a strict file download consists
of a HTTP request and an according response. So no problem here. :)

--
Christoph M. Becker
Re: script php with <img scr...../> [message #180368 is a reply to message #180367] Tue, 05 February 2013 23:11 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 05/02/13 22:57, Christoph Becker wrote:
> The Natural Philosopher wrote:
>
>> On 31/01/13 22:19, Christoph Becker wrote:
>>>
>>> Why is starting a session a bad move?
>>>
>> I dont thinks a strict file download can set a cookie.
>>
>> I could be wrong in that.
>
> According to RFC 2109 section 4.2.1 a session (not to be confused with a
> PHP session) is initiated by sending an extra request header
> (Set-Cookie) in the response. And even a strict file download consists
> of a HTTP request and an according response. So no problem here. :)
>
I stand corrected.

Do all browsers honor it though?


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: script php with <img scr...../> [message #180369 is a reply to message #180368] Tue, 05 February 2013 23:21 Go to previous message
Christoph Becker is currently offline  Christoph Becker
Messages: 91
Registered: June 2012
Karma: 0
Member
The Natural Philosopher wrote:

> On 05/02/13 22:57, Christoph Becker wrote:
>> The Natural Philosopher wrote:
>>
>>> On 31/01/13 22:19, Christoph Becker wrote:
>>>>
>>>> Why is starting a session a bad move?
>>>>
>>> I dont thinks a strict file download can set a cookie.
>>>
>>> I could be wrong in that.
>>
>> According to RFC 2109 section 4.2.1 a session (not to be confused with a
>> PHP session) is initiated by sending an extra request header
>> (Set-Cookie) in the response. And even a strict file download consists
>> of a HTTP request and an according response. So no problem here. :)
>>
> I stand corrected.
>
> Do all browsers honor it though?

Every browser is free to ignore the Set-Cookie header anyway. However,
I expect browsers to handle this the same independent of the Content-Type.

--
Christoph M. Becker
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: compatibility between php 5.3.21 and 5.3.15 for pgsql
Next Topic: change a string where have number after a word
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Jun 04 23:43:29 GMT 2024

Total time taken to generate the page: 0.01874 seconds