The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 98 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
PostPosted: Sat May 10, 2008 10:37 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Apr 14, 2006 4:06 pm
Posts: 18
There are many extenions for captcha, but all I know are bloated. I just want a simple one.
Please have a look at http://joomlacode.org/gf/project/tincaptcha

I found no way to install language with my plugin, so I put it in the component. The plugin file is 120KB, but the most is font files (all fonts are grabbed from dafont.com, and they are copyrighted by their authors).

Here is the Contact page I have intergrated:
Image

And I did:
1. Install both com_tincaptcha and plg_tincaptcha (remember active plugin, we can change some settings in the plugin)
2. In File components\com_contact\controller.php, find and add like this:
Code:
   function submit()
   {
      global $mainframe;

      // Check for request forgeries
      JRequest::checkToken() or jexit( 'Invalid Token' );

      // tincaptcha-
      $captchk = plgSystemTincaptcha::check(JRequest::getVar('captcha', '', 'post'));
      if ($captchk !== true)
      {
         JError::raiseWarning(0, $captchk);
         return false;
      }
      // -tincaptcha


3. In File components\com_contact\views\contact\tmpl\default_form.php, find and add:
Code:
         <label id="contact_textmsg" for="contact_text">
            &nbsp;<?php echo JText::_( 'Enter your message' );?>:
         </label>
         <br />
         <textarea cols="50" rows="10" name="text" id="contact_text" class="inputbox required"></textarea>
         <!-- tincaptcha- -->
         <br />
         <label for="captcha">
            &nbsp;<?php echo JText::_( 'TIN_CAPTCHA' );?>:
         </label>
         <br />
         <input type="text" name="captcha" id="captcha" size="10" class="inputbox required" value="" />
         <br />
            <img src="index.php?option=com_tincaptcha&task=captcha_display" />
         <!-- -tincaptcha -->

That's all.

I do not put $this->display(); after JError::raiseWarning because it just display an empty form.
You might want raiseError instead, it will display only error message
Code:
JError::raiseError(500, $captchk);

What my concern is in J1.5.3, when we typed wrong captcha and go back, all form data are cleared. They can be remembered in J1.5.1 because the code in libraries\joomla\environment\response.php
Code:
//JResponse::setHeader( 'Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false ); // <-- browsers can not remember form
JResponse::setHeader( 'Cache-Control', 'post-check=0, pre-check=0', false ); // <--browsers can with this


I also hack Virtuemart registration form: http://forum.virtuemart.net/index.php?topic=40043.0
For Joomla registration will be available soon. I still want the captcha warning and the form display together with what we've typed in form.


Top
 Profile  
 
PostPosted: Fri May 16, 2008 2:32 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Apr 14, 2006 4:06 pm
Posts: 18
For the refresh image button, change the captcha image tag to this:

Code:
<img src="index.php?option=com_tincaptcha&task=captcha_display" onclick="this.src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime()" alt="Click to refresh image"/>

or
Code:
<img name="captchaimg" src="index.php?option=com_tincaptcha&task=captcha_display" /><a href="javascript:void(0);" onclick="document.images['captchaimg'].src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime();return false;">Refresh Image</a>


Top
 Profile  
 
PostPosted: Sun May 18, 2008 1:16 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Mar 10, 2007 3:41 pm
Posts: 20
can you pls be more specific how, where to edit 'img src' tag for virtuemart to achieve refresh button. im supposing you're referring to ps_userfield.php but i can't get syntax correct.


Top
 Profile  
 
PostPosted: Thu Jun 05, 2008 11:56 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Nov 03, 2005 7:21 am
Posts: 149
Location: Auckland - New Zealand
Installation in my 1.5.3 was easy (thanks). All works well - except I get no error message of any kind when the input doesn't match - just a blank page.

That part of the function *is* triggering, as when I add
Code:
$this->display();
to controller.php I get a new form. I've tried different values in the line
Code:
JError::raiseWarning(500, $captchk);
but nothing works.

Any ideas?


Top
 Profile  
 
PostPosted: Thu Jun 05, 2008 4:40 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Apr 14, 2006 4:06 pm
Posts: 18
Did you try with default template or not?

Code:
   function submit()
   {
      global $mainframe;

      // Check for request forgeries
      JRequest::checkToken() or jexit( 'Invalid Token' );

      // tincaptcha-
      $captchk = plgSystemTincaptcha::check(JRequest::getVar('captcha', '', 'post'));
      if ($captchk !== true)
      {
         JError::raiseWarning(0, $captchk);
         $this->display();  // <-- display form
         return false;
      }
      // -tincaptcha


Top
 Profile  
 
PostPosted: Tue Jun 24, 2008 11:08 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sun Jun 22, 2008 1:13 pm
Posts: 1
Thanks for the componet/plugin. Works great for me. :D


Top
 Profile  
 
PostPosted: Fri Jun 27, 2008 12:51 pm 
Joomla! Intern
Joomla! Intern

Joined: Thu Apr 03, 2008 3:58 pm
Posts: 88
So what should we do? If I use another template?


Top
 Profile  
 
PostPosted: Fri Jun 27, 2008 2:12 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Apr 14, 2006 4:06 pm
Posts: 18
korb wrote:
So what should we do? If I use another template?

till works. It only affects the core files (in the first post)


Top
 Profile  
 
PostPosted: Wed Jul 02, 2008 3:41 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jul 02, 2008 3:19 pm
Posts: 49
Location: Eastbourne, East Sussex
Oh my god, easy to use? are you [removed by mod] kidding me?

There's editing and you don't explain which parts of code I should edit, what's the problem with simply attacking ready to replace files and just telling where to put them into ????
Seriously, and even after I edited it and it seemed to work, it only returns a blank page when an error occurs and when I submit the captcha successfully, then it just shows the blank form without any information whether I successfuly sent the message or not.

It's bloody useless, also, the captcha images are way too hard to read, you can't tell whether a "b" is a "6" or when "1" is "l" or "I" just [removed by mod] silly, what's the point of releasing a product with 100 bugs????

_________________
http://smewebsolutions.co.uk
http://eastbournewebdesign.net
Web Design Services in Eastbourne, East Sussex


Top
 Profile  
 
PostPosted: Thu Jul 03, 2008 2:51 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Apr 14, 2006 4:06 pm
Posts: 18
:eek: Yep, this is not for a newbie but also not a brain teaser.

Quote:
it only returns a blank page when an error occurs

Did you read the whole post?

Quote:
the captcha images are way too hard to read

Just replace the fonts. You should know the principle of the source first or just ask a question.

Quote:
what's the point of releasing a product with 100 bugs????

Maybe the extension is not enough for you but it's good for some people I know and of course, myself.
Have you ever worked as a volunteer, time wasting and no money? Do you have any contribution for open source world? Just do it.


Top
 Profile  
 
PostPosted: Tue Jul 08, 2008 5:57 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Jul 08, 2008 5:30 pm
Posts: 10
Location: London
Cheers, i've been desperate for something alike.

_________________
Signature Rules: viewtopic.php?f=8&t=65


Top
 Profile  
 
PostPosted: Fri Aug 01, 2008 12:50 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Aug 01, 2008 12:43 am
Posts: 4
still problem with my website

_________________
Signature Rules: viewtopic.php?f=8&t=65


Top
 Profile  
 
PostPosted: Sat Aug 09, 2008 5:30 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Aug 14, 2006 6:54 am
Posts: 47
hi, thanks for your work on this extension. I am using joomla 1.5.3 and have a custom template. I followed the instructions and have enabled the plugin and have inserted the lines of code as you instruct, but when i test my contact form I do not see anything new on it - just the normal form.

Any suggestions? thanks!


Top
 Profile  
 
PostPosted: Thu Aug 28, 2008 11:38 am 
Joomla! Intern
Joomla! Intern

Joined: Thu Apr 03, 2008 3:58 pm
Posts: 88
Hello,
I very much want to know how to make the font to be shown exactly how it is and not dublicated or other effects like rotated characters and so on.

I also want to know if we can integrate it with Jom Comment.
Thank you


Top
 Profile  
 
PostPosted: Mon Sep 01, 2008 6:55 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Mar 08, 2007 3:57 pm
Posts: 7
Location: Šid
Thx, Replika
work for me like charm :p

here is:
com_contact pach
com_tincaptcha_0.1.1
plg_tincaptcha_0.1.1


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Fri Sep 12, 2008 1:27 am 
Joomla! Intern
Joomla! Intern

Joined: Thu Apr 03, 2008 3:58 pm
Posts: 88
We need this plugin to work only for guests. Is it possible?


Top
 Profile  
 
PostPosted: Sat Sep 13, 2008 1:36 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Apr 14, 2006 4:06 pm
Posts: 18
korb wrote:
We need this plugin to work only for guests. Is it possible?


I should change a bit the code to first check user logged in or not, for example:

Code:
$user =& JFactory::getUser();
if (JPluginHelper::isEnabled('system', 'tincaptcha') && $user->get('guest'))
{
      $captchk = plgSystemTincaptcha::check(JRequest::getVar('captcha', '', 'post'));
      if ($captchk !== true)
      {
         JError::raiseWarning(0, $captchk);
         return false;
      }
}


Code:
<?php
$user =& JFactory::getUser();
if (JPluginHelper::isEnabled('system', 'tincaptcha') && $user->get('guest')) :
?>
         <!-- tincaptcha- -->
         <br />
         <label for="captcha">
            &nbsp;<?php echo JText::_( 'TIN_CAPTCHA' );?>:
         </label>
         <br />
         <input type="text" name="captcha" id="captcha" size="10" class="inputbox required" value="" />
         <br />
            <img src="index.php?option=com_tincaptcha&task=captcha_display" />
         <!-- -tincaptcha -->
<?php endif; ?>


Top
 Profile  
 
PostPosted: Sat Sep 13, 2008 1:54 pm 
Joomla! Intern
Joomla! Intern

Joined: Thu Apr 03, 2008 3:58 pm
Posts: 88
Thanks for input Replika

The thing here...where does the code go? and wich code? you have a lot of codes that you don't mention where it supose to go into....I mean what files, what lines?


Same thing for refresh image capability: where that code supose to go?

Danny


Top
 Profile  
 
PostPosted: Sat Sep 13, 2008 8:30 pm 
Joomla! Intern
Joomla! Intern

Joined: Thu Apr 03, 2008 3:58 pm
Posts: 88
Both refresh image codes not working, and registered users still can see captcha.
Sory for bad news


Top
 Profile  
 
PostPosted: Sun Sep 14, 2008 9:48 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sun Sep 14, 2008 9:40 am
Posts: 3
First things first, THANK YOU for the time, effort and making this happen as i tried so many with no success and yours worked immediately with Version 1.5.6 :)

Only one small question if i may,

In which file can refresh the image be found so i can add / change the code?

Thanks again 8)


