Source of trunk/cp_adduser.php at revision HEAD (06/09/2008 1:06:56, 2085 bytes, 71 lines, language: php) [download]:
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | ** Control Panel :: Add User |
| 5 | ** for CodewiseBlog Multi-User |
| 6 | ** |
| 7 | |
| 8 | ** Copyright (c) 2005-2008 Codewise.org |
| 9 | */ |
| 10 | |
| 11 | /* |
| 12 | ** This file is part of CodewiseBlog |
| 13 | ** |
| 14 | ** CodewiseBlog is free software; you can redistribute it and/or modify |
| 15 | ** it under the terms of the GNU General Public License as published by |
| 16 | ** the Free Software Foundation; either version 2 of the License, or |
| 17 | ** (at your option) any later version. |
| 18 | ** |
| 19 | ** CodewiseBlog is distributed in the hope that it will be useful, |
| 20 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | ** GNU General Public License for more details. |
| 23 | ** |
| 24 | ** You should have received a copy of the GNU General Public License |
| 25 | ** along with CodewiseBlog; if not, write to the Free Software |
| 26 | ** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 27 | */ |
| 28 | |
| 29 | $current = "adduser"; |
| 30 | |
| 31 | $blogid = $db->fetch_var($db->issue_query("SELECT blogid FROM blogs ORDER BY blogid DESC LIMIT 1")); |
| 32 | $blogid++; |
| 33 | |
| 34 | if(BLOGID != 1) |
| 35 | { |
| 36 | $body = skinvoodoo("error","error",array("message"=>"You do not have permission to access this area of the control panel.")); |
| 37 | } elseif(empty($_POST)) { |
| 38 | |
| 39 | $body = skinvoodoo( |
| 40 | "controlpanel_adduser", "", |
| 41 | array( |
| 42 | "posturl" => INDEX_URL . "?controlpanel:adduser", |
| 43 | "blogid" => $blogid, |
| 44 | ) |
| 45 | ); |
| 46 | |
| 47 | } else { |
| 48 | |
| 49 | $db->insert("blogs", array( |
| 50 | "blogid" => $blogid, |
| 51 | "name" => $_POST['name'], |
| 52 | "email" => $_POST['email'], |
| 53 | "title" => $_POST['title'], |
| 54 | "password" => md5($_POST['password']), |
| 55 | "joindate" => time(), |
| 56 | "skinid" => DEFAULT_SKINID, |
| 57 | )); |
| 58 | |
| 59 | $db->insert("skin", array("blogid" => $blogid)); |
| 60 | |
| 61 | if(SUBDOMAIN_MODE) |
| 62 | $newuser = "http://" . $_POST['name'] . "." . BASE_DOMAIN . INSTALLED_PATH; |
| 63 | else |
| 64 | $newuser = "http://" . DEFAULT_SUBDOMAIN . BASE_DOMAIN . INSTALLED_PATH . $_POST['name']; |
| 65 | |
| 66 | $body = "User created. Their page is located <a href=\"" . $newuser . "\">here</a>"; |
| 67 | |
| 68 | } |
| 69 | |
| 70 | ?> |
| 71 |