Sorry to bump this up but I really need some help.
Iv been trying to get this to work for hours with no luck.
I can get the form element to be generated fine but it doesnt check for it be valid.
<?php // $Id: register.php,v 1.1.2.13.2.1 2005/09/18 13:59:36 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 // // ------------------------------------------------------------------------ // include '../../mainfile.php'; [color=CC0000]include_once XOOPS_ROOT_PATH.'/Frameworks/captcha/formcaptcha.php';[/color] include_once 'include/functions.php'; $myts =& MyTextSanitizer::getInstance(); if (empty($xoopsModuleConfig['allow_register'])) { redirect_header('../../index.php', 6, _PROFILE_MA_NOREGISTER); exit(); } include XOOPS_ROOT_PATH.'/header.php'; $member_handler =& xoops_gethandler('member'); $newuser =& $member_handler->createUser(); $op = !isset($_POST['op']) ? 'register' : $_POST['op']; if ($op != "register") { $newuser->setVar('uname', isset($_POST['uname']) ? trim($_POST['uname']) : ''); $newuser->setVar('loginname', isset($_POST['loginname']) ? trim($_POST['loginname']) : ''); $newuser->setVar('email', isset($_POST['email']) ? trim($_POST['email']) : ''); //Dynamic fields $profile_handler =& xoops_gethandler('profile'); // Get fields $fields =& $profile_handler->loadFields(); if (count($fields) > 0) { foreach (array_keys($fields) as $i) { $fieldname = $fields[$i]->getVar('field_name'); if ($fields[$i]->getVar('field_register') && isset($_POST[$fieldname])) { $newuser->setVar($fieldname, $_POST[$fieldname]); } } } $vpass = isset($_POST['vpass']) ? $myts->stripSlashesGPC($_POST['vpass']) : ''; $agree_disc = (isset($_POST['agree_disc']) && intval($_POST['agree_disc'])) ? 1 : 0; } switch ( $op ) { case 'newuser': if (!$GLOBALS['xoopsSecurity']->check()) { echo implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()); break; } $newuser->setVar('pass', isset($_POST['pass']) ? md5(trim($_POST['pass'])) : ''); $stop = ''; if ($xoopsModuleConfig['display_disclaimer'] != 0 && $xoopsModuleConfig['disclaimer'] != '') { if (empty($agree_disc)) { $stop .= _PROFILE_MA_UNEEDAGREE.'<br />'; } } if (!empty($xoopsModuleConfig['minpass']) && strlen(trim($_POST['pass'])) < $xoopsModuleConfig['minpass']) { $stop .= sprintf(_PROFILE_MA_PWDTOOSHORT,$xoopsModuleConfig['minpass'])."<br />"; } $stop .= userCheck($newuser); if (empty($stop)) { [color=CC0000]if(@include_once XOOPS_ROOT_PATH."/Frameworks/captcha/formcaptcha.php") { $cpatcha = new XoopsFormCaptcha(); echo $cpatcha->getCaption().": ".$cpatcha->render()."<br />"; }[/color] echo _PROFILE_MA_USERNAME.": ".$newuser->getVar('loginname')."<br />"; echo _PROFILE_MA_EMAIL.": ".$newuser->getVar('email')."<br />"; echo _PROFILE_MA_DISPLAYNAME.": ".$newuser->getVar('uname')."<br />"; $profile_handler =& xoops_gethandler('profile'); // Get fields $fields =& $profile_handler->loadFields(); if (count($fields) > 0) { foreach (array_keys($fields) as $i) { $fieldname = $fields[$i]->getVar('field_name'); if ($fields[$i]->getVar('field_register') && isset($_POST[$fieldname])) { $value = $newuser->getVar($fieldname); if (is_array($value)) { $values = array(); $options = $fields[$i]->getVar('field_options'); foreach ($value as $thisvalue) { $values = $options[$thisvalue]; } $value = implode(', ', $values); } echo $fields[$i]->getVar('field_title').": ".$value."<br />"; } } } //hidden POST form with variables include_once 'include/forms.php'; $finish_form =& getFinishForm($newuser, $vpass); $finish_form->display(); } else { echo "<div class='errorMsg'>$stop</div><br clear='both'>"; include_once 'include/forms.php'; $reg_form =& getRegisterForm($newuser); $reg_form->display(); } break; case 'finish': if (!$GLOBALS['xoopsSecurity']->check()) { echo implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()); break; } [color=CC0000]if(@include_once XOOPS_ROOT_PATH."/Frameworks/captcha/captcha.php") { $xoopsCaptcha = XoopsCaptcha::instance(); if(! $xoopsCaptcha->verify() ) { $stop .= $xoopsCaptcha->getMessage()."<br />"; } }[/color] $stop = ''; if ($xoopsModuleConfig['display_disclaimer'] != 0 && $xoopsModuleConfig['disclaimer'] != '') { if (empty($agree_disc)) { $stop .= _PROFILE_MA_UNEEDAGREE.'<br />'; } } $stop = userCheck($newuser); if ( empty($stop) ) { $newuser->setVar('pass', $_POST['pass']); $newuser->setVar('user_avatar','blank.gif'); $actkey = substr(md5(uniqid(mt_rand(), 1)), 0, 8); $newuser->setVar('actkey', $actkey); $newuser->setVar('user_regdate', time()); if ($xoopsModuleConfig['activation_type'] == 1) { $newuser->setVar('level', 1); } $profile_handler =& xoops_gethandler('profile'); // Get fields $fields =& $profile_handler->loadFields(); if (count($fields) > 0) { foreach (array_keys($fields) as $i) { $fieldname = $fields[$i]->getVar('field_name'); if ($fields[$i]->getVar('field_register') && isset($_POST[$fieldname])) { $newuser->setVar($fieldname, $_POST[$fieldname]); } } } if (!$member_handler->insertUser($newuser)) { echo _PROFILE_MA_REGISTERNG; echo implode('<br />', $newuser->getErrors()); break; } $newid = $newuser->getVar('uid'); if (!$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newid)) { echo _PROFILE_MA_REGISTERNG; break; } //Welcome PM Hack start //Yeah,already defined above^^ // $newid = $newuser->getVar('uid'); $pm_handler =& xoops_gethandler('privmessage'); $pm =& $pm_handler->create(); $pm->setVar("subject", "Welcome to Swift"); $pm->setVar("msg_text", "Thanks for taking the time to register on the site. You can now reply to/comment articles and use the forum. If you are based in/around Essex please [url=http://swift-freedom.com/x/essex/modules/articles/article.php?id=19]add yourself to the location directory[/url]. If you have any problems with the site please email swift@swift-freedom.com"); //Newuser's id $pm->setVar("to_userid", $newid); // Admin's id,1 in my case $pm->setVar("from_userid", 1); if (!$pm_handler->insert($pm)) { // echo "Failed to send Welcome Private Message!!"; // No need to echo this failure-message here,I think so!!...Just optional^^ } //Welcome PM Hack end if ($xoopsModuleConfig['activation_type'] == 1) { redirect_header(XOOPS_URL.'/index.php', 4, _PROFILE_MA_ACTLOGIN); } if ($xoopsModuleConfig['activation_type'] == 0) { $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setTemplate('register.tpl'); $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH."/modules/profile/language/".$xoopsConfig['language']."/mail_template"); $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(_PROFILE_MA_USERKEYFOR, $newuser->getVar('uname'))); if ( !$xoopsMailer->send() ) { echo _PROFILE_MA_YOURREGMAILNG; } else { echo _PROFILE_MA_YOURREGISTERED; } } elseif ($xoopsModuleConfig['activation_type'] == 2) { $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setTemplate('adminactivate.tpl'); $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH."/modules/profile/language/".$xoopsConfig['language']."/mail_template"); $xoopsMailer->assign('USERNAME', $newuser->getVar('uname')); $xoopsMailer->assign('USEREMAIL', $newuser->getVar('email')); $xoopsMailer->assign('USERACTLINK', XOOPS_URL.'/modules/profile/activate.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($xoopsModuleConfig['activation_group'])); $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); $xoopsMailer->setFromName($xoopsConfig['sitename']); $xoopsMailer->setSubject(sprintf(_PROFILE_MA_USERKEYFOR, $newuser->getVar('uname'))); if ( !$xoopsMailer->send() ) { echo _PROFILE_MA_YOURREGMAILNG; } else { echo _PROFILE_MA_YOURREGISTERED2; } } if ($xoopsModuleConfig['new_user_notify'] == 1 && !empty($xoopsModuleConfig['new_user_notify_group'])) { $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $member_handler =& xoops_gethandler('member'); $xoopsMailer->setToGroups($member_handler->getGroup($xoopsModuleConfig['new_user_notify_group'])); $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); $xoopsMailer->setFromName($xoopsConfig['sitename']); $xoopsMailer->setSubject(sprintf(_PROFILE_MA_NEWUSERREGAT,$xoopsConfig['sitename'])); $xoopsMailer->setBody(sprintf(_PROFILE_MA_HASJUSTREG, $newuser->getVar('uname'))); $xoopsMailer->send(); } } else { echo "<div class='errorMsg'>$stop</div><br clear='both'>"; include_once 'include/forms.php'; $reg_form =& getRegisterForm($newuser); $reg_form->display(); } break; case 'register': default: include_once 'include/forms.php'; $reg_form =& getRegisterForm($newuser); $reg_form->display(); break; } include XOOPS_ROOT_PATH.'/footer.php'; ?>
p.s why am i not notified of new user registeration if it is set to automatic activation.