Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #8156
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | "J.O. Aho" <user@example.net> |
| Newsgroups | comp.lang.php |
| Subject | Re: script php with <img scr...../> |
| Date | Thu, 31 Jan 2013 20:57:04 +0100 |
| Lines | 56 |
| Message-ID | <an00kgF9s2qU1@mid.individual.net> (permalink) |
| References | <8693c99b-2331-4f2a-bc3b-4f30d3d2d819@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net XWmmjBBsC64cC+J4Gugg0Ac2Fs/xG/83wFWsj+Oc318tMr4YK0Z/xyhKimAMkQEzST |
| Cancel-Lock | sha1:b0jjs3YfSKk0JMKza2zJlWQFD/k= |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130130 Thunderbird/17.0.2 |
| In-Reply-To | <8693c99b-2331-4f2a-bc3b-4f30d3d2d819@googlegroups.com> |
| Xref | csiph.com comp.lang.php:8156 |
Show key headers only | View raw
On 31/01/13 19:11, sferreira1979@gmail.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
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
script php with <img scr...../> sferreira1979@gmail.com - 2013-01-31 10:11 -0800
Re: script php with <img scr...../> "J.O. Aho" <user@example.net> - 2013-01-31 20:57 +0100
Re: script php with <img scr...../> Jerry Stuckle <jstucklex@attglobal.net> - 2013-01-31 15:09 -0500
Re: script php with <img scr...../> sferreira1979@gmail.com - 2013-02-02 03:11 -0800
Re: script php with <img scr...../> sferreira1979@gmail.com - 2013-02-02 03:20 -0800
Re: script php with <img scr...../> The Natural Philosopher <tnp@invalid.invalid> - 2013-01-31 20:37 +0000
Re: script php with <img scr...../> Jerry Stuckle <jstucklex@attglobal.net> - 2013-01-31 15:42 -0500
Re: script php with <img scr...../> Christoph Becker <cmbecker69@gmx.de> - 2013-01-31 23:19 +0100
Re: script php with <img scr...../> The Natural Philosopher <tnp@invalid.invalid> - 2013-02-01 00:34 +0000
Re: script php with <img scr...../> Jerry Stuckle <jstucklex@attglobal.net> - 2013-01-31 20:16 -0500
Re: script php with <img scr...../> Scott Johnson <noonehome@chalupasworld.com> - 2013-02-01 12:11 -0800
Re: script php with <img scr...../> Christoph Becker <cmbecker69@gmx.de> - 2013-02-05 23:57 +0100
Re: script php with <img scr...../> The Natural Philosopher <tnp@invalid.invalid> - 2013-02-05 23:11 +0000
Re: script php with <img scr...../> Christoph Becker <cmbecker69@gmx.de> - 2013-02-06 00:21 +0100
csiph-web