Forum Moderators: rogerd
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
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.
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:
I'm not quite sure which line is line 4.
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.
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.
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
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.
it's working fine now.
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.