[ Solved ] is_user_in_file
That : :crab:
Code:
I think it can help a lots of people other than me. Thank you in advance all ! The function with no comment : Code:
|
Re: [REQ] is_user_in_file
Code:
while( !feof(fh) && !found )Code:
found = ( equal( auth , line , strlen( auth ) ) ) |
Quote:
@OP Code:
It is the auth string for the user. Could be a name, SteamID, or IP. Code:
64 is for a path size. 46 is the maximum length an auth key can have in the users.ini (see admin.sma) ConfigsDir is named that way because... it is the location of the configs directory (addons/amxmodx/configs) Code:
It gets the location of addons/amxmodx/configs and stores it in a string. It is used to avoid hard-coding the string to be that path. Code:
It locates the file in the configs directory and completes the whole path to the file: addons/amxmodx/configs/vip.ini Code:
fh would mean file handle. Code:
r = read w = write This function looks inside a file for a string, so obviously you'll be reading, not writing. Code:
It checks if the file handle is valid and that the file is opened. Code:
Code:
It only stops looping (break) if the string was found in the file. Code:
Because it returns whether or not it found it in the file. |
Re: [REQ] is_user_in_file
Quote:
Code:
amxx_configsdir addons/amxmodx/configsMay be you could use : PHP Code:
|
Re: [REQ] is_user_in_file
I use this:
Code:
|
Re: [REQ] is_user_in_file
Oh Thanks a lots Exolent it's very helpfull for me and i think a lots of peoples :D
I would like just to review a few points like that : I just want to start with this : Code:
Here : Code:
And to conclude here : Code:
Thank you in advance. @Connor: What is the difference with your stock ? Thanks |
Re: [REQ] is_user_in_file
Quote:
The real length for "addons/amxmodx/configs/vip.ini" is 30 characters, so the size can be 31. However, since the configs directory is customizable, developers like myself use 64 for path sizes since that is a comfortable maximum for path lengths. Quote:
This line continues looping until the end of the file has been reached. "While we have not reached the end of the file..." Quote:
|
Re: [REQ] is_user_in_file
Quote:
Code:
Thank you for your help. It is unusual to meet people like you ! :bacon!: |
Re: [REQ] is_user_in_file
It's obvious. The function checks if the user's authorization is in the file.
Well, the only way to do that is to check every line to see if it has that user's authorization. |
Re: [REQ] is_user_in_file
Oh ! Now it's good I understood everything of this code ! I could rewrite it with eyes closed :crab:
Thanks a lot ! Solved. |
| All times are GMT -4. The time now is 06:10. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.