Example #1
0
 function get_word()
 {
     if (USE_CAPTCHA_RANDOM_WORD) {
         return get_dictionary_word();
     } else {
         return rand_ascii_readable($this->length);
     }
     // lib/stdlib.php
 }
Example #2
0
 /**
  * Send mail to user and store the cookie in the db
  * wikiurl?action=ConfirmEmail&id=bla
  */
 function sendEmailConfirmation($email, $userid)
 {
     $id = rand_ascii_readable(16);
     $wikidb = $GLOBALS['request']->getDbh();
     $data = $wikidb->get('ConfirmEmail');
     while (!empty($data[$id])) {
         // id collision
         $id = rand_ascii_readable(16);
     }
     $subject = _("E-Mail address confirmation");
     $ip = $request->get('REMOTE_HOST');
     $expire_date = time() + 7 * 86400;
     $content = fmt("Someone, probably you from IP address %s, has registered an\naccount \"%s\" with this e-mail address on %s.\n\nTo confirm that this account really does belong to you and activate\ne-mail features on %s, open this link in your browser:\n\n%s\n\nIf this is *not* you, don't follow the link. This confirmation code\nwill expire at %s.", $ip, $userid, WIKI_NAME, WIKI_NAME, WikiURL(HOME_PAGE, array('action' => 'ConfirmEmail', 'id' => $id), true), CTime($expire_date));
     $this->sendMail($subject, $content, "", true);
     $data[$id] = array('email' => $email, 'userid' => $userid, 'expire' => $expire_date);
     $wikidb->set('ConfirmEmail', $data);
     return '';
 }