Jump to content

ikin

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Posts posted by ikin

  1. $timewaiting = time() + 160; // Waiting time. (2min)
    
    if ((time()-$timewaiting) < time()){
    $howlongleft = $timewaiting - time();
    
    echo ("You must wait $howlongleft seconds.");
    }

    That only seems to echo 160.

    Thanks for the reply though.

    Because you got to add the time to like a database, because there you only add the time then check = only gives the time you gave.

  2. Well I'm trying to learn regex so I can use it on my bot but I can't seem to do it right...

    I was using http://www.spaweditor.com/scripts/regex/index.php for a while and came up with this:

    /watch\?v=(.*)/

    To parse: iIp7OnHXBlo out of

     

    But it only ended taking the new word to like if I had

    Cake is good http://www.youtube.com/watch?v=iIp7OnHXBlo do you like cake?

    it would take with the

    iIp7OnHXBlo do you like cake?

    instead of only the

    iIp7OnHXBlo

    So yea I need some help...

    Code:

                if (preg_match('/watch\?v=(.*)/', $dh->getircTrailing()." ", $trackkeys)) {
                    if ($trackkeys != "") {
                        $feedURL = 'http://gdata.youtube.com/feeds/api/videos/' . $trackkey[1];
                        $entry = simplexml_load_file($feedURL);
                        $video = parseVideoEntry($entry);
                        $dh->reply("[Youtube} Title: {$video->title} | By: {$video->author} (uploaded on " . convert_tz($video->published, UTC) . ") | Duration: " . sprintf("%0.2f", $video->length / 60) . " | Views: {$video->viewCount} | Rating: {$video->rating}");
                    }
                }
    

  3. Well I have never learn'd Regex, so I need some help with it.

    I'm trying to remove the |file = in the string (the code is in wikipedia format):

    {{Infobox Music
    |name           = Body Parts
    |release        = [[31 January]] [[2005]]
    |update         = Creature of Fenkenstrain
    |members        = Yes
    |location       = Experiment Dungeon
    |skillrequired  = 
    |questrequired  = [[Creature of Fenkenstrain]]
    |hint           = This track unlocks at the dungeon south-east of Fenkenstrain's Castle.
    |file = 
    }}

    oh if it were just to do str_replace it would be love but no, they have to use multi spaces sometimes :@...

    Like:

    |      file     =

    Etc but only spaces nothing else,

    So I was trying to replace it (as I said):

    echo(preg_replace("/(\|)(\s+)(\file)(\s+)(\=)/i", "", $e));

    But it didn't work (Yes I tried with many...)

    So I come here to ask for help.

    Thanks for reading.

  4. Well I'm trying to make my bot take out some words from a string and well do stuff.

    Heres the string:

    -File: Valture.png -To: Bird.png -Namechange

    and it should print out:

    Valture.png

    Bird.png

    But I can't seem to know how, so yea...

  5. Well I'm stuck...

    So I'm trying to make the php print out the text between

    title="Text here"

     

    <?php
    function Betweens($string)
    {
        $pattern = '/title="(.*?)"/'; //It fails here 
        preg_match($pattern, $string, $matches);
        return $matches[1];
    }
    $str = '<iu pageid="2022" ns="0" title="Test" />';
    $p = Betweens($str);
    echo $p;
    ?>

    So yea I really suck at regex's..

     

    Edit: God damn it, now I see I've posted in wrong sector -.-

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.