Top
 Profile  
 
PostPosted: Sun Sep 14, 2008 2:30 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Apr 14, 2006 4:06 pm
Posts: 18
vrakas wrote:
In which file can refresh the image be found so i can add / change the code?


file: components\com_contact\views\contact\tmpl\default_form.php

Compare steps in the first post, You can see this line in the hack:
Code:
<img src="index.php?option=com_tincaptcha&task=captcha_display" />


replace to
Code:
<img src="index.php?option=com_tincaptcha&task=captcha_display" onclick="this.src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime()" alt="<?php echo JText::_('TIN_REFRESH_ALT');?>"/>

or

Code:
<img name="captchaimg" src="index.php?option=com_tincaptcha&task=captcha_display" /><a href="javascript:void(0);" onclick="document.images['captchaimg'].src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime();return false;"><?php echo JText::_('TIN_REFRESH');?></a>


@korb:
What have you done?

@Moderators:
How do I edit the first post


Top
 Profile  
 
PostPosted: Sun Sep 14, 2008 2:43 pm 
Joomla! Intern
Joomla! Intern

Joined: Thu Apr 03, 2008 3:58 pm
Posts: 88
ok, just tried both codes now, and it does not work. When I click "Refresh image" link the image disapears.


And registered users are still required to input captcha security images.

