Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once ("../../phpBB3/includes/functions.php");
- if (!isset($_SESSION['inicjuj']))
- {
- session_regenerate_id();
- $_SESSION['inicjuj'] = true;
- $_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
- }
- if($_SESSION['ip'] != $_SERVER['REMOTE_ADDR'])
- {
- die('Proba przejecia sesji udaremniona!');
- }
- if(isset($_POST['username'])) {
- $username = $_POST['username'];
- $userpassword = $_POST['password'];
- $query = "SELECT user_id, username_clean, user_password FROM phpbb_users WHERE group_id='5' && username_clean='" .$username. "'";
- if(!$result = $mysqli->query($query)) {
- die ($mysqli->error);
- } else {
- if($row_cnt = $result->num_rows == 0) {
- echo ("Brak uzytkownika!");
- } else {
- $row = $result->fetch_assoc();
- if(phpbb_hash($userpassword) == $row['user_password']) {
- $_SESSION['id'] = $row['user_id'];
- }
- }
- }
- }
- if(!isset($_SESSION['id'])) {
- echo '<form method="post" action="index.php">
- Zaloguj sie: <input type="text" name="username"/>
- <input type="password" name="password"/>
- <input type="submit" value="OK"/></form>';
- exit;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement