1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Help with config

Discussion in 'Development' started by Besher, Oct 31, 2020.

  1. Besher

    Besher Witch

    Messages:
    51
    what is the function to kinda search in a config file.
    What im trying to do is make kinda codes like a giftcard and people can redeem them but if the code is not in config then they cant redeem i have look everywhere please help me
    so how do i do that
    -Besher
     
    Primus likes this.
  2. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Primus likes this.
  3. Besher

    Besher Witch

    Messages:
    51
  4. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Create an array with the key 'giftcards' inside the config file with all the codes on it.
    if(in_array($code, Config->get("giftcards"))) {}
     
    Primus likes this.
  5. Besher

    Besher Witch

    Messages:
    51
    Thanks for the help, But if i want to add a code to the array how do i do it with a command i know how to do args but dont know the functions
     
    Primus likes this.
  6. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Config->set()
     
  7. Besher

    Besher Witch

    Messages:
    51
    I tried that and it puts it in a new line outside the array
     
  8. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    PHP:
    $giftcards Config->get("giftcards");
    $giftcards[] = $code;
    Config->set("giftcards"$giftcards);
    Config->save();
     
    Primus likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.