1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jappix_ynh.git synced 2024-09-03 19:26:19 +02:00
jappix_ynh/source/server/post-users.php

52 lines
1,006 B
PHP
Raw Normal View History

2014-03-12 14:52:47 +01:00
<?php
/*
Jappix - An open social platform
This is the user add POST handler (install & manager)
-------------------------------------------------
License: AGPL
Author: Valérian Saliou
*/
// Someone is trying to hack us?
if(!defined('JAPPIX_BASE')) {
exit;
}
// Marker
$valid_user = true;
// Administrator name
if(isset($_POST['user_name']) && !empty($_POST['user_name'])) {
$user_name = trim($_POST['user_name']);
} else {
$valid_user = false;
}
// Administrator password (first)
if(isset($_POST['user_password']) && !empty($_POST['user_password'])) {
$user_password = trim($_POST['user_password']);
} else {
$valid_user = false;
}
// Administrator password (second)
if(isset($_POST['user_repassword']) && ($user_password != $_POST['user_repassword'])) {
$valid_user = false;
}
// Generate the users XML content
if($valid_user) {
// Add our user
manageUsers('add', array($user_name => $user_password));
// Reset the user name
$user_name = '';
}
?>