11
jfmoore
Re: Frameworks Captcha
  • 2007/2/20 4:11

  • jfmoore

  • Quite a regular

  • Posts: 360

  • Since: 2004/6/6 5


So, what's the answer? Can you use it on 2.2.x? If so, what file(s) must be modified?

JFM
...

12
jfmoore
Re: Frameworks Captcha
  • 2007/2/22 15:19

  • jfmoore

  • Quite a regular

  • Posts: 360

  • Since: 2004/6/6 5


Does anyone know the answer to this?
...

13
JamesSAEP
Re: Frameworks Captcha
  • 2007/3/2 17:48

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


This is a great feature if I can get it working. I copied your register.php code below, but the registration page looks like the default one. Is there something else that needs to be done?


J
Quote:

phppp wrote:
For 2.016, modify one file: register.php
<?php
// $Id: register.php 2 2005-11-02 18:23:29Z skalpa $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <https://xoops.org/>                             //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //

$xoopsOption['pagetype'] = 'user';

include 
'mainfile.php';
$myts =& MyTextSanitizer::getInstance();

$config_handler =& xoops_gethandler('config');
$xoopsConfigUser =& $config_handler->getConfigsByCat(XOOPS_CONF_USER);

if (empty(
$xoopsConfigUser['allow_register'])) {
    
redirect_header('index.php'6_US_NOREGISTER);
    exit();
}

function 
userCheck($uname$email$pass$vpass)
{
    global 
$xoopsConfigUser;
    
$xoopsDB =& Database::getInstance();
    
$myts =& MyTextSanitizer::getInstance();
    
$stop '';
    if (!
checkEmail($email)) {
        
$stop .= _US_INVALIDMAIL.'<br />';
    }
    foreach (
$xoopsConfigUser['bad_emails'] as $be) {
        if (!empty(
$be) && preg_match("/".$be."/i"$email)) {
            
$stop .= _US_INVALIDMAIL.'<br />';
            break;
        }
    }
    if (
strrpos($email,' ') > 0) {
        
$stop .= _US_EMAILNOSPACES.'<br />';
    }
    
$uname xoops_trim($uname);
    switch (
$xoopsConfigUser['uname_test_level']) {
    case 
0:
        
// strict
        
$restriction '/[^a-zA-Z0-9_-]/';
        break;
    case 
1:
        
// medium
        
$restriction '/[^a-zA-Z0-9_-<>,.$%#@!\'"]/';
        break;
    case 2:
        // loose
        
$restriction = '/[00-40]/';
        break;
    }
    if (empty(
$uname) || preg_match($restriction$uname)) {
        
$stop .= _US_INVALIDNICKNAME."<br />";
    }
    if (strlen(
$uname) > $xoopsConfigUser['maxuname']) {
        
$stop .= sprintf(_US_NICKNAMETOOLONG, $xoopsConfigUser['maxuname'])."<br />";
    }
    if (strlen(
$uname) < $xoopsConfigUser['minuname']) {
        
$stop .= sprintf(_US_NICKNAMETOOSHORT, $xoopsConfigUser['minuname'])."<br />";
    }
    foreach (
$xoopsConfigUser['bad_unames'] as $bu) {
        if (!empty(
$bu) && preg_match("/".$bu."/i", $uname)) {
            
$stop .= _US_NAMERESERVED."<br />";
            break;
        }
    }
    if (strrpos(
$uname, ' ') > 0) {
        
$stop .= _US_NICKNAMENOSPACES."<br />";
    }
    
$sql = sprintf('SELECT COUNT(*) FROM %s WHERE uname = %s', $xoopsDB->prefix('users'), $xoopsDB->quoteString(addslashes($uname)));
    
$result = $xoopsDB->query($sql);
    list(
$count) = $xoopsDB->fetchRow($result);
    if (
$count > 0) {
        
$stop .= _US_NICKNAMETAKEN."<br />";
    }
    
$count = 0;
    if ( 
$email ) {
        
$sql = sprintf('SELECT COUNT(*) FROM %s WHERE email = %s', $xoopsDB->prefix('users'), $xoopsDB->quoteString(addslashes($email)));
        
$result = $xoopsDB->query($sql);
        list(
$count) = $xoopsDB->fetchRow($result);
        if ( 
$count > 0 ) {
            
$stop .= _US_EMAILTAKEN."<br />";
        }
    }
    if ( !isset(
$pass) || $pass == '' || !isset($vpass) || $vpass == '' ) {
        
$stop .= _US_ENTERPWD.'<br />';
    }
    if ( (isset(
$pass)) && ($pass != $vpass) ) {
        
$stop .= _US_PASSNOTSAME.'<br />';
    } elseif ( (
$pass != '') && (strlen($pass) < $xoopsConfigUser['minpass']) ) {
        
$stop .= sprintf(_US_PWDTOOSHORT,$xoopsConfigUser['minpass'])."<br />";
    }
    return 
$stop;
}
$op = !isset($_POST['op']) ? 'register' : $_POST['op'];
$uname = isset($_POST['uname']) ? $myts->stripSlashesGPC($_POST['uname']) : '';
$email = isset($_POST['email']) ? trim($myts->stripSlashesGPC($_POST['email'])) : '';
$url = isset($_POST['url']) ? trim($myts->stripSlashesGPC($_POST['url'])) : '';
$pass = isset($_POST['pass']) ? $myts->stripSlashesGPC($_POST['pass']) : '';
$vpass = isset($_POST['vpass']) ? $myts->stripSlashesGPC($_POST['vpass']) : '';
$timezone_offset = isset($_POST['timezone_offset']) ? intval($_POST['timezone_offset']) : $xoopsConfig['default_TZ'];
$user_viewemail = (isset($_POST['user_viewemail']) && intval($_POST['user_viewemail'])) ? 1 : 0;
$user_mailok = (isset($_POST['user_mailok']) && intval($_POST['user_mailok'])) ? 1 : 0;
$agree_disc = (isset($_POST['agree_disc']) && intval($_POST['agree_disc'])) ? 1 : 0;
switch ( 
$op ) {
case 'newuser':
    include 'header.php';
    
$stop = '';
    if (!
$GLOBALS['xoopsSecurity']->check()) {
        
$stop .= implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())."<br />";
    }
    if (
$xoopsConfigUser['reg_dispdsclmr'] != 0 && $xoopsConfigUser['reg_disclaimer'] != '') {
        if (empty(
$agree_disc)) {
            
$stop .= _US_UNEEDAGREE.'<br />';
        }
    }
    
$stop .= userCheck($uname$email$pass$vpass);
    if (empty(
$stop)) {
        echo _US_USERNAME."
".$myts->htmlSpecialChars($uname)."<br />";
        echo _US_EMAIL."
".$myts->htmlSpecialChars($email)."<br />";
        if (
$url != '') {
            
$url = formatURL($url);
            echo _US_WEBSITE.': '.
$myts->htmlSpecialChars($url).'<br />';
        }
        
$f_timezone = ($timezone_offset < 0) ? 'GMT '.$timezone_offset : 'GMT +'.$timezone_offset;
        echo _US_TIMEZONE."
$f_timezone<br />";
        echo "
<form action='register.php' method='post'>";
        if(@include_once XOOPS_ROOT_PATH."
/Frameworks/captcha/formcaptcha.php") {
            
$cpatcha = new XoopsFormCaptcha();
            echo 
$cpatcha->getCaption()."".$cpatcha->render();
        }
        echo "
        
<input type='hidden' name='uname' value='".$myts->htmlSpecialChars($uname)."' />
        <
input type='hidden' name='email' value='".$myts->htmlSpecialChars($email)."' />";
        echo "
<input type='hidden' name='user_viewemail' value='".$user_viewemail."' />
        <
input type='hidden' name='timezone_offset' value='".(float)$timezone_offset."' />
        <
input type='hidden' name='url' value='".$myts->htmlSpecialChars($url)."' />
        <
input type='hidden' name='pass' value='".$myts->htmlSpecialChars($pass)."' />
        <
input type='hidden' name='vpass' value='".$myts->htmlSpecialChars($vpass)."' />
        <
input type='hidden' name='user_mailok' value='".$user_mailok."' />
        <
br /><br /><input type='hidden' name='op' value='finish' />".$GLOBALS['xoopsSecurity']->getTokenHTML()."<input type='submit' value='". _US_FINISH ."' /></form>";
    } else {
        echo "
<span style='color:#ff0000;'>$stop</span>";
        include 'include/registerform.php';
        
$reg_form->display();
    }
    include 'footer.php';
    break;
case 'finish':
    include 'header.php';
    
$stop = userCheck($uname$email$pass$vpass);
    if (!
$GLOBALS['xoopsSecurity']->check()) {
        
$stop .= implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())."<br />";
    }
    if(@include_once XOOPS_ROOT_PATH."
/Frameworks/captcha/captcha.php") {
        
$xoopsCaptcha = XoopsCaptcha::instance();
        if(! 
$xoopsCaptcha->verify() ) {
            
$stop .= $xoopsCaptcha->getMessage()."<br />";
        }
    }
    if ( empty(
$stop) ) {
        
$member_handler =& xoops_gethandler('member');
        
$newuser =& $member_handler->createUser();
        
$newuser->setVar('user_viewemail',$user_viewemail, true);
        
$newuser->setVar('uname', $uname, true);
        
$newuser->setVar('email', $email, true);
        if (
$url != '') {
            
$newuser->setVar('url', formatURL($url), true);
        }
        
$newuser->setVar('user_avatar','blank.gif', true);
        
$actkey = substr(md5(uniqid(mt_rand(), 1)), 0, 8);
        
$newuser->setVar('actkey', $actkey, true);
        
$newuser->setVar('pass', md5($pass), true);
        
$newuser->setVar('timezone_offset', $timezone_offset, true);
        
$newuser->setVar('user_regdate', time(), true);
        
$newuser->setVar('uorder',$xoopsConfig['com_order'], true);
        
$newuser->setVar('umode',$xoopsConfig['com_mode'], true);
        
$newuser->setVar('user_mailok',$user_mailok, true);
        if (
$xoopsConfigUser['activation_type'] == 1) {
            
$newuser->setVar('level', 1, true);
        }
        if (!
$member_handler->insertUser($newuser)) {
            echo _US_REGISTERNG;
            include 'footer.php';
            exit();
        }
        
$newid = $newuser->getVar('uid');
        if (!
$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newid)) {
            echo _US_REGISTERNG;
            include 'footer.php';
            exit();
        }
        if (
$xoopsConfigUser['activation_type'] == 1) {
            redirect_header('index.php', 4, _US_ACTLOGIN);
            exit();
        }
        if (
$xoopsConfigUser['activation_type'] == 0) {
            
$xoopsMailer =& getMailer();
            
$xoopsMailer->useMail();
            
$xoopsMailer->setTemplate('register.tpl');
            
$xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
            
$xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
            
$xoopsMailer->assign('SITEURL', XOOPS_URL."/");
            
$xoopsMailer->setToUsers(new XoopsUser($newid));
            
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            
$xoopsMailer->setFromName($xoopsConfig['sitename']);
            
$xoopsMailer->setSubject(sprintf(_US_USERKEYFOR, $uname));
            if ( !
$xoopsMailer->send() ) {
                echo _US_YOURREGMAILNG;
            } else {
                echo _US_YOURREGISTERED;
            }
        } elseif (
$xoopsConfigUser['activation_type'] == 2) {
            
$xoopsMailer =& getMailer();
            
$xoopsMailer->useMail();
            
$xoopsMailer->setTemplate('adminactivate.tpl');
            
$xoopsMailer->assign('USERNAME', $uname);
            
$xoopsMailer->assign('USEREMAIL', $email);
            
$xoopsMailer->assign('USERACTLINK', XOOPS_URL.'/user.php?op=actv&id='.$newid.'&actkey='.$actkey);
            
$xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
            
$xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
            
$xoopsMailer->assign('SITEURL', XOOPS_URL."/");
            
$member_handler =& xoops_gethandler('member');
            
$xoopsMailer->setToGroups($member_handler->getGroup($xoopsConfigUser['activation_group']));
            
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            
$xoopsMailer->setFromName($xoopsConfig['sitename']);
            
$xoopsMailer->setSubject(sprintf(_US_USERKEYFOR, $uname));
            if ( !
$xoopsMailer->send() ) {
                echo _US_YOURREGMAILNG;
            } else {
                echo _US_YOURREGISTERED2;
            }
        }
        if (
$xoopsConfigUser['new_user_notify'] == 1 && !empty($xoopsConfigUser['new_user_notify_group'])) {
            
$xoopsMailer =& getMailer();
            
$xoopsMailer->useMail();
            
$member_handler =& xoops_gethandler('member');
            
$xoopsMailer->setToGroups($member_handler->getGroup($xoopsConfigUser['new_user_notify_group']));
            
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            
$xoopsMailer->setFromName($xoopsConfig['sitename']);
            
$xoopsMailer->setSubject(sprintf(_US_NEWUSERREGAT,$xoopsConfig['sitename']));
            
$xoopsMailer->setBody(sprintf(_US_HASJUSTREG, $uname));
            
$xoopsMailer->send();
        }
    } else {
        echo "
<span style='color:#ff0000; font-weight:bold;'>$stop</span>";
        include 'include/registerform.php';
        
$reg_form->display();
    }
    include 'footer.php';
    break;
