<?php /**************************************************************************** * DRBImageVerification * http://www.dbscripts.net/imageverification/ * * Copyright � 2007 Don Barnes ****************************************************************************/ require_once 'includes/challenge.php'; // Create challenge string // Output challenge image to user createChallengeString(); //echo "Here"; outputChallengeImage();
function show_guestbook_add_form($formTitle = NULL, $buttonName = NULL) { global $MAX_NAME_LENGTH; global $MAX_EMAIL_LENGTH; global $MAX_URL_LENGTH; global $NAME_FIELD_NAME; global $EMAIL_FIELD_NAME; global $URL_FIELD_NAME; global $COMMENTS_FIELD_NAME; global $ADD_FORM_LEGEND; global $ADD_FORM_BUTTON_TEXT; global $CHALLENGE_STRING_LENGTH; global $CHALLENGE_FIELD_NAME; global $CHALLENGE_FIELD_PARAM_NAME; global $ENABLE_EMAIL_FIELD; global $ENABLE_URL_FIELD; global $ENABLE_COMMENT_FIELD; global $GUESTBOOK_URL_PATH; global $NEW_REPLY_TEXT; if (!isset($formTitle)) { $formTitle = $ADD_FORM_LEGEND; } if (!isset($buttonName)) { $buttonName = $ADD_FORM_BUTTON_TEXT; } $ipaddress = $_SERVER['REMOTE_ADDR']; if (is_banned($ipaddress)) { return FALSE; } $nameValue = ""; if (isset($_POST['name'])) { $nameValue = "value=\"" . htmlspecialchars_default($_POST['name']) . "\" "; } $emailValue = ""; if (isset($_POST['email'])) { $emailValue = "value=\"" . htmlspecialchars_default($_POST['email']) . "\" "; } $urlValue = ""; if (isset($_POST['url'])) { $urlValue = "value=\"" . htmlspecialchars_default($_POST['url']) . "\" "; } $commentsValue = ""; if (isset($_POST['comments'])) { $commentsValue = htmlspecialchars_default($_POST['comments']); } ?> <br> <div style="width: 200px; margin: auto;"> <a id="post_new_link" href="#"><b> <?php echo htmlspecialchars_default($NEW_REPLY_TEXT); ?> </b></a> </div> <div id="error"><?php show_errors(); ?> </div> <form id="post_new" method="post" action="<?php echo urlencode($GUESTBOOK_URL_PATH); ?> "> <fieldset> <?php //<legend><?_php echo htmlspecialchars_default($formTitle); ?_></legend> ?> <p> <label for="name"><?php echo htmlspecialchars_default($NAME_FIELD_NAME); ?> :</label> <input type="text" name="name" id="name" maxlength="<?php echo htmlspecialchars_default($MAX_NAME_LENGTH); ?> " class="inputText" <?php echo $nameValue; ?> /> <br /> <?php if ($ENABLE_EMAIL_FIELD === TRUE) { ?> <label for="email"><?php echo htmlspecialchars_default($EMAIL_FIELD_NAME); ?> :</label> <input type="text" name="email" id="email" maxlength="<?php echo htmlspecialchars_default($MAX_EMAIL_LENGTH); ?> " class="inputText" <?php echo $emailValue; ?> /> <br /> <?php } ?> <?php if ($ENABLE_URL_FIELD === TRUE) { ?> <label for="url"><?php echo htmlspecialchars_default($URL_FIELD_NAME); ?> :</label> <input type="text" name="url" id="url" maxlength="<?php echo htmlspecialchars_default($MAX_URL_LENGTH); ?> " class="inputText" <?php echo $urlValue; ?> /> <br /> <?php } ?> <?php if ($ENABLE_COMMENT_FIELD === TRUE) { ?> <label for="comments"><?php echo htmlspecialchars_default($COMMENTS_FIELD_NAME); ?> :</label> <textarea name="comments" id="comments" cols="40" rows="4" class="inputTextArea"> <?php echo $commentsValue; ?> </textarea> <br /> <?php } ?> <?php global $CHALLENGE_ENABLED; if ($CHALLENGE_ENABLED === TRUE) { // Create the challenge string and store in the session createChallengeString(); ?> <label for="<?php echo htmlspecialchars_default($CHALLENGE_FIELD_PARAM_NAME); ?> "><?php echo htmlspecialchars_default($CHALLENGE_FIELD_NAME); ?> :</label> <input type="text" name="<?php echo htmlspecialchars_default($CHALLENGE_FIELD_PARAM_NAME); ?> " id="<?php echo htmlspecialchars_default($CHALLENGE_FIELD_PARAM_NAME); ?> " maxlength="<?php echo htmlspecialchars_default($CHALLENGE_STRING_LENGTH); ?> " size="<?php echo htmlspecialchars_default($CHALLENGE_STRING_LENGTH); ?> " class="inputText" /> <img src="<?php echo urlencode($GUESTBOOK_URL_PATH); ?> ?action=challengeimage" alt="Challenge Image" class="challengeImage" /> <br /> <?php } ?> </p> <input type="hidden" name="action" value="add" /> <input type="submit" value="<?php echo htmlspecialchars_default($buttonName); ?> " class="submit" /> </fieldset> </form> <?php }