bms231 Posted May 3, 2007 Share Posted May 3, 2007 ok so i have to be missing a character or something b/c it breaks. i am doing this in wordpad. i am not a php programmer. i am C# and this stuff just looks like greek to me but I am trying. function streetfire(& $mediaArray) { global $db; if (preg_match('/video\/(.*)\.htm', $this->_mediaInfo['url'], $match) { if ($this->vbulletin->options['vbmediaplayerproxy']) { $content = $this->fetchContent('http://www.freeproxysite.com/perl/nph-proxy.pl/101110A/http/videos.streetfire.net/vidiac.swf?video=' . $match[1]); } else { $content = $this->fetchContent('http://videos.streetfire.net/vidiac.swf?video=' . $match[1]); } if (preg_match('|<title>(.+)</title>|Ui',$content,$out)) { $title = $out[1]; if (preg_match('|^Video - |Ui',trim($out[1]))) { $title = preg_replace('|^Video - |Ui','',trim($out[1])); } } else { $title = ''; } $this->_mediaInfo['title'] = $title; if (preg_match('|<span id="_ctl0_Description" class="v7-text">(.+)</span>|is',$content,$out)) { $description = trim(strip_tags($out[1])); } else { $description = ''; } $this->_mediaInfo['description'] = $description; if($this->vbulletin->options['vbmediaplayerproxy']) { $this->_mediaInfo['url'] = 'http://www.freeproxysite.com/perl/nph-proxy.pl/111110A/http/videos.streetfire.net/vidiac.swf?video=' . $match[1]; } else { $this->_mediaInfo['url'] = 'http://videos.streetfire.net/vidiac.swf?video=' . $match[1]; } $this->streetfire_player($mediaArray); $db->query_write("INSERT INTO `" . TABLE_PREFIX . "vbmediaplayerinfo` ( `id` , `type`, `media_code`, `media_url`, `media_info` , `title` , `description` , `date_added` ) VALUES (NULL , '".addslashes($this->_mediaInfo['type'])."', '".addslashes($this->_mediaInfo['text'])."', '".addslashes($this->_mediaInfo['url'])."', '".addslashes(var_export($this->_mediaInfo,true))."', '".addslashes($title)."', '".addslashes($description)."', UNIX_TIMESTAMP( ));"); } else { $this->_mediaInfo['type'] = 'error'; } } Link to comment https://forums.phpfreaks.com/topic/49740-what-is-wrong-w-my-code/ Share on other sites More sharing options...
corbin Posted May 3, 2007 Share Posted May 3, 2007 $this is only used in classes, not in functions.... If you're trying to access the variable of a class, do it like (assuming $class is an instance of the class) $class->Variable.... If you're trying to set a temporary variable for use just in the function, variables created in functions are separate from variables outside of functions (the reason the globalizing of the $db var is neccessary). Also, to access variables created within a function, you just use the variable name. Besides the use of $this, the only other problem I see is: preg_match('/video\/(.*)\.htm', That pattern will give off a warning because it will assume / is a delimiter.... It needs to be something like preg_match('/\/video\/(.*)\.htm/', Link to comment https://forums.phpfreaks.com/topic/49740-what-is-wrong-w-my-code/#findComment-243942 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.