Danny


Top
 Profile  
 
PostPosted: Sun Sep 14, 2008 4:04 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sun Sep 14, 2008 9:40 am
Posts: 3
Replika wrote:
vrakas wrote:
In which file can refresh the image be found so i can add / change the code?


file: components\com_contact\views\contact\tmpl\default_form.php

Compare steps in the first post, You can see this line in the hack:
Code:
<img src="index.php?option=com_tincaptcha&task=captcha_display" />


replace to
Code:
<img src="index.php?option=com_tincaptcha&task=captcha_display" onclick="this.src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime()" alt="<?php echo JText::_('TIN_REFRESH_ALT');?>"/>

or

Code:
<img name="captchaimg" src="index.php?option=com_tincaptcha&task=captcha_display" /><a href="javascript:void(0);" onclick="document.images['captchaimg'].src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime();return false;"><?php echo JText::_('TIN_REFRESH');?></a>



Worked like a charm in both cases and just for others to know, the first changes the code by clicking ON the image and the other by clicking on the text.

Thanks again and keep up the good job 8)


Top
 Profile  
 
PostPosted: Thu Sep 18, 2008 5:24 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Sep 18, 2008 3:31 pm
Posts: 27
Location: Chicago, IL
Well done! Thanks for sharing.

_________________
Web Design Chicago - http://www.varsys.com
SEO Chicago - http://www.varsys.com/seo-company-chicago.html


