/usr/share/ampache/www/register.php is in ampache-common 3.6-rzb2779+dfsg-0ubuntu9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | <?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2013 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* 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.
*
*/
define('NO_SESSION','1');
require_once 'lib/init.php';
/* Check Perms */
if (!Config::get('allow_public_registration') || Config::get('demo_mode')) {
debug_event('DENIED','Error Attempted registration','1');
UI::access_denied();
exit();
}
/* Don't even include it if we aren't going to use it */
if (Config::get('captcha_public_reg')) {
define ("CAPTCHA_INVERSE", 1);
require_once Config::get('prefix') . '/modules/captcha/captcha.php';
}
/* Start switch based on action passed */
switch ($_REQUEST['action']) {
case 'validate':
$username = scrub_in($_GET['username']);
$validation = scrub_in($_GET['auth']);
require_once Config::get('prefix') . '/templates/show_user_activate.inc.php';
break;
case 'add_user':
/**
* User information has been entered
* we need to check the database for possible existing username first
* if username exists, error and say "Please choose a different name."
* if username does not exist, insert user information into database
* then allow the user to 'click here to login'
* possibly by logging them in right then and there with their current info
* and 'click here to login' would just be a link back to index.php
*/
$fullname = scrub_in($_POST['fullname']);
$username = scrub_in($_POST['username']);
$email = scrub_in($_POST['email']);
$pass1 = scrub_in($_POST['password_1']);
$pass2 = scrub_in($_POST['password_2']);
/* If we're using the captcha stuff */
if (Config::get('captcha_public_reg')) {
$captcha = captcha::solved();
if(!isset ($captcha)) {
Error::add('captcha', T_('Error Captcha Required'));
}
if (isset ($captcha)) {
if ($captcha) {
$msg="SUCCESS";
}
else {
Error::add('captcha', T_('Error Captcha Failed'));
}
} // end if we've got captcha
} // end if it's enabled
if (Config::get('user_agreement')) {
if (!$_POST['accept_agreement']) {
Error::add('user_agreement', T_("You <U>must</U> accept the user agreement"));
}
} // if they have to agree to something
if (!$_POST['username']) {
Error::add('username', T_("You did not enter a username"));
}
if(!$fullname) {
Error::add('fullname', T_("Please fill in your full name (Firstname Lastname)"));
}
// Check the mail for correct address formation.
if (!Mailer::validate_address($email)) {
Error::add('email', T_('Invalid email address')
}
if (!$pass1) {
Error::add('password', T_("You must enter a password"));
}
if ( $pass1 != $pass2 ) {
Error::add('password', T_("Your passwords do not match"));
}
if (!User::check_username($username)) {
Error::add('duplicate_user', T_("Error Username already exists"));
}
// If we've hit an error anywhere up there break!
if (Error::occurred()) {
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
break;
}
/* Attempt to create the new user */
$access = '5';
switch (Config::get('auto_user')) {
case 'admin':
$access = '100';
break;
case 'user':
$access = '25';
break;
default:
case 'guest':
$access = '5';
break;
} // auto-user level
$new_user = User::create($username, $fullname, $email, $pass1,
$access, Config::get('admin_enable_required'));
if (!$new_user) {
Error::add('duplicate_user', T_("Error: Insert Failed"));
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
break;
}
$client = new User($new_user);
$validation = md5(uniqid(rand(), true));
$client->update_validation($validation);
Registration::send_confirmation($username, $fullname, $email, $pass1, $validation);
require_once Config::get('prefix') . '/templates/show_registration_confirmation.inc.php';
break;
case 'show_add_user':
default:
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
break;
} // end switch on action
?>
|