$stmt_insert = $conn->prepare(' INSERT INTO users( uuid, pass, status, email, nick, role, logo, dt_last_login, dt_create ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, NOW()); '); $stmt_insert->execute(array($uuid, $password_hash, 'activated', $email, $nick, 'user', 'files/users/0.png', '0000-00-00 00:00:00')); if (!APISecurity::login($conn, $email, $password_hash)) { APIEvents::addPublicEvents($conn, 'errors', 'Alert! Admin, registration is broken!'); APIHelpers::showerror(1287, '[Registration] Sorry registration is broken. Please send report to the admin about this.'); } else { APISecurity::insertLastIp($conn, APIHelpers::getParam('client', 'none')); APIUser::loadUserProfile($conn); APISecurity::logout(); } $email_subject = "Registration on FreeHackQuest."; $email_message = ' Registration: If you was not tried registering on ' . $httpname . ' just remove this email. Welcome to FreeHackQuest!
include_once $curdir . "/../api.lib/api.helpers.php"; include_once $curdir . "/../api.lib/api.security.php"; include_once $curdir . "/../api.lib/api.user.php"; include_once $curdir . "/../../config/config.php"; $result = array('result' => 'fail', 'data' => array()); $token = ''; if (!APIHelpers::issetParam('email')) { APIHelpers::showerror(1001, 'Parameter email was not found'); } if (!APIHelpers::issetParam('password')) { APIHelpers::showerror(1316, 'Parameter password was not found'); } $email = APIHelpers::getParam('email', ''); $password = APIHelpers::getParam('password', ''); $conn = APIHelpers::createConnection($config); $hash_password2 = APISecurity::generatePassword2($email, $password); if (APISecurity::login($conn, $email, $hash_password2)) { $result['result'] = 'ok'; APIHelpers::$TOKEN = APIHelpers::gen_guid(); $result['data']['token'] = APIHelpers::$TOKEN; $result['data']['session'] = APIHelpers::$FHQSESSION; } else { APIHelpers::showerror(1002, 'email or/and password was not found in system '); } if ($result['result'] == 'ok') { APISecurity::insertLastIp($conn, APIHelpers::getParam('client', 'none')); APIUser::loadUserProfile($conn); // APIUser::loadUserScore($conn); APISecurity::saveByToken(); } echo json_encode($result);