You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using your mod for quite some time now and noticed that it stopped working in game recently (aka fails to download images)
I thought the image url I uploaded previously was expired or something so I tried to reupload a new one but then I get redirected to a blank screen with just a text that says "Password saved", which apparently is a problem that someone else has also encountered (#10 )
For some reason (I don't know which) I decided to take a look in Chrome's network inspector, then discovered that the form submission results in a 500 server internal error.
I then decided to take a look at the code myself to see what the matter could be and maybe try to fix it, here's some of the stuff I updated:
It seems like you're creating a "users" dir in order to save php scripts that each contain a user's hashed password and their submitted image url, which is a way to do it. However, you're creating this directory EVERY single time the main script is executed. I'm not an expert on linux' filesystem but I think mkdir gives you an error when you attempt to create a directory that already exists. Instead, you could create that directory ONLY if it doesn't exist already
mkdir('users', 0700, true);//make users dir (700 its owner only prems)
//check if a users dir doesnt exist already, so we can create oneif (!file_exists('users')){
mkdir('users', 0700, true); //make users dir (700 its owner only prems)
}
Here, it's not really an issue on it's own, just a matter of better readability and geting rid of some warnings (especially if some of the entries of the $_GET and $_POST arrays are undefined)
Here you're feeding strlen() a $str variable that is nowhere to be found in the code and therefore undefined, so you get warnings for it (I think it might even be errors actually)
In this foreach loop, you're looping through each file contained in the users dir to generate a userblock from the file name. Again, for the sake of readability, I created two variables that hold the user name and user id respectively.
I also noticed that you're checking if the current file is either "." or ".." which is a good thing, but you're simply replacing it with an empty string when that condition is true. You then pass said empty string to explode() which will return an empty array, so trying to access any element of it will cause issues. Instead of making $ff an empty string, you can simply skip this iteration and move on to the next one which should be an actual file name.
anyways good issue ya
real reason (i think) is more funny, its just free hosting limits. recently i lost good one
i grab ur suggestions but not sure if in game it will be works
ah yeah fair enough 💀, i mean i could help with the hosting part if you wanna. i'd just need to maybe rewrite the serverside a bit (with your permission obviously)
Hi hi!!
I've been using your mod for quite some time now and noticed that it stopped working in game recently (aka fails to download images)
I thought the image url I uploaded previously was expired or something so I tried to reupload a new one but then I get redirected to a blank screen with just a text that says "Password saved", which apparently is a problem that someone else has also encountered (#10 )
For some reason (I don't know which) I decided to take a look in Chrome's network inspector, then discovered that the form submission results in a 500 server internal error.
I then decided to take a look at the code myself to see what the matter could be and maybe try to fix it, here's some of the stuff I updated:
It seems like you're creating a "users" dir in order to save php scripts that each contain a user's hashed password and their submitted image url, which is a way to do it. However, you're creating this directory EVERY single time the main script is executed. I'm not an expert on linux' filesystem but I think
mkdir
gives you an error when you attempt to create a directory that already exists. Instead, you could create that directory ONLY if it doesn't exist alreadyProfileImage/server side/index.php
Line 4 in ece28ed
Here, it's not really an issue on it's own, just a matter of better readability and geting rid of some warnings (especially if some of the entries of the
$_GET
and$_POST
arrays are undefined)ProfileImage/server side/index.php
Lines 48 to 79 in ece28ed
Same thing here
ProfileImage/server side/index.php
Line 95 in ece28ed
Here you're feeding
strlen()
a$str
variable that is nowhere to be found in the code and therefore undefined, so you get warnings for it (I think it might even be errors actually)ProfileImage/server side/index.php
Line 114 in ece28ed
In this foreach loop, you're looping through each file contained in the users dir to generate a userblock from the file name. Again, for the sake of readability, I created two variables that hold the user name and user id respectively.
I also noticed that you're checking if the current file is either "." or ".." which is a good thing, but you're simply replacing it with an empty string when that condition is true. You then pass said empty string to
explode()
which will return an empty array, so trying to access any element of it will cause issues. Instead of making$ff
an empty string, you can simply skip this iteration and move on to the next one which should be an actual file name.ProfileImage/server side/index.php
Lines 162 to 180 in ece28ed
All these changes have been tested and seem to be working fine when ran locally and in a docker container.
There could be more refactoring done obviously, but for now I think these are the most important ones and could solve some issues.
You can contact me on Discord (same @ as here) if you have any questions or need help with anything! (sorry for the gigantic issue btw)
The text was updated successfully, but these errors were encountered: