prepare("SELECT id, type FROM login WHERE username = ? AND password = ?"); $hashed_password = md5($password); $stmt->bind_param("ss", $username, $hashed_password); $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { $stmt->bind_result($id, $type); $stmt->fetch(); // Session generate karna $rand = rand(111111, 999999); $_SESSION['admin']['id'] = $id; $_SESSION['admin']['session_id'] = $rand; $_SESSION['admin']['login'] = true; $_SESSION['admin']['type'] = $type; $con->query("INSERT INTO `check_session` (`id`, `timestamp`, `user_id`, `session_id`) VALUES (NULL, CURRENT_TIMESTAMP, '$id', '$rand')"); session_regenerate_id(true); // Successful hone par direct admin page par bhejna header("Location: ../admin/"); exit(); } else { $error_msg = '
Login to Continue