insejn Posted March 16, 2009 Share Posted March 16, 2009 I've created a simple admin-area where username/password is stored in a database. Pictures and files and so on are stored in folders connected to the username. So if someone named Bengt logs in he will open a folder called "Bengt" and show everything inside of that folder.. The problem here is if he logs in with the username "bengt", with the "b" as a lower case.. then the admin area can't find the folder because it searches for a folder with a big "B (Bengt).. Is there a smart solution for this? Perhaps make it impossible to log in with a lower case word? or is there something with PHP that can ignore big and small letters? ..but how do I do that? :S /Bjorn Quote Link to comment https://forums.phpfreaks.com/topic/149661-solved-can-php-ignore-big-and-small-letters/ Share on other sites More sharing options...
Daniel0 Posted March 16, 2009 Share Posted March 16, 2009 GNU/Linux (e.g. ext3) file systems are case-sensitive, but Windows file systems (e.g. NTFS) are case-insensitive. Where do you get the username from? The database should have the same case as the folder on the disk. Quote Link to comment https://forums.phpfreaks.com/topic/149661-solved-can-php-ignore-big-and-small-letters/#findComment-785863 Share on other sites More sharing options...
Maq Posted March 16, 2009 Share Posted March 16, 2009 When you compare them just use strtolower(). Quote Link to comment https://forums.phpfreaks.com/topic/149661-solved-can-php-ignore-big-and-small-letters/#findComment-785866 Share on other sites More sharing options...
insejn Posted March 16, 2009 Author Share Posted March 16, 2009 Where do you get the username from? The database should have the same case as the folder on the disk. <p></p> I put the username that is in the logged in $_SESSION and store it in a variable, for example "Bengt", and then I use a script that shows everything in a folder that has the same name as the variable. Maq: Do I use that command to make sure that "Bengt" logs in with lower casing as "bengt"? Thank you for the responses!! =) Quote Link to comment https://forums.phpfreaks.com/topic/149661-solved-can-php-ignore-big-and-small-letters/#findComment-785878 Share on other sites More sharing options...
Daniel0 Posted March 16, 2009 Share Posted March 16, 2009 Store the user name you get from the database instead of whatever the user inputs. Better yet, store the user ID instead of the user name, then select the user's information from the database on each request (or when you need it anyway). Quote Link to comment https://forums.phpfreaks.com/topic/149661-solved-can-php-ignore-big-and-small-letters/#findComment-785881 Share on other sites More sharing options...
insejn Posted March 16, 2009 Author Share Posted March 16, 2009 Daniel0: Ahh thanks! I cant understand why I never thought of using the ID instead of the username ..that would make a lot of things a lot easier. Thanks for the quick responses! Quote Link to comment https://forums.phpfreaks.com/topic/149661-solved-can-php-ignore-big-and-small-letters/#findComment-785895 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.