Reputation: 2501
I have created a form for my joomla 3 site that collects the visitor's email address. After submission I am collecting the value like so:
$email = $input->post('email');
I am then inserting them in the database like so:
$values = ...$db->quote($email)...;
I have reviewed Joomla's coding guidelines here: http://docs.joomla.org/Secure_coding_guidelines
I see that when an email is inserted in the database like I am showing in this question the @
and .
are being stripped from the value to help prevent sql injection. I am sure that there is a simple Joomla workaround for inserting an email, but I am having trouble locating the syntax. Any ideas?
Upvotes: 1
Views: 30
Reputation: 107566
I've never used Joomla before, but after reading the documentation, I think you will have to specify a filter when retrieving the value that doesn't strip out characters. Perhaps:
$email = $input->post->get('email', 'default_value', 'RAW');
This would give you the input unfiltered, but of course you should be careful with that. Perhaps a different filter listed on the guidelines page would be more appropriate.
FYI I think the above line is long-hand for:
$email = $input->get('email', 'default_value', 'RAW');
Upvotes: 1