Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Mar 2008
    Posts
    34
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Install reCaptcha using PHP on a .tpl page

    I have a site that uses .tpl files. I would like to add the reCaptcha system to a form on one of the pages using php. From what I hear you can't just put php script into a .tpl file. I read that you can call php using tags like {}?

    Can I add something to my .htaccess file that will allow php code to run from the .tpl file? I'm thinking that won't work, because the page does have a .php extension, but it's just calling the .tpl files.

    Maybe this would be easier for me... Does anyone know of any captcha systems that I can install using all html and no php?

  • #2
    New Coder
    Join Date
    Mar 2008
    Posts
    34
    Thanks
    7
    Thanked 0 Times in 0 Posts
    nevermind. i figured it out. i guess this thread can just be removed.

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    What was your solution?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #4
    New Coder
    Join Date
    Jun 2009
    Posts
    35
    Thanks
    0
    Thanked 2 Times in 2 Posts
    These .tpl file is smarty template file. u want to create new tpl file means read that smartytemplates. U got an idea
    Live chat software - chat with your web site visitors in real time.
    Internet web directory - list of top100 sites in diffrent category

  • #5
    New Coder
    Join Date
    Mar 2008
    Posts
    34
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    What was your solution?
    Sorry, my solution was to use a jquery ajax script along with some php. But, I couldn't use php in the .tpl file, so to show the reCAPTCHA I used the ajax and to validate the reCAPTCHA I used a separate .php file. Now, if a spammer turns javascript off, the reCAPTCHA won't show unfortunately BUT, they also won't be able to submit the form because the separate php file looks for the reCAPTCHA and if it's incorrect or if it doesn't detect a reCAPTCHA code, then the form won't submit. So it's still secure even though javascript is evolved.

    I found the step by step instructions here:

    http://www.darksideofthecarton.com/2...omment-page-1/

  • #6
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts
    If the smarty configuration allows it you can use
    Code:
    {php}
    //Normal PHP worjs here
    {/php}
    PHP Code:
    $aString is_string((string)array()) ? true false// true :D 
    [/CENTER]

  • Users who have thanked Zangeel for this post:

    wilcosky (09-18-2009)

  • #7
    New Coder
    Join Date
    Mar 2008
    Posts
    34
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Zangeel View Post
    If the smarty configuration allows it you can use
    Code:
    {php}
    //Normal PHP worjs here
    {/php}

    Thanks for the suggestion, I'll try that in the future. Honestly, I'm not going to try it for this since I got it working using another method.

    Also, to correct myself above, the recaptcha will show if javascript is on or off. If javascript is on, it shows the recaptcha using recaptcha.net's javascript code. If javascript is turned off, then the recaptcha shows through an iframe.

    So, that's how I was able to show the recaptcha without using PHP. To validate the recaptcha, I still used PHP.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •