Warning: Invalid argument supplied for foreach()

Started by usermiracle, April 18, 2015, 04:34:50 PM

usermiracle

Hi, great script, for this reason - please please please - fix the errors on the flatfile.inc.php / when visiting this file directly it displays the delete button for deleting registered users and a number of  Warning: Invalid argument supplied for foreach(). I think this is easy for you to fix. Unfortunately I am not so clever :) However I believe the solution is here: https://www.euperia.com/development/fix-php-warning-invalid-argument-supplied-foreach/1230

Will you fix this it seems quite important - if you google that file and error you find a number of websites with the script, this seems to be a security issue too.

Thank you!!!

I realized I did not give enough info to help. These are the actual errors:

Warning: file() [function.file]: Filename cannot be empty in /flatfile.inc.php on line 49

Warning: Invalid argument supplied for foreach() in /flatfile.inc.php on line 51

Warning: file() [function.file]: Filename cannot be empty in /flatfile.inc.php on line 118

Warning: str_repeat() [function.str-repeat]: Second argument has to be greater than or equal to 0 in /flatfile.inc.php on line 124

zubrag

Hi. Please try following
Open flatfile.inc.php and add following code as second line into it  (the first line is  <?php    )

if(!defined('USE_USERNAME_ADMIN')){ die(); }


I didn't try it, but hopefully it will show just blank screen when opened directly. Does it help?

usermiracle

Hi, thanks for replying. Your solution appears to work. I have not checked if it affects any functionality but it has cleared up the errors. Thanks. I will let you know if there are any related issues, hopefully not. Thanks for fast response I did not expect it.

anythinghere

I am the original poster http://www.zubrag.com/forum/index.php/topic,12160.0.html but locked out of my 1st forum account... so opened another account. Since adding your suggested code I am unable to login to my site with your script. Thanks

Actually that is not the issue the issue is I can only login to the site as the admin - but not as "member" after sign up

anythinghere

actually they just can not login to password protected pages. The login.php appears to work but protected pages just says incorrect password for members... and I don't think it is the code you supplied for the flatfile.inc.php that causes this. The admin CAN login to password protected pages. So it is weird.

zubrag

Were these users able to login previously, or you are trying to setup users for the first time?

anythinghere

Forum will not accept my replies... in short I only tested the login php originally

zubrag

So you can login into manager.php and see list of users there with logins and passwords?  And you cannot login as one of these users by opening login.php?  How does it look after user login? Any errors, any messages?


anythinghere

yes manager.php works and users are stored, longer messages in this forum get stopped :(


zubrag


anythinghere

Hi, I saw the email asking for my script but it is your script I am using and without any customization. Perhaps it only works with a specific version of php?

zubrag

If it is without customization, then please send me url to check it (via email or private message). It should work with default usernames in this case.