Skip to content

Commit

Permalink
require at least one character after http://. require simple proof yo…
Browse files Browse the repository at this point in the history
…u're a human before allowing adding
  • Loading branch information
iamcal committed Nov 2, 2010
1 parent 5fd49df commit 134e6de
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
15 changes: 14 additions & 1 deletion station_add.php
Expand Up @@ -51,7 +51,7 @@
# url validation
#

if (!preg_match('!^http://!i', StripSlashes($hash['blog_url']))){
if (!preg_match('!^http://.!i', StripSlashes($hash['blog_url']))){
$ok = 0;
$smarty->assign('error_url_http', 1);
}
Expand Down Expand Up @@ -81,6 +81,19 @@
}


#
# human proof
#

if ($ok){
if (trim($_POST['prove']) != '7'){

$ok = 0;
$smarty->assign('error_prove', 1);
}
}


#
# ok! add it!
#
Expand Down
7 changes: 7 additions & 0 deletions templates/page_station_add.txt
Expand Up @@ -64,6 +64,13 @@
(You will need to remember this if you want to edit your details in future.)
</td>
</tr>
<tr valign="top">
<td><b>Prove you're human:</b></td>
<td>
<input type="text" name="prove" style="width: 300px;{if $error_prove} background-color: red; color: white;{/if}" value="{$smarty.post.prove|escape}"><br />
Enter the answer to 3+4
</td>
</tr>
<tr valign="top">
<td>&nbsp;</td>
<td><input type="submit" value="Add My Weblog"></td>
Expand Down
2 changes: 1 addition & 1 deletion weblog_edit.php
Expand Up @@ -79,7 +79,7 @@
# url validation
#

if (!preg_match('!^http://!i', $edit['blog_url'])){
if (!preg_match('!^http://.!i', $edit['blog_url'])){
$ok = 0;
$smarty->assign('error_url_http', 1);
}
Expand Down

0 comments on commit 134e6de

Please sign in to comment.