case 'register':
default:
    include 'header.php';
    include 'include/registerform.php';
    
$reg_form->display();
    include 'footer.php';
    break;
}
?>

14
jfmoore
Re: Frameworks Captcha
  • 2007/3/2 19:00

  • jfmoore

  • Quite a regular

  • Posts: 360

  • Since: 2004/6/6 5


Okay, we know it works on 2.0.16 and what to do, since, as you point out, we have the instructions. The question, though, was does it work on 2.2.x, and, if so, are the instructions the same as far as file changes to make? I would still like to know the answer.
...

15
JamesSAEP
Re: Frameworks Captcha
  • 2007/3/2 19:03

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


Quote:

jfmoore wrote:
... since, as you point out, we have the instructions


No, I can't get it working on 2.0.16. I copied the register.php code and nothing displays... So, we are both looking for an answer.

16
skenow
Re: Frameworks Captcha
  • 2007/3/2 19:30

  • skenow

  • Home away from home

  • Posts: 993

  • Since: 2004/11/17


The formcaptcha.php file also includes instructions you need to follow...
Quote:
* Usage
*
* For form creation:
* 1 Add [include_once XOOPS_ROOT_PATH."/Frameworks/captcha/formcaptcha.php";] to class/xoopsformloader.php, OR add to the file that uses CAPTCHA before calling XoopsFormCaptcha
* 2 Add form element where proper: $xoopsform->addElement(new XoopsFormCaptcha($caption, $name, $skipmember, ...);
*
* For verification:
* if(@include_once XOOPS_ROOT_PATH."/Frameworks/captcha/captcha.php") {
* $xoopsCaptcha = XoopsCaptcha::instance();
* if(! $xoopsCaptcha->verify() ) {
* echo $xoopsCaptcha->getMessage();
* ...
* }
* }

Edit your class/xoopsformloader.php or register.php to include the 'include_once' statement

17
JamesSAEP
Re: Frameworks Captcha
  • 2007/3/2 21:08

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


Thanks for the reply. I did follow the instructions, but still no luck.

Would you be able to post all the code for the all the files necessary to get this working?

Thanks.

18
skenow
Re: Frameworks Captcha
  • 2007/3/2 21:19

  • skenow

  • Home away from home

  • Posts: 993

  • Since: 2004/11/17


I'll be back later an post what I have used

19
JamesSAEP
Re: Frameworks Captcha
  • 2007/3/2 21:21

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


Thanks!

20
skenow
Re: Frameworks Captcha
  • 2007/3/2 22:03

  • skenow

  • Home away from home

  • Posts: 993

  • Since: 2004/11/17


register.php
<?php
// $Id: register.php,v 1.13.4.4 2005/03/29 15:58:11 mithyt2 Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <https://xoops.org/>                             //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //

$xoopsOption['pagetype'] = 'user';

include 
'mainfile.php';
$myts =& MyTextSanitizer::getInstance();

$config_handler =& xoops_gethandler('config');
$xoopsConfigUser =& $config_handler->getConfigsByCat(XOOPS_CONF_USER);

if (empty(
$xoopsConfigUser['allow_register'])) {
    
redirect_header('index.php'6_US_NOREGISTER);
    exit();
}

function 
userCheck($uname$email$pass$vpass)
{
    global 
$xoopsConfigUser;
    
$xoopsDB =& Database::getInstance();
    
$myts =& MyTextSanitizer::getInstance();
    
$stop '';
    if (!
checkEmail($email)) {
        
$stop .= _US_INVALIDMAIL.'<br />';
    }
    foreach (
$xoopsConfigUser['bad_emails'] as $be) {
        if (!empty(
$be) && preg_match("/".$be."/i"$email)) {
            
$stop .= _US_INVALIDMAIL.'<br />';
            break;
        }
    }
    if (
strrpos($email,' ') > 0) {
        
$stop .= _US_EMAILNOSPACES.'<br />';
    }
    
$uname xoops_trim($uname);
    switch (
$xoopsConfigUser['uname_test_level']) {
    case 
0:
        
// strict
        
$restriction '/[^a-zA-Z0-9_-]/';
        break;
    case 
1:
        
// medium
        
$restriction '/[^a-zA-Z0-9_-<>,.$%#@!\'"]/';
        break;
    case 2:
        // loose
        
$restriction = '/[00-40]/';
        break;
    }
    if (empty(
$uname) || preg_match($restriction$uname)) {
        
$stop .= _US_INVALIDNICKNAME."<br />";
    }
    if (strlen(
$uname) > $xoopsConfigUser['maxuname']) {
        
$stop .= sprintf(_US_NICKNAMETOOLONG, $xoopsConfigUser['maxuname'])."<br />";
    }
    if (strlen(
$uname) < $xoopsConfigUser['minuname']) {
        
$stop .= sprintf(_US_NICKNAMETOOSHORT, $xoopsConfigUser['minuname'])."<br />";
    }
    foreach (
$xoopsConfigUser['bad_unames'] as $bu) {
        if (!empty(
$bu) && preg_match("/".$bu."/i", $uname)) {
            
$stop .= _US_NAMERESERVED."<br />";
            break;
        }
    }
    if (strrpos(
$uname, ' ') > 0) {
        
$stop .= _US_NICKNAMENOSPACES."<br />";
    }
    
$sql = sprintf('SELECT COUNT(*) FROM %s WHERE uname = %s', $xoopsDB->prefix('users'), $xoopsDB->quoteString(addslashes($uname)));
    
$result = $xoopsDB->query($sql);
    list(
$count) = $xoopsDB->fetchRow($result);
    if (
$count > 0) {
        
$stop .= _US_NICKNAMETAKEN."<br />";
    }
    
$count = 0;
    if ( 
$email ) {
        
$sql = sprintf('SELECT COUNT(*) FROM %s WHERE email = %s', $xoopsDB->prefix('users'), $xoopsDB->quoteString(addslashes($email)));
        
$result = $xoopsDB->query($sql);
        list(
$count) = $xoopsDB->fetchRow($result);
        if ( 
$count > 0 ) {
            
$stop .= _US_EMAILTAKEN."<br />";
        }
    }
    if ( !isset(
$pass) || $pass == '' || !isset($vpass) || $vpass == '' ) {
        
$stop .= _US_ENTERPWD.'<br />';
    }
    if ( (isset(
$pass)) && ($pass != $vpass) ) {
        
$stop .= _US_PASSNOTSAME.'<br />';
    } elseif ( (
$pass != '') && (strlen($pass) < $xoopsConfigUser['minpass']) ) {
        
$stop .= sprintf(_US_PWDTOOSHORT,$xoopsConfigUser['minpass'])."<br />";
    }
    return 
$stop;
}
$op = !isset($_POST['op']) ? 'register' : $_POST['op'];
$uname = isset($_POST['uname']) ? $myts->stripSlashesGPC($_POST['uname']) : '';
$email = isset($_POST['email']) ? trim($myts->stripSlashesGPC($_POST['email'])) : '';
$url = isset($_POST['url']) ? trim($myts->stripSlashesGPC($_POST['url'])) : '';
$pass = isset($_POST['pass']) ? $myts->stripSlashesGPC($_POST['pass']) : '';
$vpass = isset($_POST['vpass']) ? $myts->stripSlashesGPC($_POST['vpass']) : '';
$timezone_offset = isset($_POST['timezone_offset']) ? intval($_POST['timezone_offset']) : $xoopsConfig['default_TZ'];
$user_viewemail = (isset($_POST['user_viewemail']) && intval($_POST['user_viewemail'])) ? 1 : 0;
$user_mailok = (isset($_POST['user_mailok']) && intval($_POST['user_mailok'])) ? 1 : 0;
$agree_disc = (isset($_POST['agree_disc']) && intval($_POST['agree_disc'])) ? 1 : 0;
$name = isset($_POST['name']) ? $myts->stripSlashesGPC($_POST['name']) : '';
switch ( 
$op ) {
case 'newuser':
    include 'header.php';
    
$stop = '';
    if (!
$GLOBALS['xoopsSecurity']->check()) {
        
$stop .= implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())."<br />";
    }
    if (
$xoopsConfigUser['reg_dispdsclmr'] != 0 && $xoopsConfigUser['reg_disclaimer'] != '') {
        if (empty(
$agree_disc)) {
            
$stop .= _US_UNEEDAGREE.'<br />';
        }
    }
    
$stop .= userCheck($uname$email$pass$vpass);
    if (empty(
$stop)) {
        echo _US_USERNAME."
".$myts->htmlSpecialChars($uname)."<br />";
        echo _US_EMAIL."
".$myts->htmlSpecialChars($email)."<br />";
        echo _US_REALNAME."
".$myts->htmlSpecialChars($name)."<br />";
        if (
$url != '') {
            
$url = formatURL($url);
            echo _US_WEBSITE.': '.
$myts->htmlSpecialChars($url).'<br />';
        }
        
$f_timezone = ($timezone_offset < 0) ? 'GMT '.$timezone_offset : 'GMT +'.$timezone_offset;
        echo _US_TIMEZONE."
$f_timezone<br />";
        echo "
<form action='register.php' method='post'>";
[color=ff0000]        if(@include_once XOOPS_ROOT_PATH."
/Frameworks/captcha/formcaptcha.php") {
            
$cpatcha = new XoopsFormCaptcha();
            echo 
$cpatcha->getCaption()."".$cpatcha->render();
        }
        echo "
[/color]
        <
input type='hidden' name='uname' value='".$myts->htmlSpecialChars($uname)."' />
        <
input type='hidden' name='name' value='".$myts->htmlSpecialChars($name)."' />
        <
input type='hidden' name='email' value='".$myts->htmlSpecialChars($email)."' />";
        echo "
<input type='hidden' name='user_viewemail' value='".$user_viewemail."' />
        <
input type='hidden' name='timezone_offset' value='".(float)$timezone_offset."' />
        <
input type='hidden' name='url' value='".$myts->htmlSpecialChars($url)."' />
        <
input type='hidden' name='pass' value='".$myts->htmlSpecialChars($pass)."' />
        <
input type='hidden' name='vpass' value='".$myts->htmlSpecialChars($vpass)."' />
        <
input type='hidden' name='user_mailok' value='".$user_mailok."' />
        <
br /><br /><input type='hidden' name='op' value='finish' />".$GLOBALS['xoopsSecurity']->getTokenHTML()."<input type='submit' value='". _US_FINISH ."' /></form>";
    } else {
        echo "
<span style='color:#ff0000;'>$stop</span>";
        include 'include/registerform.php';
        
$reg_form->display();
    }
    include 'footer.php';
    break;
case 'finish':
    include 'header.php';
    
$stop = userCheck($uname$email$pass$vpass);
    if (!
$GLOBALS['xoopsSecurity']->check()) {
        
$stop .= implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())."<br />";
    }
