Skip to content

Commit

Permalink
reject contact submissions with links in the body
Browse files Browse the repository at this point in the history
  • Loading branch information
joshp23 committed Sep 26, 2020
1 parent e3b95b4 commit 8a809c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions SMTP-contact/assets/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: SMTP Contact | Helper File
Plugin URI: https://github.com/joshp23/YOURLS-SMTP-Contact
Description: Enables Contact Page using PHPMailer
Version: 1.0.0
Version: 1.1.0
Author: Josh Panter
Author URI: https://unfettered.net
*/
Expand All @@ -23,7 +23,6 @@
die();
}
// Resume normal functions
$icon = "assets/img/0eq2.fav.ico";
if ( isset( $_POST['submit'] ) ) {

// First, check BotBox
Expand Down Expand Up @@ -55,7 +54,13 @@
//Check if message has been entered
if( isset( $_POST['message'] ) && $_POST['message'] !== '' ) {
$vars['message'] = $_POST['message'];
$errMessage = null;
// check for links
$regEx = '~[a-z]+://\S+~';
if( preg_match( $regEx, $vars['message'] ) ) {
$errMessage = 'Please remove links from your message';
} else {
$errMessage = null;
}
} else {
$errMessage = 'Please enter your message';
}
Expand Down
2 changes: 1 addition & 1 deletion SMTP-contact/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: SMTP Contact
Plugin URI: https://github.com/joshp23/YOURLS-SMTP-Contact
Description: Enables Contact Page using PHPMailer
Version: 1.0.0
Version: 1.1.0
Author: Josh Panter
Author URI: https://unfettered.net
*/
Expand Down

0 comments on commit 8a809c8

Please sign in to comment.