Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function signup(){
- global $request;
- $submit = $request->variable('submit', 'nope');
- if ($submit != 'nope') {
- $username = $request->variable('username', '');
- $password = $request->variable('password', '');
- $email = $request->variable('email', '');
- $ip = $request->variable('REMOTE_ADDR', ''); // means we get user's IP address
- /*
- in case you want to get the real timezone the php way
- $json = file_get_contents( 'http://smart-ip.net/geoip-json/' . $ip); // this one service we gonna use to obtain timezone by IP
- // maybe it's good to add some checks (if/else you've got an answer and if json could be decoded, etc.)
- $ipData = json_decode( $json, true);
- if ($ipData['timezone']) {
- $tz = new DateTimeZone( $ipData['timezone']);
- $now = new DateTime( 'now', $tz); // DateTime object corellated to user's timezone
- } else {
- // we can't determine a timezone - do something else...
- */
- $user_row = array(
- 'username' => $username,
- 'user_password' => phpbb_hash($password),
- 'user_email' => $email,
- 'group_id' => 2, // by default, the REGISTERED user group is id 2
- 'user_timezone' => (float) "UTC", // no idea if this works
- 'user_lang' => "eng",
- 'user_type' => USER_NORMAL, // why no "" ???
- 'user_ip' => $ip,
- 'user_regdate' => time(),
- );
- // Register user...
- $user_id = user_add($user_row);
- echo "<h1>Registered you now can log in</h1>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement