register outside of register page.... problem with captcha

Discussion forum for MOD Writers regarding MOD Development.
nexum
I've Been Banned!
Posts: 156
Joined: Tue May 25, 2004 8:36 pm

register outside of register page.... problem with captcha

Post by nexum »

Ok well so i made a cool script to display a login/register page in a sliding panel.... (as you can see on http://www.punksandskins.com)

The register form looks like this:

Code: Select all





<form class="clearfix" method="post" action="ucp.php">  

<span class="grey">Username: </span>&nbsp;<input type="text" class="field" style="width:75px" name="username" size="25" maxlength="20" value="" />   <br>
<span class="grey">Email Address: </span>&nbsp;<input type="text" class="field" style="width:75px" name="email" size="25" maxlength="255" value="" /><br>
<span class="grey">Password: </span>&nbsp;<input type="password" class="field" style="width: 75px" name="new_password" size="25" maxlength="100" value="" />  <br>
<span class="grey">Confirm Password: </span>&nbsp;<input type="password" class="field" style="width: 75px" name="password_confirm" size="25" maxlength="100" value="" /> <br>

<input type="hidden" name="viewemail" value="0" checked="checked" /> 
<input type="hidden" name="hideonline" value="0" checked="checked" /> 
<input type="hidden" name="notifyreply" value="1" checked="checked" /> 
<input type="hidden" name="notifypm" value="1" checked="checked" />
<input type="hidden" name="popup_pm" value="1" checked="checked" />   
<input type="hidden" name="attachsig" value="1" checked="checked" />       
<input type="hidden" name="allowbbcode" value="1" checked="checked" /> 
<input type="hidden" name="allowhtml" value="0" checked="checked" />    
<input type="hidden" name="allowsmilies" value="1" checked="checked" />    
<input type="hidden" name="dateformat" value="D M d, Y g:i a" maxlength="14" class="post" /> 
 









		<script type="text/javascript">
		// <![CDATA[
		var RecaptchaOptions = {
			lang : '{L_RECAPTCHA_LANG}',
			tabindex : <!-- IF $CAPTCHA_TAB_INDEX -->{$CAPTCHA_TAB_INDEX}<!-- ELSE -->10<!-- ENDIF -->
		};
		// ]]>
		</script>
		<script type="text/javascript" src="{RECAPTCHA_SERVER}/challenge?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}" ></script>
		<script type="text/javascript">
		// <![CDATA[
		<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
			document.getElementById('recaptcha_table').style.direction = 'ltr';
		<!-- ENDIF -->
		// ]]>
		</script>

			<noscript>
				<iframe src="{RECAPTCHA_SERVER}/noscript?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}" height="300" width="500" frameborder="0"></iframe><br />
				<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
				<input type="hidden" name="recaptcha_response_field" value="manual_challenge" />
			</noscript>










<input type="hidden" name="mode" value="register" /> 
<span class=copyright></u></a>
<br>
<input type="hidden" name="agreed" value="true" /> 
<input type="hidden" name="coppa" value="0" /> 
<br><input type="submit" name="submit" value="Submit" class="liteoption"  class="bt_register" />
</form> 






My problem is with captcha.... i can't get it working.... I tryed copying the captcha template variable but it didn't worked.... So i tryed to use the code of "captcha_recaptcha.html" templace since i am using recaptcha on my board.... but it didn't work again :(

Someone help me please!
nexum
I've Been Banned!
Posts: 156
Joined: Tue May 25, 2004 8:36 pm

Re: register outside of register page.... problem with captcha

Post by nexum »

or does anyone know if there is some sort of "external register" or "quick register" mod available ? i could just take the code out of it and modify it...... but since captcha has been modified in 3.0.6 i doubt there is a mod working for this version....
User avatar
Kellanved
Former Team Member
Posts: 2635
Joined: Wed Jan 26, 2005 2:48 pm
Location: Meta-level

Re: register outside of register page.... problem with captcha

Post by Kellanved »

If you want to use the captcha in your page, you'll have to use an instance of the captcha class and the phpBB template system, along with session handling and other tasks.

See:
http://www.phpbb.com/kb/article/add-a-n ... -to-phpbb/
captchas

In your case, it might be easier to write a file that registers the users, employing the user_add function.
Nocando is in Idontwanna county. No support via PM
nexum
I've Been Banned!
Posts: 156
Joined: Tue May 25, 2004 8:36 pm

Re: register outside of register page.... problem with captcha

Post by nexum »

well right now my register script is inside overall_header.php and appear on all pages except register page

so i should be fine with session handling and other basic stuff.

But i suppose the captcha class is only included on register page (if i try to use my script inside register template, captcha will work)

How can i call the captcha class on a different phpbb page ? i just include the php captcha files in includes/ folder or what?
nexum
I've Been Banned!
Posts: 156
Joined: Tue May 25, 2004 8:36 pm

Re: register outside of register page.... problem with captcha

Post by nexum »

ok i almost solved my problem !!

My form outside register page works.... BUT when the form is sent the user is brought to register page and there is an error message saying "The submitted form was invalid. Try submitting again."

The user will have to submit the form again...

But if you register on the usual phpbb registration page it will work without having to submit the form again

Could someone help me to solve the problem ??

You can see it live on this website : http://www.punksandskins.com

click "LOGIN/REGISTER" on the menu bar on the top of the page.... a sliding pannel will show up with a form to register a new account.... this is the register form i am trying to make


maybe there is a code that block $_POST request comming from all pages except ucp.php ??
nexum
I've Been Banned!
Posts: 156
Joined: Tue May 25, 2004 8:36 pm

Re: register outside of register page.... problem with captcha

Post by nexum »

bump...
nexum
I've Been Banned!
Posts: 156
Joined: Tue May 25, 2004 8:36 pm

Re: register outside of register page.... problem with captcha

Post by nexum »

bump...

i still have the ""The submitted form was invalid. Try submitting again." error

see it by yourself on my forum:

http://www.punksandskins.com

open the "login/register" panel at the top, there is a form to register and it's where the problem comes from
nexum
I've Been Banned!
Posts: 156
Joined: Tue May 25, 2004 8:36 pm

Re: register outside of register page.... problem with captcha

Post by nexum »

bump........
nexum
I've Been Banned!
Posts: 156
Joined: Tue May 25, 2004 8:36 pm

Re: register outside of register page.... problem with captcha

Post by nexum »

................
User avatar
Kellanved
Former Team Member
Posts: 2635
Joined: Wed Jan 26, 2005 2:48 pm
Location: Meta-level

Re: register outside of register page.... problem with captcha

Post by Kellanved »

You are running into the CSRF prevention, the wiki is your friend.
Check_form_key
Add_form_key
Nocando is in Idontwanna county. No support via PM
nexum
I've Been Banned!
Posts: 156
Joined: Tue May 25, 2004 8:36 pm

Re: register outside of register page.... problem with captcha

Post by nexum »

i'm still confused

i have read these 2 wiki pages and also googled a couple of infos about those functions but i'm still stuck

i have added {S_FORM_TOKEN} before </form> (in template) and also added add_form_key(); function in the php script of my form

but i still get the same error :(



my scripts looks like this :


The form in overall_header template:

Code: Select all

					<h1>Not a member yet? Sign Up!</h1>			


<!-- INCLUDEPHP captchacode.php -->
{S_FORM_TOKEN}
</form>
Captchacode.php :

Code: Select all

<?php
if ($_SERVER['PHP_SELF'] != '/ucp.php') {
echo "

<form name=\"quickregister\" method=\"post\" action=\"ucp.php\">  
<table><tr><td align=\"left\">
<span class=\"grey\">Username: </span>&nbsp;<br>
<input type=\"text\" class=\"field\" style=\"width:160px\" name=\"username\" size=\"40\" maxlength=\"20\" value=\"\" />   <br>
</td></tr></table>
<table width=\"100%\"><tr><td align=\"left\">
<span class=\"grey\">E-mail Address: </span>&nbsp;<br>
<input type=\"text\" class=\"field\" style=\"width:145px\" name=\"email\" size=\"40\" maxlength=\"255\" value=\"\" /><br>
</td>
<td>
<span class=\"grey\">Confirm E-mail: </span>&nbsp;<br>
<input type=\"text\" name=\"email_confirm\" class=\"field\" style=\"width:145px\" name=\"email\" size=\"40\" maxlength=\"255\" value=\"\" />

</td>
</tr></table>
<table><tr><td align=\"left\">
<span class=\"grey\">Password: </span>&nbsp;<br>
<input type=\"password\" class=\"field\" style=\"width: 85px\" name=\"new_password\" size=\"30\" maxlength=\"100\" value=\"\" /> 
</td><td width=\"3\"></td><td align=\"left\">
<span class=\"grey\">Confirm Password: <br>
</span><input type=\"password\" class=\"field\" style=\"width: 85px\" name=\"password_confirm\" size=\"30\" maxlength=\"100\" value=\"\" /> <br>
</td></tr></table>


<input type=\"hidden\" name=\"viewemail\" value=\"0\" checked=\"checked\" /> 
<input type=\"hidden\" name=\"hideonline\" value=\"0\" checked=\"checked\" /> 
<input type=\"hidden\" name=\"notifyreply\" value=\"1\" checked=\"checked\" /> 
<input type=\"hidden\" name=\"notifypm\" value=\"1\" checked=\"checked\" />
<input type=\"hidden\" name=\"popup_pm\" value=\"1\" checked=\"checked\" />   
<input type=\"hidden\" name=\"attachsig\" value=\"1\" checked=\"checked\" />       
<input type=\"hidden\" name=\"allowbbcode\" value=\"1\" checked=\"checked\" /> 
<input type=\"hidden\" name=\"allowhtml\" value=\"0\" checked=\"checked\" />    
<input type=\"hidden\" name=\"allowsmilies\" value=\"1\" checked=\"checked\" />    
<input type=\"hidden\" name=\"dateformat\" value=\"D M d, Y g:i a\" maxlength=\"14\" class=\"post\" /> 

		<script type=\"text/javascript\">
		// <![CDATA[
		var RecaptchaOptions = {
			lang : 'en',
			tabindex : 10
		};
		// ]]>
		</script>

		<script type=\"text/javascript\" src=\"http://api.recaptcha.net/challenge?k=6LcReQkAAAAAALOXIMBRoXOk4Xhgv_ihkpqzbKdz\" ></script>
		<script type=\"text/javascript\">
		// <![CDATA[
		
		// ]]>
		</script>

			<noscript>
				<iframe src=\"http://api.recaptcha.net/noscript?k=6LcReQkAAAAAALOXIMBRoXOk4Xhgv_ihkpqzbKdz\" height=\"80\" width=\"300\" frameborder=\"0\"></iframe><br />
				<textarea name=\"recaptcha_challenge_field\" rows=\"3\" cols=\"40\"></textarea>
				<input type=\"hidden\" name=\"recaptcha_response_field\" value=\"manual_challenge\" />
			</noscript>


<input type=\"hidden\" name=\"mode\" value=\"register\" /> 

<input type=\"hidden\" name=\"agreed\" value=\"true\" /> 
<input type=\"hidden\" name=\"coppa\" value=\"0\" /> 
<input type=\"submit\" name=\"submit\" value=\"Submit\" class=\"bt_register\" />
";

$form_key = 'quickregister';
add_form_key($form_key);

if (!check_form_key($form_key))
{
    $errors[] = $user->lang['FORM_INVALID'];
}


}
?>

what am i doing wrong ?
nexum
I've Been Banned!
Posts: 156
Joined: Tue May 25, 2004 8:36 pm

Re: register outside of register page.... problem with captcha

Post by nexum »

bump
nexum
I've Been Banned!
Posts: 156
Joined: Tue May 25, 2004 8:36 pm

Re: register outside of register page.... problem with captcha

Post by nexum »

bump...

after 1 month and a half, i still have the same problem


..........
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: register outside of register page.... problem with captcha

Post by 3Di »

nexum wrote:bump...

after 1 month and a half, i still have the same problem


..........
You site does not meet the Copyright (overall_footer) requirements in order to get support, maybe because of this.

I also noticed you did the same thing with my IP Country Flag Olympus MOD, that's not really kind of you IMHO.

I will be more than glad to support you but I can't, at the present time.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Scotland
Name: Kenny Cameron
Contact:

Re: register outside of register page.... problem with captcha

Post by stickerboy »

Hello nexum,

Your board does not appear to be displaying the line in the footer that gives credit to the phpBB project. As per Rule 4J and the comment in the overall_footer.html file, support will not be given on this site to those who remove the line crediting phpBB.

If the full copyright (as appears in the footer here) cannot be displayed, users are requested to at least display the "Powered by phpBB" line with "phpBB" linking to phpBB.com. An equivalent message, such as "Discussion board software by phpBB", is also acceptable. Users may also replace the text with an image, as long as the link to phpBB.com is maintained.

When you have replaced the line, please contact the Team Member who locked your topic so that it can be unlocked. If that person is unavailable, you may contact any Support Team Member. Please do not start additional topics, as they will also be locked.

Thank you

*edit* Credit Line restored - topic unlocked
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
Locked

Return to “[3.0.x] MOD Writers Discussion”