<?php /* ADMIN $Id: do_user_aed.php,v 1.13 2005/03/11 00:46:46 gregorerhardt Exp $ */ include $AppUI->getModuleClass('contacts'); $del = isset($_REQUEST['del']) ? $_REQUEST['del'] : FALSE; $obj = new CUser(); $contact = new CContact(); if (!$obj->bind($_POST)) { $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); $AppUI->redirect(); } if (!$contact->bind($_POST)) { $AppUI->setMsg($contact->getError(), UI_MSG_ERROR); $AppUI->redirect(); } // prepare (and translate) the module name ready for the suffix $AppUI->setMsg('User'); // !User's contact information not deleted - left for history. if ($del) { if ($msg = $obj->delete()) { $AppUI->setMsg($msg, UI_MSG_ERROR); $AppUI->redirect(); } else { $AppUI->setMsg("deleted", UI_MSG_ALERT, true); $AppUI->redirect('', -1); } return; } $isNewUser = !$_REQUEST['user_id']; if ($isNewUser) { // check if a user with the param Username already exists
<?php /* $Id: do_user_aed.php 1866 2011-05-01 06:20:10Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/admin/do_user_aed.php $ */ if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } $del = (int) w2PgetParam($_POST, 'del', 0); $obj = new CUser(); if (!$obj->bind($_POST)) { $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); $AppUI->redirect(); } $contact = new CContact(); if (!$contact->bind($_POST)) { $AppUI->setMsg($contact->getError(), UI_MSG_ERROR); $AppUI->redirect(); } $action = $del ? 'deleted' : 'stored'; $contact_id = (int) w2PgetParam($_POST, 'contact_id', 0); $user_id = (int) w2PgetParam($_POST, 'user_id', 0); $isNewUser = !$user_id; $perms =& $AppUI->acl(); if ($del) { } elseif ($isNewUser) { if (!canAdd('admin')) { $AppUI->redirect('m=public&a=access_denied'); } if (!canAdd('users')) { $AppUI->redirect('m=public&a=access_denied'); } } else {
/** * This is a Hera pagecontroller. * */ // Include the essential config-file which also creates the $anax variable with its defaults. include __DIR__ . '/config.php'; $hera['javascript_include'][] = 'js/register.js'; $hera['stylesheets'][] = 'css/forms.css'; $db = new CDatabase($hera['database']); $user = new CUser($db); // Check if user and password is okey if (isset($_POST['send'])) { if ($user->Register($_POST['acronym'], $_POST['name'], $_POST['password'], $_POST['confirm_password'])) { header('Location: register.php?succes'); } else { header('Location: register.php?fail&error=' . $user->getError()); } } $output = null; if (isset($_GET['succes'])) { $output = "<br><output class='success'>Din profil har skapats! <a href='login.php'>Logga in?</a></output><br><br>"; } if (isset($_GET['fail'])) { $output = "<br><output class='error'>Skapandet av profil misslyckades{$_GET['error']}</output><br><br>"; } // Do it and store it all in variables in the Hera container. $hera['title'] = "Bli medlem"; $hera['main'] = <<<EOD <h1>Bli medlem</h1> <form method=post> <fieldset>
$contactListByUsername = CContact::getContactByUsername($username); if ($contactListByUsername != 'User Not Found') { error_reporting(0); echo "<script language='javascript'>\n alert('The username you selected already exists, please select another or if that user name is yours request the password recovery through the dedicated link.');\n history.go(-2);\n </script>"; die; } $email = w2PgetParam($_POST, 'contact_email', 0); $contactListByEmail = CContact::getContactByEmail($email); if ($contactListByEmail != 'User Not Found') { error_reporting(0); echo "<script language='javascript'>\n alert('The email you selected already exists, please select another or if that email is yours request the password recovery through the dedicated link.');\n history.go(-2);\n </script>"; die; } $user = new CUser(); if (!$user->bind($_POST)) { $AppUI->setMsg($user->getError(), UI_MSG_ERROR); $AppUI->redirect(); } $contact = new CContact(); if (!$contact->bind($_POST)) { $AppUI->setMsg($contact->getError(), UI_MSG_ERROR); $AppUI->redirect(); } // prepare (and translate) the module name ready for the suffix $AppUI->setMsg('User'); $isNewUser = !w2PgetParam($_REQUEST, 'user_id', 0); if ($isNewUser) { // check if a user with the param Username already exists if (is_array($contactListByUsername)) { $AppUI->setMsg('This username is not available, please try another.', UI_MSG_ERROR, true); $AppUI->redirect();