[color=ff0000]    if(@include_once XOOPS_ROOT_PATH."
/Frameworks/captcha/captcha.php") {
        
$xoopsCaptcha = XoopsCaptcha::instance();
        if(! 
$xoopsCaptcha->verify() ) {
            
$stop .= $xoopsCaptcha->getMessage()."<br />";
        }
    }[/color]
    if ( empty(
$stop) ) {
        
$member_handler =& xoops_gethandler('member');
        
$newuser =& $member_handler->createUser();
        
$newuser->setVar('user_viewemail',$user_viewemail, true);
        
$newuser->setVar('uname', $uname, true);
        
$newuser->setVar('email', $email, true);
        if (
$url != '') {
            
$newuser->setVar('url', formatURL($url), true);
        }
//        
$name = isset($name) ? $name : '';
        
$newuser->setVar('name', $name);
        
$newuser->setVar('user_avatar','blank.gif', true);
        
$actkey = substr(md5(uniqid(mt_rand(), 1)), 0, 8);
        
$newuser->setVar('actkey', $actkey, true);
        
$newuser->setVar('pass', md5($pass), true);
        
$newuser->setVar('timezone_offset', $timezone_offset, true);
        
$newuser->setVar('user_regdate', time(), true);
        
$newuser->setVar('uorder',$xoopsConfig['com_order'], true);
        
$newuser->setVar('umode',$xoopsConfig['com_mode'], true);
        
$newuser->setVar('user_mailok',$user_mailok, true);
        if (
$xoopsConfigUser['activation_type'] == 1) {
            
$newuser->setVar('level', 1, true);
        }
        if (!
$member_handler->insertUser($newuser)) {
            echo _US_REGISTERNG;
            include 'footer.php';
            exit();
        }
        
$newid = $newuser->getVar('uid');
        if (!
$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newid)) {
            echo _US_REGISTERNG;
            include 'footer.php';
            exit();
        }
        if (
$xoopsConfigUser['activation_type'] == 1) {
            redirect_header('index.php', 4, _US_ACTLOGIN);
            exit();
        }
        if (
$xoopsConfigUser['activation_type'] == 0) {
            
$xoopsMailer =& getMailer();
            
$xoopsMailer->useMail();
            
$xoopsMailer->setTemplate('register.tpl');
            
$xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
            
$xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
            
$xoopsMailer->assign('SITEURL', XOOPS_URL."/");
            
$xoopsMailer->setToUsers(new XoopsUser($newid));
            
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            
$xoopsMailer->setFromName($xoopsConfig['sitename']);
            
$xoopsMailer->setSubject(sprintf(_US_USERKEYFOR, $uname));
            if ( !
$xoopsMailer->send() ) {
                echo _US_YOURREGMAILNG;
            } else {
                echo _US_YOURREGISTERED;
            }
        } elseif (
$xoopsConfigUser['activation_type'] == 2) {
            
$xoopsMailer =& getMailer();
            
$xoopsMailer->useMail();
            
$xoopsMailer->setTemplate('adminactivate.tpl');
            
$xoopsMailer->assign('USERNAME', $uname);
            
$xoopsMailer->assign('USEREMAIL', $email);
            
$xoopsMailer->assign('USERACTLINK', XOOPS_URL.'/user.php?op=actv&id='.$newid.'&actkey='.$actkey);
            
$xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
            
$xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
            
$xoopsMailer->assign('SITEURL', XOOPS_URL."/");
            
$xoopsMailer->assign('USERURL', formatURL($url));
            
$xoopsMailer->assign('REALNAME', $myts->oopsStripSlashesGPC($name));
            
$member_handler =& xoops_gethandler('member');
            
$xoopsMailer->setToGroups($member_handler->getGroup($xoopsConfigUser['activation_group']));
            
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            
$xoopsMailer->setFromName($xoopsConfig['sitename']);
            
$xoopsMailer->setSubject(sprintf(_US_USERKEYFOR, $uname));
            if ( !
$xoopsMailer->send() ) {
                echo _US_YOURREGMAILNG;
            } else {
                echo _US_YOURREGISTERED2;
            }
        }
        if (
$xoopsConfigUser['new_user_notify'] == 1 && !empty($xoopsConfigUser['new_user_notify_group'])) {
            
$xoopsMailer =& getMailer();
            
$xoopsMailer->useMail();
            
$member_handler =& xoops_gethandler('member');
            
$xoopsMailer->setToGroups($member_handler->getGroup($xoopsConfigUser['new_user_notify_group']));
            
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            
$xoopsMailer->setFromName($xoopsConfig['sitename']);
            
$xoopsMailer->setSubject(sprintf(_US_NEWUSERREGAT,$xoopsConfig['sitename']));
            
$xoopsMailer->setBody(sprintf(_US_HASJUSTREG, $uname));
            
$xoopsMailer->send();
        }
    } else {
        echo "
<span style='color:#ff0000; font-weight:bold;'>$stop</span>";
        include 'include/registerform.php';
        
$reg_form->display();
    }
    include 'footer.php';
    break;
