Jump to content

Magestickown

New Members
  • Posts

    4
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Magestickown's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Haha yeah... I understand regex, but only the basics. Either way, I got it working great now Thanks anyway. public function parse_message($str) { $arguments = explode(' ', $str); $count = count($arguments); $username = explode('!', substr($arguments[0], 1)); $username = isset($username[0]) ? $username[0] : ''; $command = isset($arguments[1]) ? $arguments[1] : ''; $args = ""; for($i = 2; $i < $count; $i++) $args .= $arguments[$i] . ' '; $trailing_data = stripos($str, ' :'); $trailing_data = trim(substr($str, $trailing_data + 2)); return array('username' => $username, 'command' => $command, 'trail' => $trailing_data, 'args' => $args); }
  2. Hello! I made a function to split an IRC message into its: prefix, command, arguments and trailing data. It works, mostly, except if I add a string that I'm exploding into the trailing data, it will attempt to explode that, instead of the first instance. Like this: public function parse_message($str) { $array = explode(' ', $str); $username = substr($array[0], 1); $username = explode('!', $username); $username = isset($username[0]) ? $username[0] : ''; $command = isset($array[1]) ? $array[1] : ''; $args = ''; $count = count($array); for($i = 2; $i < $count; $i++) $args .= $array[$i] . ' '; $args = explode(' :', $args); $trailing = isset($args[1]) ? $args[1] : ''; $args = isset($args[0]) ? $args[0] : ''; //:[email protected] PRIVMSG #balls :wah return array('username' => $username, 'command' => $command, 'args' => $args, 'trail' => $trailing); } //:[email protected] PRIVMSG #balls :!eval $this->chat("QUIT :Goodbye."); //"QUIT :Goodbye" makes it only split up to there. It should get everything after #balls :, which it does, but if I add an extra " :", it will only get the first index of the array. Also, if someone could maybe find a better way to do this, that'd be great
  3. Can you explain that a bit more? I'm very new to PHP
  4. Please help me, I keep getting undefined index Here's my code: <?php ////////////////// if ($_GET['formradio1']=='') <--- Line 179 { ?> <html> <div id="image1" style="position:absolute; overflow:hidden; left:0px; top:495px; width:658px; height:500px; z-index:0"><img src="images/default.jpg" alt="" title="" border=0 width=658 height=500></div> <left> </html> <?php } if ($_GET['formradio1']=='HTR') <----- Line 190 { ?> <html> <div id="image2" style="position:absolute; overflow:hidden; left:0px; top:495px; width:658px; height:500px; z-index:1"><img src="images/htr.jpg" alt="" title="" border=0 width=658 height=500></div> <left> </html> <?php } /////////////////////////// if ($_GET['formradio1']=='faq') <------ Line 202 { ?> <html> <div id="image2" style="position:absolute; overflow:hidden; left:0px; top:495px; width:658px; height:500px; z-index:1"><img src="images/faq.jpg" alt="" title="" border=0 width=658 height=500></div> <left> </html> <?php } /////////////////////////// if ($_GET['formradio1']=='bridge') <------ Line 214 { ?> <html> <div id="image2" style="position:absolute; overflow:hidden; left:0px; top:495px; width:658px; height:500px; z-index:1"><img src="images/bridge.jpg" alt="" title="" border=0 width=658 height=500></div> <left> </html> <?php } ////////// ?> And my error: Notice: Undefined index: formradio1 in C:\wamp\www\help.php on line 179 Notice: Undefined index: formradio1 in C:\wamp\www\help.php on line 190 Notice: Undefined index: formradio1 in C:\wamp\www\help.php on line 202 Notice: Undefined index: formradio1 in C:\wamp\www\help.php on line 214 The name of my radio button is fromradio1 - How would I make it a defined index to load the image?
×
×
  • 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.