Guest Odesláno: 5. Leden, 2011 Share Odesláno: 5. Leden, 2011 Dělám propojenou registraci na svůj web s phpbb, s tím, že se registruje z webu na fórum. Zkopíroval jsem si pár funkcí pro správné kódování hesla atd... function _hash_encode64($input, $count, &$itoa64) { $output = ''; $i = 0; do { $value = ord($input[$i++]); $output .= $itoa64[$value & 0x3f]; if ($i < $count) { $value |= ord($input[$i]) << 8; } $output .= $itoa64[($value >> 6) & 0x3f]; if ($i++ >= $count) { break; } if ($i < $count) { $value |= ord($input[$i]) << 16; } $output .= $itoa64[($value >> 12) & 0x3f]; if ($i++ >= $count) { break; } $output .= $itoa64[($value >> 18) & 0x3f]; } while ($i < $count); return $output; } function _hash_gensalt_private($input, &$itoa64, $iteration_count_log2 = 6) { if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31) { $iteration_count_log2 = 8; } $output = '$H$'; $output .= $itoa64[min($iteration_count_log2 + ((PHP_VERSION >= 5) ? 5 : 3), 30)]; $output .= _hash_encode64($input, 6, $itoa64); return $output; } function _hash_crypt_private($password, $setting, &$itoa64) { $output = '*'; // Check for correct hash if (substr($setting, 0, 3) != '$H$') { return $output; } $count_log2 = strpos($itoa64, $setting[3]); if ($count_log2 < 7 || $count_log2 > 30) { return $output; } $count = 1 << $count_log2; $salt = substr($setting, 4, 8); if (strlen($salt) != 8) { return $output; } /** * We're kind of forced to use MD5 here since it's the only * cryptographic primitive available in all versions of PHP * currently in use. To implement our own low-level crypto * in PHP would result in much worse performance and * consequently in lower iteration counts and hashes that are * quicker to crack (by non-PHP code). */ if (PHP_VERSION >= 5) { $hash = md5($salt . $password, true); do { $hash = md5($hash . $password, true); } while (--$count); } else { $hash = pack('H*', md5($salt . $password)); do { $hash = pack('H*', md5($hash . $password)); } while (--$count); } $output = substr($setting, 0, 12); $output .= _hash_encode64($hash, 16, $itoa64); return $output; } function unique_id($extra = 'c') { static $dss_seeded = false; global $config; $val = $config['rand_seed'] . microtime(); $val = md5($val); $config['rand_seed'] = md5($config['rand_seed'] . $val . $extra); $dss_seeded = true; return substr($val, 4, 16); } function phpbb_hash($password) { $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; $random_state = unique_id(); $random = ''; $count = 6; if (($fh = @fopen('/dev/urandom', 'rb'))) { $random = fread($fh, $count); fclose($fh); } if (strlen($random) < $count) { $random = ''; for ($i = 0; $i < $count; $i += 16) { $random_state = md5(unique_id() . $random_state); $random .= pack('H*', md5($random_state)); } $random = substr($random, 0, $count); } $hash = _hash_crypt_private($password, _hash_gensalt_private($random, $itoa64), $itoa64); if (strlen($hash) == 34) { return $hash; } return md5($password); } function phpbb_email_hash($email) { return sprintf('%u', crc32(strtolower($email))) . (string) strlen($email); } // řazení dotazu $group_id = 2; $ip = $REMOTE_ADDR; $regdate = time(); // $username $username_clean = strtolower($username); $bb_pass = phpbb_hash($heslo1); // $regdate // $email $email_hash = phpbb_email_hash($email); $timezone = 1.00; $user_style = 4; A pak mám: $query = "insert into z_phpbb_users (group_id, user_ip, user_regdate, username, username_clean, user_password, user_passchg, user_email, user_email_hash) values ('".$group_id."', '".$ip."', '".$regdate."', '".$username."', '".$username_clean."', '".$bb_pass."', '".$regdate."', '".$email."', '".$email_hash."')"; $result = mysql_query($query) or die("SQL dotaz nešlo provést"); // zjištění ID uživatele $query = "select * from z_phpbb_users where username_clean = '".$username_clean."'"; $result = mysql_query($query) or die("SQL dotaz nešlo provést"); while ($row=mysql_fetch_array($result)): $id = $row[user_id]; endwhile; $query = "insert into z_phpbb_user_group (group_id, user_id) values ('".$group_id."', '".$id."')"; $result = mysql_query($query) or die("SQL dotaz nešlo provést"); Problém je ten, že uživatele to zaregistruje, ale nezobrazí ho to mezi nejnovějšími uživateli na fóru, má možnost se přihlásit, ale nevidí žádné kategorie. Pracuji s tabulkama users user_group Možná se má ještě někam něco vložit, už nevím co a kam. Nevíte, proč to tak blbne? Link to comment Share on other sites More sharing options...
Pongo 0 Odesláno: 5. Leden, 2011 Share Odesláno: 5. Leden, 2011 No tak toto by som nerobil ak ti niekto hackne jeden web tak aj druhý. A dosť to zvykne blbnúť. Link to comment Share on other sites More sharing options...
Sayels 0 Odesláno: 26. Červen, 2011 Share Odesláno: 26. Červen, 2011 Spíš si stáhni mod, který ti předělá forum na podobné forum jako je na CMS phpBB Ke stažení na každé oficiální podpoře modu Jmenuje se to fusion board, nebo tak nějak. Link to comment Share on other sites More sharing options...
DooM 93 Odesláno: 26. Červen, 2011 Share Odesláno: 26. Červen, 2011 Spíš si stáhni mod, který ti předělá forum na podobné forum jako je na CMS phpBBKe stažení na každé oficiální podpoře modu Jmenuje se to fusion board, nebo tak nějak. 1.rada = precti si pravidla Link to comment Share on other sites More sharing options...
Recommended Posts