case 'register':
default:
    include 'header.php';
    include 'include/registerform.php';
    
$reg_form->display();
    include 'footer.php';
    break;
}
?>


class/xoopsformloader.php
<?php
// $Id: xoopsformloader.php 669 2006-08-25 22:14:09Z skalpa $
if (!defined('XOOPS_ROOT_PATH')) {
    exit();
}
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formelement.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/form.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formlabel.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formselect.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formpassword.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formbutton.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formcheckbox.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formhidden.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formfile.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formradio.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formradioyn.php";
//include_once XOOPS_ROOT_PATH."/class/xoopsform/formselectavatar.php";
include_once XOOPS_ROOT_PATH."/class/xoopsform/formselectcountry.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formselecttimezone.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formselectlang.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formselectgroup.php";
// RMV-NOTIFY
include_once XOOPS_ROOT_PATH."/class/xoopsform/formselectuser.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formselecttheme.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formselectmatchoption.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formtext.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formtextarea.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formdhtmltextarea.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formelementtray.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/themeform.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/simpleform.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formtextdateselect.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formdatetime.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsform/formhiddentoken.php";
//include_once XOOPS_ROOT_PATH."/class/xoopsform/grouppermform.php";
include_once XOOPS_ROOT_PATH."/class/xoopsform/formcolorpicker.php";
[
color=ff0000]include_once XOOPS_ROOT_PATH."/Frameworks/captcha/formcaptcha.php";[/color]

?>


Remember to clear templates_c and cache!

Login

Who's Online

154 user(s) are online (104 user(s) are browsing Support Forums)


Members: 0


Guests: 154


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits