mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 09:36:15 +00:00
Fix #122
This commit is contained in:
parent
51ee75323b
commit
c7e73b45e1
2 changed files with 56 additions and 0 deletions
14
code/web/private_php/setup/sql/nel_ams_lib_00006.sql
Normal file
14
code/web/private_php/setup/sql/nel_ams_lib_00006.sql
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS `settings` (
|
||||||
|
`idSettings` int(11) NOT NULL,
|
||||||
|
`Setting` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
|
||||||
|
`Value` varchar(32) COLLATE utf8_unicode_ci NOT NULL
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||||
|
|
||||||
|
INSERT INTO `settings` (`idSettings`, `Setting`, `Value`) VALUES
|
||||||
|
(1, 'userRegistration', '0');
|
||||||
|
|
||||||
|
ALTER TABLE `settings`
|
||||||
|
ADD PRIMARY KEY (`idSettings`), ADD UNIQUE KEY `idSettings` (`idSettings`), ADD KEY `idSettings_2` (`idSettings`);
|
||||||
|
|
||||||
|
ALTER TABLE `settings`
|
||||||
|
MODIFY `idSettings` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
|
42
code/web/public_php/ams/func/userRegistration.php
Normal file
42
code/web/public_php/ams/func/userRegistration.php
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This function is beign used to change the users emailaddress info.
|
||||||
|
* It will first check if the user who executed this function is the person of whom the emailaddress is or if it's a mod/admin. If this is not the case the page will be redirected to an error page.
|
||||||
|
* The emailaddress will be validated first. If the checking was successful the email will be updated and the settings template will be reloaded. Errors made by invalid data will be shown
|
||||||
|
* also after reloading the template.
|
||||||
|
* @author Daan Janssens, mentored by Matthew Lagoe
|
||||||
|
*/
|
||||||
|
function userRegistration()
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
//if logged in
|
||||||
|
if (WebUsers::isLoggedIn()) {
|
||||||
|
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$dbl->update("settings", Array('Value' => $_POST['userRegistration']), "`Setting` = 'userRegistration'");
|
||||||
|
|
||||||
|
$result['target_id'] = $_GET['id'];
|
||||||
|
global $SITEBASE;
|
||||||
|
require_once($SITEBASE . '/inc/settings.php');
|
||||||
|
$pageElements = settings();
|
||||||
|
$pageElements = array_merge(settings(), $result);
|
||||||
|
$pageElements['permission'] = unserialize($_SESSION['ticket_user'])->getPermission();
|
||||||
|
// pass error and reload template accordingly
|
||||||
|
helpers :: loadtemplate( 'settings', $pageElements);
|
||||||
|
throw new SystemExit();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//ERROR: user is not logged in
|
||||||
|
header("Location: index.php");
|
||||||
|
throw new SystemExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (PDOException $e) {
|
||||||
|
//go to error page or something, because can't access website db
|
||||||
|
print_r($e);
|
||||||
|
throw new SystemExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue