| 1 |
<?PHP |
|---|
| 2 |
/* |
|---|
| 3 |
* Copyright (c) 2006 Gregor Richards |
|---|
| 4 |
* |
|---|
| 5 |
* Permission is hereby granted, free of charge, to any person obtaining a |
|---|
| 6 |
* copy of this software and associated documentation files (the "Software"), |
|---|
| 7 |
* to deal in the Software without restriction, including without limitation |
|---|
| 8 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|---|
| 9 |
* and/or sell copies of the Software, and to permit persons to whom the |
|---|
| 10 |
* Software is furnished to do so, subject to the following conditions: |
|---|
| 11 |
* |
|---|
| 12 |
* The above copyright notice and this permission notice shall be included in |
|---|
| 13 |
* all copies or substantial portions of the Software. |
|---|
| 14 |
* |
|---|
| 15 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|---|
| 16 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|---|
| 17 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|---|
| 18 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|---|
| 19 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|---|
| 20 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|---|
| 21 |
* DEALINGS IN THE SOFTWARE. |
|---|
| 22 |
*/ |
|---|
| 23 |
|
|---|
| 24 |
require("chkpw.php"); |
|---|
| 25 |
|
|---|
| 26 |
if (!isset($_POST['un']) || |
|---|
| 27 |
!isset($_POST['pw']) || |
|---|
| 28 |
!isset($_POST['pw2'])) die("Username, password or second password not supplied!"); |
|---|
| 29 |
|
|---|
| 30 |
// check that the username is valid |
|---|
| 31 |
if (preg_match("/[^A-Za-z0-9-'_\[\]]/", $_POST['un'])) die("Invalid username."); |
|---|
| 32 |
|
|---|
| 33 |
// check that the passwords match |
|---|
| 34 |
if ($_POST['pw'] != $_POST['pw2']) die("Passwords don't match."); |
|---|
| 35 |
|
|---|
| 36 |
// check that the user does not already exist |
|---|
| 37 |
if (isset($pws[$_POST['un']])) die("Username already exists."); |
|---|
| 38 |
|
|---|
| 39 |
// add it |
|---|
| 40 |
if (!adduser($_POST['un'], $_POST['pw'])) die("Failed to register user."); |
|---|
| 41 |
?> |
|---|
| 42 |
<HTML><head><title>DSSS Source Management Interface - Registration</title></head><body> |
|---|
| 43 |
You are now registered. Go back in your browser and log in to start using DSSS SMI. |
|---|
| 44 |
</body></HTML> |
|---|