| 1 |
|
|---|
| 2 |
WP AuthImage Plugin (v3.0) |
|---|
| 3 |
written by Keith McDuffee (2004-6-7) |
|---|
| 4 |
http://www.gudlyf.com |
|---|
| 5 |
gudlyf@realistek.com |
|---|
| 6 |
|
|---|
| 7 |
--- |
|---|
| 8 |
|
|---|
| 9 |
CHANGELOG: |
|---|
| 10 |
|
|---|
| 11 |
3.0 -- Much more effective (too much?) captcha generation, thanks to the |
|---|
| 12 |
freely available VeriWord PHP class package |
|---|
| 13 |
(http://www.phpclasses.org/browse/package/1768.html). In this release, |
|---|
| 14 |
I've decided to forget about the phoenetic text option. If you want |
|---|
| 15 |
that option, just continue to use version 2.1.1. |
|---|
| 16 |
Note that quite a bit has changed in this README, so if you want to |
|---|
| 17 |
upgrade, read this document fully. |
|---|
| 18 |
|
|---|
| 19 |
--- |
|---|
| 20 |
|
|---|
| 21 |
REQUIREMENTS: |
|---|
| 22 |
|
|---|
| 23 |
This hack assumes the following for your blog. Anything else is up to |
|---|
| 24 |
the user to hack for their own use. These are the only reqs that have been |
|---|
| 25 |
fully tested up to this point. |
|---|
| 26 |
|
|---|
| 27 |
- WordPress (http://wordpress.org/) version 1.2 or above (includes 1.5). |
|---|
| 28 |
- Apache 1.3 or above running on Linux. |
|---|
| 29 |
- PHP 4 or above. |
|---|
| 30 |
- GD library (http://www.boutell.com/gd/) and Freetype library |
|---|
| 31 |
(http://www.freetype.org/) for PHP. See http://us2.php.net/gd for more |
|---|
| 32 |
information. |
|---|
| 33 |
- Some sort of shell access to your web server. |
|---|
| 34 |
|
|---|
| 35 |
You can test your version of PHP for GD and Freetype with the following |
|---|
| 36 |
commands "from a shell": |
|---|
| 37 |
|
|---|
| 38 |
php -i | grep "GD Support" |
|---|
| 39 |
|
|---|
| 40 |
should return: |
|---|
| 41 |
|
|---|
| 42 |
<tr><td class="e">GD Support </td><td class="v">enabled </td></tr> |
|---|
| 43 |
|
|---|
| 44 |
and: |
|---|
| 45 |
|
|---|
| 46 |
php -i | grep "FreeType Support" |
|---|
| 47 |
|
|---|
| 48 |
should return: |
|---|
| 49 |
|
|---|
| 50 |
<tr><td class="e">FreeType Support </td><td class="v">enabled </td></tr> |
|---|
| 51 |
|
|---|
| 52 |
--- |
|---|
| 53 |
|
|---|
| 54 |
INSTALLATION: |
|---|
| 55 |
|
|---|
| 56 |
Following the directions below with the included files should allow you to |
|---|
| 57 |
add authorization image checking for comments posted on your site. It displays |
|---|
| 58 |
an image with a random word from a supplied list that the commenter has to enter in order for |
|---|
| 59 |
their comment to go through. This should cut down on any bots out there from |
|---|
| 60 |
spamming your comments area and perhaps remove the need for comment moderation. |
|---|
| 61 |
|
|---|
| 62 |
NOTE: It's important to make the indicated changes to BOTH the regular AND the |
|---|
| 63 |
popup versions of the comment pages. If you don't do that, spammers may |
|---|
| 64 |
perhaps find a way to target the unedited version of the page. |
|---|
| 65 |
|
|---|
| 66 |
1. Put the file "authimage.php" and the directory "authimage-inc" in your WP |
|---|
| 67 |
plugins directory. Keep reading past step 7 if you want to use the |
|---|
| 68 |
JavaScript form checking. |
|---|
| 69 |
|
|---|
| 70 |
2. FOR WORDPRESS VERSIONS < 1.5, look for this in 'wp-comments.php' AND 'wp-comments-popup.php'. FOR WORDPRESS VERSION 1.5, loog for this in your theme's 'comments.php' and/or 'comments-popup.php': |
|---|
| 71 |
|
|---|
| 72 |
<label for="url"><?php _e("<acronym title=\"Uniform Resource Identifier\">URI</acronym>"); ?></label> |
|---|
| 73 |
|
|---|
| 74 |
and add this after it: |
|---|
| 75 |
|
|---|
| 76 |
<p> |
|---|
| 77 |
<input type="text" name="code" id="code" value="<?php echo ""; ?>" size="28" tabindex="4" /> |
|---|
| 78 |
<label for="code"><?php _e("Enter this code: "); ?></label> |
|---|
| 79 |
<img src="<?php global $authimage; echo $authimage; ?>" width="155" height="50" alt="authimage" /> |
|---|
| 80 |
</p> |
|---|
| 81 |
|
|---|
| 82 |
3. FOR WORDPRESS VERSIONS < 1.5: Look for this in 'wp-comments-post.php': |
|---|
| 83 |
|
|---|
| 84 |
if (strlen($url) < 7) |
|---|
| 85 |
$url = ''; |
|---|
| 86 |
|
|---|
| 87 |
and add this after it: |
|---|
| 88 |
|
|---|
| 89 |
// authimage -- Check for valid sized code |
|---|
| 90 |
$code = trim(strip_tags($_POST['code'])); |
|---|
| 91 |
|
|---|
| 92 |
FOR WORDPRESS VERSION 1.5: Look for this in 'wp-comments-post.php': |
|---|
| 93 |
|
|---|
| 94 |
$comment_content = $_POST['comment']; |
|---|
| 95 |
|
|---|
| 96 |
and add this after it: |
|---|
| 97 |
|
|---|
| 98 |
$comment_code = $_POST['code']; // AuthImage |
|---|
| 99 |
|
|---|
| 100 |
4. FOR WORDPRESS VERSIONS < 1.5: You have two options next, both require editing 'wp-comments-post.php': |
|---|
| 101 |
|
|---|
| 102 |
To allow comments to come into the moderation pool, look for the following |
|---|
| 103 |
lines in 'wp-comments-post.php': |
|---|
| 104 |
|
|---|
| 105 |
if(check_comment($author, $email, $url, $comment, $user_ip)) { |
|---|
| 106 |
$approved = 1; |
|---|
| 107 |
} else { |
|---|
| 108 |
$approved = 0; |
|---|
| 109 |
} |
|---|
| 110 |
|
|---|
| 111 |
and add this afterwards: |
|---|
| 112 |
|
|---|
| 113 |
// authimage -- Check if valid code. If not valid, send to moderation. |
|---|
| 114 |
if ( !checkAICode($code) ) |
|---|
| 115 |
$approved = 0; |
|---|
| 116 |
|
|---|
| 117 |
-or- if you want to dump the comment altogether and warn the commenter |
|---|
| 118 |
that an invalid code was entered, look for the following lines in |
|---|
| 119 |
'wp-comments-post.php': |
|---|
| 120 |
|
|---|
| 121 |
if ( '' == $comment ) |
|---|
| 122 |
die( __('Error: please type a comment.') ); |
|---|
| 123 |
|
|---|
| 124 |
and add this after it: |
|---|
| 125 |
|
|---|
| 126 |
if ( !checkAICode($code) ) |
|---|
| 127 |
die( __('Error: please enter the valid authorization code.') ); |
|---|
| 128 |
|
|---|
| 129 |
FOR WORDPRESS VERSION 1.5: |
|---|
| 130 |
|
|---|
| 131 |
Look for the following lines n 'wp-comments-post.php': |
|---|
| 132 |
|
|---|
| 133 |
if ( '' == $comment_content ) |
|---|
| 134 |
die( __('Error: please type a comment.') ); |
|---|
| 135 |
|
|---|
| 136 |
and add this after it: |
|---|
| 137 |
|
|---|
| 138 |
// AuthImage |
|---|
| 139 |
if ( !checkAICode($comment_code) ) |
|---|
| 140 |
die( __('Error: please enter the valid authorization code.') ); |
|---|
| 141 |
|
|---|
| 142 |
5. Make sure you've activated the AuthImage plugin. |
|---|
| 143 |
|
|---|
| 144 |
6. Make sure your 'my-hacks.php' file contains what is in 'authimage-hacks.php'. |
|---|
| 145 |
THIS IS STILL REQUIRED! |
|---|
| 146 |
|
|---|
| 147 |
7. Enable the 'my-hacks.php legacy support' from your WP options. |
|---|
| 148 |
|
|---|
| 149 |
8. You can configure lots of how the captcha image appears by editing the |
|---|
| 150 |
'authimage-inc/veriword.ini' file. Read the PDF documentation at |
|---|
| 151 |
'authimage-inc/manualveriword.pdf' for a list of options. You can also |
|---|
| 152 |
alter the dictionary used to generate words as well as the length of |
|---|
| 153 |
the word generated. |
|---|
| 154 |
|
|---|
| 155 |
-- |
|---|
| 156 |
|
|---|
| 157 |
8. FOR WORDPRESS VERSIONS < 1.5: Edit 'wp-comments.php' AND 'wp-comments-popup.php' |
|---|
| 158 |
and change the following line. FOR WORDPRESS VERSION 1.5, this line is in |
|---|
| 159 |
'comments.php' AND 'comments-popup.php' in your theme's directory: |
|---|
| 160 |
|
|---|
| 161 |
<form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" |
|---|
| 162 |
method="post" id="commentform"> |
|---|
| 163 |
|
|---|
| 164 |
to read: |
|---|
| 165 |
|
|---|
| 166 |
<form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" |
|---|
| 167 |
method="post" id="commentform" onSubmit="return testValues(this)"> |
|---|
| 168 |
|
|---|
| 169 |
9. If you want to validate the email address, edit the plugin and uncomment |
|---|
| 170 |
the code that checks for email. That's it! |
|---|