示例#1
0
 public static function RegisterUser($regData)
 {
     global $db;
     $info = ['emptyData' => false, 'emailUse' => false, 'userUse' => false, 'falseEmail' => false, 'pwNotMatch' => false, 'success' => false];
     if (empty($regData['username']) || empty($regData['email']) || empty($regData['password'])) {
         $info['emptyData'] = true;
     } else {
         if ($regData['password'] != $regData['password2']) {
             $info['pwNotMatch'] = true;
         } else {
             if (!Main::ValidEmail($regData['email'])) {
                 $info['falseEmail'] = true;
             } else {
                 $regData['username'] = $db->SafeString($regData['username']);
                 $regData['email'] = $db->SafeString($regData['email']);
                 $regData['password'] = $db->SafeString($regData['password']);
                 $mailCheck = Registration::CheckEmail($regData['email']);
                 $userCheck = Registration::CheckUsername($regData['username']);
                 if (!$mailCheck && !$userCheck) {
                     $password = Main::HyperHash($regData['password']);
                     $q = "INSERT INTO `" . $db->prefix . "users` (`hbbid`, `name`, `password`, `email`, `member_group`, `register_date`, `salt`) VALUES\r\n\t\t\t\t\t('" . userHash($regData['username'], $regData['email']) . "', '" . $regData['username'] . "',\r\n\t\t\t\t\t'" . $password['password'] . "', '" . $regData['email'] . "', '3', '" . time() . "', '" . $password['salt'] . "')";
                     $db->Query($q);
                     $info['success'] = true;
                 } else {
                     if ($mailCheck) {
                         $info['emailUse'] = true;
                     } else {
                         $info['userUse'] = true;
                     }
                 }
             }
         }
     }
     return $info;
 }
示例#2
0
 public static function CreateAdminAccount($adminData)
 {
     global $db;
     if (empty($adminData['name']) || empty($adminData['email']) || empty($adminData['password']) || empty($adminData['password2'])) {
         return false;
     } else {
         if ($adminData['password'] == $adminData['password2']) {
             $password = Installation::HyperHash($adminData['password']);
             $q = "INSERT INTO `" . $db->prefix . "users` (`hbbid`, `name`, `password`, `email`, `member_group`, `register_date`, `salt`) VALUES\r\n\t\t\t('" . userHash($adminData['name'], $adminData['email']) . "', '" . $adminData['name'] . "',\r\n\t\t\t'" . $password['password'] . "', '" . $adminData['email'] . "', '1', '" . time() . "', '" . $password['salt'] . "')";
             $db->Query($q);
             return true;
         } else {
             return false;
         }
     }
 }
示例#3
0
    Alternatively, you can redistribute this file and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Wolframe 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 Wolframe.  If not, see <http://www.gnu.org/licenses/>.

 If you have questions regarding the use of this file, please contact
 Project Wolframe.

************************************************************************/
include 'authentication.php';
if ($argc == 2) {
    echo userHash($argv[1]), "\n";
} else {
    if ($argc == 3) {
        echo seededUserHash($argv[1], $argv[2]), "\n";
    } else {
        echo "Usage: {$argv['0']} <username>\n   or  {$argv['0']} <seed (base64)> <username>\n\n";
        exit(1);
    }
}
?>