Safely Remove Mb_strtolower

Discussion in 'PHP' started by abyse, Feb 10, 2013.

  1. #1
    Hi guys, please help me to remove the mb_strtolower function from a script.

    1: There I enter a tag ex: Bigbang
    code:
    {input name='tags[]' type='autocomplete_list' ajaxFile='ajax_tagsList.php' id='tags' default_description=$default_description values=$wallpaper.tags}
    Code (markup):
    2: script calls ajax_tagsList.php
    code:

    3: Script display the tag as: bigbang
    code:
    This scrip is from a wallpaper site, the problem is when I add a tag ex: Bigbang the script will insert the word as "bigband" in mysql and displays at "bigband"

    I want to use capital letters in some tags, but i can't remove the .mb_strtolower function :/

    any help would be greatly appreciated, thanks.
     
    Last edited: Feb 10, 2013
    abyse, Feb 10, 2013 IP
  2. gavo

    gavo Active Member

    Messages:
    123
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Cant you just use ucfirst("$string"); when displaying the tags? if you remove strtolower function all existing tags may break.

    http://php.net/manual/en/function.ucfirst.php
     
    gavo, Feb 10, 2013 IP
  3. tribulant

    tribulant Active Member

    Messages:
    352
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    85
    #3
    It seems like your script stores and reads the 'name' value via MySQL as lowercase.

    You can remove mb_strtolower() where the values are being stored so that they are stored into the 'name' field as they are typed in so that everything isn't lowercase automatically.
     
    tribulant, Feb 11, 2013 IP
  4. abyse

    abyse Notable Member

    Messages:
    346
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    245
    #4
    so I remove mb_strtolower from this line:
    it would be:

    but how ti remove from this line? :

     
    abyse, Feb 11, 2013 IP
  5. innozemec

    innozemec Active Member

    Messages:
    84
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    68
    #5
    simply cut out this line $_GET['q'] = mb_strtolower($_GET['q']);
     
    innozemec, Feb 11, 2013 IP
  6. gavo

    gavo Active Member

    Messages:
    123
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    70
    #6
    LOWER(b.name)='".$DB->s($tag)."' AND
     
    gavo, Feb 11, 2013 IP
  7. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #7
    If you don't want it to change $_GET, store it in a variable for the places that need it changed and leave it alone where you want it 'mixed'... and why can't you just remove strtolower?!?

    Though... I know I shouldn't be too surprised at bad/insecure PHP when I see someone using smarty -- the two seem to go hand in hand... but... wow...

    You seem to be using some form of object based SQL, so why aren't you using prepared queries and instead seem to be blindly plugging in values to a string making the whole thing injection city? Goofy reverse quotes and string addition to build queries is decade out of date practices at best... Just what is that $db object because what you are doing with it is ... just wrong. Insecure, dangerous, just asking to be pwned.

    Also not sure why you're bothering with the object version of JSON with the detection since it would work either way with the just function...
     
    deathshadow, Feb 11, 2013 IP