I have been running a Web App for quite some time. The app works even after multiple PHP errors but the error log files are constantly taking 1 GB of my space after every few weeks forcing me to manually delete them. The error resides in a faucet.php file
I am not familiar with Php, I have done everything I can to tackle this error and even check the similar questions but none of it prove to be a fixture of my problem.
These are four error messages and keeps repeating throughout the day.
Undefined variable
PHP Notice: Undefined variable: refer_file in /home/countnet/public_html/faucet/network/mine/doge/faucet.php on **line 318**
PHP Notice: Undefined variable: refer_file in /home/countnet/public_html/faucet/network/mine/doge/faucet.php on **line 393**
And Undefined index
PHP Notice: Undefined index: status in /home/countnet/public_html/faucet/network/mine/doge/faucet.php on **line 604**
PHP Notice: Undefined index: status in /home/countnet/public_html/faucet/network/mine/doge/faucet.php on **line 608**
**Line 318** if (!$refer_file) {
**Line 393** if (!$refer_file) { // the user was referred and the referral isn't saved
**Line 604** echo '\'status\': \'' . htmlspecialchars($result['status'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED|ENT_HTML5) . '\',';
**Line 608**
echo '<dl><dt>Status</dt><dd>' . htmlspecialchars($result['status'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED|ENT_HTML5) . '</dd><dt>Message</dt><dd>' . htmlspecialchars($result['message'], ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED|ENT_HTML5) . '</dd></dl>';
Any help would be appreciated, the app works fine even with these errors but they are now becoming a nightmare as traffic grows.
you need to use isset() or empty() to check if the variable or array index are defined or not.
Line 318 and 393 can be changed to
if (!empty($refer_file)) {
for line 604 and 608 add something like the following before line 604:
$result['status'] = isset($result['status']) ? $result['status'] : 'default_status';
$result['message'] = isset($result['message']) ? $result['message'] : 'default_message';
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments