sourcebans-pp
sourcebans-pp copied to clipboard
fix(blockit): Prevent php warnings
Description
- Uncommented and fixed the database query to get server data and prevent php warnings for $data
- Added null coalescing operator for hostname array access
Motivation and Context
PHP Warning: Undefined variable $sdata in /var/www/vhosts/nide.gg/bans.nide.gg/pages/admin.blockit.php on line 91;
PHP message: PHP Warning: Trying to access array offset on null in /var/www/vhosts/nide.gg/bans.nide.gg/pages/admin.blockit.php on line 91;
But I wonder why @Hackmastr commented this part of the code in smart v5 changes.
How Has This Been Tested?
Applied fix and run the page with an url like bans.nide.gg/pages/admin.blockit.php?check=steam_0:1:802859631&type=1&length=60 and do not throw warnings anymore.
Screenshots (if appropriate):
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the CONTRIBUTING document.