Top
 Profile  
 
PostPosted: Thu Sep 18, 2008 6:16 pm 
Joomla! Intern
Joomla! Intern

Joined: Thu Apr 03, 2008 3:58 pm
Posts: 88
For contact component is not working, as I posted above. I canţt figure it out, but it seems that I have a problem with captcha images in Jom Comment: images are not rendered first visit of an article...

It works for VM registration!
BUT if I use
Code:
alt="<?php echo JText::_('TIN_REFRESH_ALT'); ?>"
instead of alt="Click to refresh image", it does not work.
Any idea?

Thanks


Top
 Profile  
 
PostPosted: Thu Sep 18, 2008 7:40 pm 
Joomla! Guru
Joomla! Guru

Joined: Thu Aug 18, 2005 10:51 pm
Posts: 692
Location: Austria
@Korb: just 1 question: which Joomla version do you use?

_________________
http://www.joomx.com - custom extensions and development
http://www.joomlasupportdesk.com - support, migration, training and consulting
Member of the German Joomla Translation Team


Top
 Profile  
 
PostPosted: Thu Sep 18, 2008 10:22 pm 
Joomla! Intern
Joomla! Intern

Joined: Thu Apr 03, 2008 3:58 pm
Posts: 88
J1.5.7, I will add installation info in my signature.


Top
 Profile  
 
PostPosted: Fri Sep 19, 2008 1:56 am 
Joomla! Intern
Joomla! Intern

Joined: Thu Apr 03, 2008 3:58 pm
Posts: 88
FOr me the trick to show captcha only to guest is working, but refresh image works only for Virtuemart registration process, using this code
Code:
<img src="index.php?option=com_tincaptcha&task=captcha_display" onclick="this.src=\'index.php?option=com_tincaptcha&task=captcha_display&t=\'+(new Date()).getTime()" alt="Click pentru reincarcare imagine" title="Click to refresh" />


I admit I might have some issues with VM template, but with Joomla? :pop


Top
 Profile  
 
 Post subject: FRQ: tinCaptcha
PostPosted: Sun Sep 21, 2008 8:28 pm 
Joomla! Intern
Joomla! Intern

Joined: Thu Apr 03, 2008 3:58 pm
Posts: 88
Replace very ugly Jom Comment captcha.


Top
 Profile  
 
PostPosted: Mon Sep 22, 2008 11:06 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Apr 14, 2006 4:06 pm
Posts: 18
korb wrote:
FOr me the trick to show captcha only to guest is working, but refresh image works only for Virtuemart registration process, using this code
Code:
<img src="index.php?option=com_tincaptcha&task=captcha_display" onclick="this.src=\'index.php?option=com_tincaptcha&task=captcha_display&t=\'+(new Date()).getTime()" alt="Click pentru reincarcare imagine" title="Click to refresh" />


I admit I might have some issues with VM template, but with Joomla? :pop


please send me files you have edited.
In VM, html code put in variable, so ' characters become \'


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 98 posts ]  Go to page 1, 2, 3, 4  Next



Who is online

Users browsing this forum: No registered users and 26 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group