Forum Moderators: rogerd

Message Too Old, No Replies

phpbb2 form question

         

looperboy

5:15 pm on Mar 25, 2007 (gmt 0)

10+ Year Member



hi,

i removed the "website" field on my registering form for my phpbb2 forum, as one of many measures I've tried to stop spammers joining. But sometimes when I am erasing their profiles a website is still showing up on their profile that they somehow managed to enter. Does anyone know why this is happening?

Stuart

AlexK

6:52 pm on Mar 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld, looperboy!

The spammers that you are encountering are probably not using the Form to register - these are automated Registrations, not human registrations.

Unfortunately, you need to make phpBB2 non-standard to avoid auto-registrations. There is an old post at phpBB2 [phpbb.com] that I found useful, and doubtless others can chip in with other suggestions. Search on my own forums ("Site Info & Diary", search-term 'phpBB2' at v2.0.11) to find a synopsis.

looperboy

12:53 pm on Mar 26, 2007 (gmt 0)

10+ Year Member



thanks for the welcome, alexk.

and thanks for that link. i'll try pasting that code.

what is the address for your own forums?

stuart

AlexK

2:41 pm on Mar 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You will find it via my general site (via the profile) (No 'personal' URLs allowed in these forums).

looperboy

9:38 pm on Mar 26, 2007 (gmt 0)

10+ Year Member



thanks very much, alex. i found the article on your forum.

i'll try that tomorrow.

stuart

looperboy

12:31 pm on Mar 28, 2007 (gmt 0)

10+ Year Member



hi alex,

i'm quite new to this, and i'm struggling a bit to understand the line numbers.

As an example, when you show the bit of code to be added in:

profile_add_body.tpl line 4

I'm not quite sure exactly where to add this code. I'm not quite sure which line is line 4.

I've added the start of the file at the end of this post in the hope that you might be able to point out to me where to insert the mod.

Thanks in advance for your help.

stuart

<form action="{S_PROFILE_ACTION}" {S_FORM_ENCTYPE} method="post">

{ERROR_BOX}
<input type="hidden" name="mysecretvar" value="1">

<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>
</tr>
</table>

<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
<tr>
<th class="thHead" colspan="2" height="25" valign="middle">{L_REGISTRATION_INFO}</th>
</tr>
<tr>
<td class="row2" colspan="2"><span class="gensmall">{L_ITEMS_REQUIRED}</span></td>
</tr>
<!-- BEGIN switch_namechange_disallowed -->
<tr>
<td class="row1" width="38%"><span class="gen">{L_USERNAME}: *</span></td>
<td class="row2"><input type="hidden" name="username" value="{USERNAME}" /><span class="gen"><b>{USERNAME}</b></span></td>
</tr>
<!-- END switch_namechange_disallowed -->
<!-- BEGIN switch_namechange_allowed -->
<tr>

looperboy

7:02 pm on Mar 28, 2007 (gmt 0)

10+ Year Member



oh,

i've left the mod in where i guessed it should be. immediately after {ERROR_BOX} But I think that's probably the wrong place.

stuart

AlexK

8:30 pm on Mar 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I cannot really give you support on this forum for a posting made on my forums - kind of silly. Nevertheless, to assist:

looperboy:

I'm not quite sure which line is line 4.

You most certainly need an editor which will easily show you the line-numbers. It's a fundamental for this kind of work. I use "TextPad" (it's on a .co.uk address, from memory), and there are many, many others to choose from.

For some reason profile_add_body.tpl begins with a blank line. Line#4 is therefore

{ERROR_BOX}
, and the mod begins immediately before that line.

Do not forget that this mod is a 2-part affair, and that you will need to add the second part into usercp_register.php.

looperboy

8:58 pm on Mar 28, 2007 (gmt 0)

10+ Year Member



thanks alex.

that's great. i'll get a hold of textbox.

thanks again

stuart

looperboy

2:28 pm on Mar 29, 2007 (gmt 0)

10+ Year Member



hi alex,

i'm getting an error message after adding the mod. Can I ask you about it here, or should i post somewhere else?

Stuart

AlexK

4:07 pm on Mar 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No problem is asking here, since that is the subject of the OP.

A request: keep any code-segments as short as you can. Personally, my eyes glaze over when faced with reams of code - even though I have spent most of the last 4 years doing nothing else than working on thousands of lines of the stuff.

State the file and version of that file at the top, then condense any listing to the immediate vicinity of your mod. Quote line-numbers of the original, with your mod in the midst of it. Don't forget the error message!

A final piece of advice: use

error_reporting( E_ALL );
whilst developing, and fix *everything* that you can, even the notices.

If the error persists, post your problem as succinctly as you can.

looperboy

4:18 pm on Mar 29, 2007 (gmt 0)

10+ Year Member



thanks alex.

i simply posted in the piece of code you have listed for line 261 in the file usercp_register.php.

But I'm getting the error message:

Parse error: syntax error, unexpected T_ELSE in /customersites/5/home/httpd/vhosts/mysite.com/httpdocs/phpBB2/includes/usercp_register.php on line 261

Am I doing something wrong?

Stuart

AlexK

8:08 pm on Mar 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Without seeing your existing code, I cannot tell you exactly why the error that you are receiving (sometimes you just cannot win, huh?). However, here is the placing for that code on a virgin copy of includes/usercp_register.php v2.0.22:

253 if ( isset($HTTP_POST_VARS['submit']) )
254 {
...
264 $passwd_sql = '';
265 if ( $mode == 'editprofile' )
266 {
...
272 }
273 else if ( $mode == 'register' )
274 {
// Mod by AK 2004-12-14
// Add entire if() clause
// Prevent dumb bots registering
if (!isset($_REQUEST['mysecretvar']))
{
message_die(GENERAL_ERROR, 'Bot registration not allowed.');
}
275 if ( empty($username) ¦¦ empty($new_password) ¦¦ empty($password_confirm) ¦¦ empty($email) )
276 {
277 $error = TRUE;
278 $error_msg .= ( ( isset($error_msg) )? '<br />' : '' ) . $lang['Fields_empty'];
279 }
280 }

I would guess that you've pasted it in just slightly the wrong place, with all those nested if()...elseif() brackets. Hopefully, the above will help. Post again if there is still an issue.

PS
A little extra for you:

I use the "// Mod by AK" string at the top of every mod that I make. Then, in the future when phpBB2 issues yet another update, I can very quickly find all the changes should they need to be transferred. Makes for an easy life.

looperboy

8:54 pm on Mar 29, 2007 (gmt 0)

10+ Year Member



that did the trick, alex. brilliant.

i just hadn't noticed that your piece of code had the "else if ( $mode == 'register' )" line in it, which is already in the original code, and i repeated it.

it's working fine now. let's see if it keeps those bots away.

thanks very much for all your help.

stuart

AlexK

11:47 pm on Mar 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



looperboy:
it's working fine now.

Excellent!

Your problem will be hand-crafted spam now.

My forums are not exactly vastly busy, but there have never been any auto-spam postings - I certainly hope that this mod gives you the same result. It *does*, however, every week get a sprinkling of people going through the full Registration process just to post spam (god, they must be desperate!). Keep an eye on that. I've got the fix planned for that as well, but have not implemented it yet. Keep an eye on the "Site Info & Diary" on my site.

looperboy

2:44 pm on Mar 30, 2007 (gmt 0)

10+ Year Member



thanks alex,

i'll keep an eye on your forum

stuart