Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1

    duplicate help Please grpg

    $subject = str_replace("\\", "\\\\", htmlspecialchars($_POST['subject'], ENT_QUOTES ));
    $subject = str_replace("yahoo", " ", htmlspecialchars($_POST['subject'], ENT_QUOTES ));
    $msgtext = str_replace(".yahoo", "google ", htmlspecialchars($_POST['msgtext'], ENT_QUOTES ));

    $send_person = new User($to);

    this works if yahoo is wrote in message box it changes to goolge. But want i want is to be able to add more. Like this:
    $subject = str_replace("\\", "\\\\", htmlspecialchars($_POST['subject'], ENT_QUOTES ));
    $subject = str_replace("yahoo", " ", htmlspecialchars($_POST['subject'], ENT_QUOTES ));
    $msgtext = str_replace(".yahoo", "google ", htmlspecialchars($_POST['msgtext'], ENT_QUOTES ));
    $msgtext = str_replace(".ebay", "google ", htmlspecialchars($_POST['msgtext'], ENT_QUOTES ));
    $msgtext = str_replace(".coke", "google ", htmlspecialchars($_POST['msgtext'], ENT_QUOTES ));
    $msgtext = str_replace(".green", "google ", htmlspecialchars($_POST['msgtext'], ENT_QUOTES ));

    and when i add more like that it only does the bottom one not the others... so anybody know how i can write the code so i can have muiltiple words. Wats this does is it replace the first word and makes it google. these words are examples

  2. #2
    Booooring Intermediate => I'm a Rebel Djkanna's Avatar
    Join Date
    Jul 2008
    Location
    United Kingdom
    Posts
    2,929
    Use an array.

    Edit: To be helpful, an example of a way you could do it.


    On an extra note if you really wanted to do you it your way, make sure after the first you use the correct variables, otherwise it's not going to do all of them (well it will but won't produce the desired result).
    Last edited by Djkanna; 04-10-2012 at 03:08 AM.
    "We believe that bad sex and good drugs are the cornerstones of a great democracy."
    - P.A.G.A.N
    Will you be (Mg,Fe)7Si8O22(OH)2 ?




  3. #3
    does that go in classes or mailbox

  4. #4
    Booooring Intermediate => I'm a Rebel Djkanna's Avatar
    Join Date
    Jul 2008
    Location
    United Kingdom
    Posts
    2,929
    Anywhere you want to use it.
    Bare in mind, I have no idea of GRPG's structure, set up or generally anything about the engine.
    So just use it where you need it.
    "We believe that bad sex and good drugs are the cornerstones of a great democracy."
    - P.A.G.A.N
    Will you be (Mg,Fe)7Si8O22(OH)2 ?




  5. #5
    ok wat if i do it my way wat varibles you talking about

  6. #6
    $msgtext = str_replace(".yahoo", "google ", htmlspecialchars($_POST['msgtext'], ENT_QUOTES ));
    $msgtext = str_replace(".ebay", "google ", htmlspecialchars($_POST['msgtext'], ENT_QUOTES ));
    $msgtext = str_replace(".coke", "google ", htmlspecialchars($_POST['msgtext'], ENT_QUOTES ));
    $msgtext = str_replace(".green", "google ", htmlspecialchars($_POST['msgtext'], ENT_QUOTES ));

  7. #7
    if ($_POST['newmessage'] != "")
    {

    $to = $_POST['to'];
    $from = $user_class->id;
    $timesent = time();
    $subject = str_replace("yahoo", " ", htmlspecialchars($_POST['subject'], ENT_QUOTES ));
    $msgtext = str_replace(".yahoo", "google ", htmlspecialchars($_POST['msgtext'], ENT_QUOTES ));

    $send_person = new User($to);

    $checkuser = mysql_query("SELECT `id` FROM `grpgusers` WHERE `id`='".$to."'");
    $username_exist = mysql_num_rows($checkuser);

    this is wat i have

  8. #8
    Booooring Intermediate => I'm a Rebel Djkanna's Avatar
    Join Date
    Jul 2008
    Location
    United Kingdom
    Posts
    2,929
    Then after the first, you would use $msgtext = str_replace('...', '', $msgtext);
    But this isn't really a usable way, imagine having 50+ words to replace.

    Or use an array within the str_replace();
    str_ireplace( array ('Google', 'Yahoo'), array ('Duck Duck Go', 'AltaVista'), $var);
    "We believe that bad sex and good drugs are the cornerstones of a great democracy."
    - P.A.G.A.N
    Will you be (Mg,Fe)7Si8O22(OH)2 ?




  9. #9
    $msgtext = str_replace( array ('Google', 'Yahoo'), array ('Duck Duck Go', 'AltaVista'), $var);
    wont let any words through

  10. #10
    how would i add bbcodes to mail as i can add str_replace to that

Page 1 of 2 12 LastLast

Similar Threads

  1. GRPG
    By Deadmafia in forum Wishes for new plugins
    Replies: 13
    Last Post: 05-28-2010, 08:55 PM
  2. [McCodes] Duplicate IP block
    By (((TOLK))) in forum Free Modifications
    Replies: 20
    Last Post: 02-22-2009, 06:24 PM
  3. Duplicate Ip Address's
    By Eternal in forum PHP
    Replies: 1
    Last Post: 01-16-2009, 08:31 PM
  4. 'QUERY ERROR: Duplicate entry '100' for key 2' Help please
    By HarryB in forum General Discussion
    Replies: 3
    Last Post: 05-28-2008, 02:06 PM
  5. Replies: 1
    Last Post: 05-27-2008, 05:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •