VeenLee / cool-php-captcha

Automatically exported from code.google.com/p/cool-php-captcha
GNU General Public License v3.0
0 stars 0 forks source link

Use 2 Captchas on 1 Page #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
*What steps will reproduce the problem?
1. Include the Captcha image twice on a single page.

*What is the expected output? What do you see instead?
Each code should have it's own session code.

*What version of the product are you using? On what operating system?
0.3

*Please provide any additional information below.
I'd like to include the Captcha image more than once on a web page that uses 
more than one form and each Captcha image have it's own code without it 
interfering with the "secretword" session veriable from the other.

Can anyone tell me a simple way to do this, without having to use 2 different 
versions of the captcha.php file?

Original issue reported on code.google.com by MissSass...@googlemail.com on 14 Jun 2011 at 3:00

GoogleCodeExporter commented 8 years ago
I need this too...

Original comment by mariuspl...@gmail.com on 11 Jul 2011 at 12:02

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago

You just need to instance two SimpleCaptcha setting different "session_var" 
attribute, for example using two files:

File 1:  captcha1.php
=====================

session_start();
$captcha = new SimpleCaptcha();
$captcha->session_var = 'captcha1';
$captcha->CreateImage();

File 2:  captcha2.php
=====================

session_start();
$captcha = new SimpleCaptcha();
$captcha->session_var = 'captcha2';
$captcha->CreateImage();

Also you can use just one file, but be careful and dont give the session_var 
via GET/POST because that will be a BIG security problem.

Original comment by joserodr...@gmail.com on 14 Jul 2011 at 3:24

GoogleCodeExporter commented 8 years ago
YEah, but I don't want to include 2 files in my web page (eg: captcha1.php & 
captcha2.php), I should be able to do it with just one.

Also, assume a lot of my site's pages have captchas on them and the user opens 
each page in multiple tabs. Then, only the captcha value from last tab would be 
the accurate code for any of the tabs.

Original comment by asha...@gmail.com on 14 Jul 2011 at 4:41

GoogleCodeExporter commented 8 years ago
In that case you need to do something like this:

captcha.php?id=JWIQJSSQIWOIJSJ

Where "id" identifies the form or the session var to use. You have a lot of 
ways to implement this.

Original comment by joserodr...@gmail.com on 14 Jul 2011 at 4:47

GoogleCodeExporter commented 8 years ago
I like that. Any other suggestions?

Original comment by asha...@gmail.com on 14 Jul 2011 at 5:43