Ozzy47
Well-known member
Okay, I have created a table in the DB. It is set as follows.
Now on the registration form, I have the following hidden fields.
1) password: textbox
2) spamcheck: checkbox
3) accepts: checkbox
4) CaptchaInput: textbox
The log_id is there to record the attempt, so I have a running count of how many times the form has been filled in with hidden fields.
Now what I do is if any of those are filled out, give the user an error, or redirect them back to the registration from like the core does if someone fills in a hidden field.
Now what I would like to do is when a user submits the form (even though it is rejected) is insert the values from my hidden fields and the log_id into the table I created.
I have looked into some of the core files but I do not understand it, nor have I been able to figure out how to do this. I could probably hack in some direct DB queries but I would much rather do it correctly. If someone could show me what to do it would be greatly appreciated.
PHP:
public function installStep1()
{
$this->schemaManager()->createTable('xf_ozzmodz_spaminator_log ', function(Create $table)
{
$table->addColumn('log_id', 'int')->autoIncrement();
$table->addColumn('password', 'char', 100)->setDefault('');
$table->addColumn('spamcheck', 'varchar', 10)->setDefault('');
$table->addColumn('accepts', 'varchar', 10)->setDefault('');
$table->addColumn('CaptchaInput ', 'varchar', 100)->setDefault('');
$table->addPrimaryKey('log_id');
});
}
Now on the registration form, I have the following hidden fields.
1) password: textbox
2) spamcheck: checkbox
3) accepts: checkbox
4) CaptchaInput: textbox
The log_id is there to record the attempt, so I have a running count of how many times the form has been filled in with hidden fields.
Now what I do is if any of those are filled out, give the user an error, or redirect them back to the registration from like the core does if someone fills in a hidden field.
Now what I would like to do is when a user submits the form (even though it is rejected) is insert the values from my hidden fields and the log_id into the table I created.
I have looked into some of the core files but I do not understand it, nor have I been able to figure out how to do this. I could probably hack in some direct DB queries but I would much rather do it correctly. If someone could show me what to do it would be greatly appreciated.