Jump to content

superaktieboy

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

About superaktieboy

  • Birthday 11/08/1990

Profile Information

  • Gender
    Male

superaktieboy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok, so I fixed that error, by renaming the $attributes field to something $attribs, though i have a new error. Warning: DOMNode::appendChild() [domnode.appendchild]: Couldn't fetch P3TElement in D:\www\p3textract\extract.php on line 103 Can anyone help? again same file btw, except $attributes within the class P3TElement has been renamed $attribs as mentioned above. thanks. EDIT: new uploaded version: http://pastebin.com/SsAV7Zte
  2. I have a class (P3TElement) that extends the DOMElement class in PHP. In there i have a public variable "attributes" which is an array, and an method named add_attribute($attr), the argument is a different class (P3TAttribute). However I am getting an error when trying to use it. The exact error is: Warning: P3TElement::add_attribute() [p3telement.add-attribute]: Invalid State Error in D:\www\p3textract\extract.php on line 110 Please see the code: http://pastebin.com/CbsM9V5W This class is supposed to extract .p3t (ps3 themes) files, and is a direct port of the python equivalent found at http://p3textractor.googlecode.com/svn/trunk/p3textractor.py Could you please help me fix this? thanks in advance, Hosh
  3. thanks for the replies guys, this did the trick for me: <?php class lol { private $lol = 'HA'; private $extensions = array(); function add(ext $obj) { $this->extensions[] = $obj; } function loop($text) { foreach($this->extensions as $obj) { $text = $obj->parse($text); } return $text; } } abstract class ext { public abstract function parse($text); } class ext1 extends ext { public function parse($text) { return $text . 'ext1'; } } class ext2 extends ext { public function parse($text) { return $text . 'ext2'; } } $lol = new lol(); $lol->add(new ext1()); $lol->add(new ext2()); echo $lol->loop('test'); ?>
  4. what i was looking to do is extend on a class (multiple times), call one method on the parent class, and the parent class calls a method in the subclasses, as they edit a specific text.. e.g. file main.class.php static class main{ public static function addToText($text); } file plugins/something.class.php class something extends main() { function addToText($text) { return $text.'a'; } } file plugins/somethingElse.class.php class somethingElse extends main() { function addToText($text) { return $text.'b'; } } this way i would include everything in plugins folder, and it would automatically be initiated and when calling main::addToText(), it would call the rest of the classes' addToText() function.
  5. Hi, I am looking into a way of adding addons to a class I made.. I thought something like this would work, but not sure how to implement it: <?php class foo { function foobar($text) { $text = $text . 'b'; return $text; } } class bar extends foo { function foobar($text) { $text = $text . 'c'; return $text; } } $var = new bar(); $var->foobar('a'); // this would then return abc ?> Now i want to be able to call up foo, and it calls the foobar of foo, and the foobar of bar. is that possible? hosh
  6. Thanks for your help, I think I won't be using it in my current project, but maybe in the next, either way, I now have a better idea of what it exactly is used for. Thank you
  7. I have noticed that many websites and php software generate a random token and put it in a hidden form field to be sent to the php page that gets the form. I was just wondering, if anyone knows how this makes a php script more secure? And is it worth it to put this in my application? I have read up a few tutorials on this, but it doesn't specifically say why this is more secure than not having it. The only reason I could find is that it helps making sure you don't make duplicate form submissions, however, I have always gone around this through by redirecting the user to a page saying the form was submitted successfully. Cheers for your help.
  8. yeah i know.. and decided to use CV's method because it picks up more, you never know i might need more than just a-z and 0-9.. thanks to you both anyway
  9. nope not necessary hmm sounds like an idea.. im gonna see if nrg_alpha's method works.. if it doesn't ill be using this.. thanks yeah i think that is it thanks
  10. hi im trying to make a template parser in php.. am a bit stuck tho.. im trying to parse the following: {blockname.blockname.varname} that seems to work fine if there is only one of those. but if i have mutliple vars next to eachother like this: {blockname.blockname.varname1} {blockname.blockname.varname2} the same thing doesn't work.. my regex currently is: /(\{([^\}](.*?\.)+(.*?)+)\})/ and im using preg_match to find them. however, it doesn't seem to work, i keep getting the following as the result: Array ( [0] => {blockname.blockname.varname1} {blockname.blockname.varname2} [1] => {blockname.blockname.varname1} {blockname.blockname.varname2} [2] => blockname.blockname.varname1} {blockname.blockname.varname2 [3] => blockname. [4] => ) no i use the third array argument ([2]).. which is supposed to be blockname.blockname.varname1 (without the brackets).. but if i have multiple vars on the same line, i get all the stuff inbetween the first and the last var. as u can see i have also tried adding [^\}] but it doesn't seem to work either.. how can i get multiple of these vars (without the brackets if possible) if they're on the same line? coz what i put down for the regex seems to fail epicly. thanks for your help super...
  11. i fixed it.. it was some bug in remotefsize(), which i rewrote without the use of get_headers() this is the new function, works in both php4 & php5: <?php function remotefsize($url) { $path = parse_url($url); $fso = @fsockopen($path['host'], 80); if ($fso) { $header = 'GET ' . $url . ' HTTP/1.0' . "\n"; $header .= 'Host: ' . $path['host'] . "\n\n"; fwrite($fso, $header); $buffer = ''; while ($tmp = fread($fso, 1024)) { $buffer .= $tmp; } $matches = Array(); preg_match('/Content-Length: ([0-9]+)/', $buffer, $matches); return substr($buffer, @$matches[1]); } else { return false; } } ?>
  12. nope nothing, but i think i have found the problem.. when downloading the video directly, in php5 the browser knows the filesize, but in php4 it doesn't.. infat it goes even past the actual filesize! screenshot, the properties window is downloaded using php5, the download window is downloaded using php4:
  13. yh thats what i thought about the code being ok :S but erm about the settings in php, i am not sure coz i use xampp, and switch using the php switcher, but i haven't changed anything at all in the php.ini for both php4 and php5.. and what do you mean with "see it all about settings using the header so much mate" and last.. so you mean calling the code without javascript, just plain HTML.. btw the flash player is not mine, its JW Flash Player.. so you mean something like this (copied straight from FireBug after fully loaded): <embed id="mediaplayer" width="425" height="350" flashvars="width=425&height=351&showstop=true&file=get.php%3Fvid%3DW2SCxlqR8RU%26did%3DOEgsToPDskIPmpYbK8F3VuFP2Q-zQQiO%26filetype%3D.flv&image=get.php%3Fvid%3DW2SCxlqR8RU%26get_image_only%3Dtrue%26file_type%3D.jpg&type=flv" allowfullscreen="true" quality="high" name="mediaplayer" style="" src="argh_player.swf" type="application/x-shockwave-flash"/> greeetzz
  14. sorry how do you mean? if you mean i how call the flash its like this: <?php $get_array = YoutubeGetLink('IbrjM4aAWHY'); // YoutubeGetLink() generates a link liket his: get.php?vid=IbrjM4aAWHY&did=OEgsToPDskJ1K9lLbCNe_wgYgqZOPhzG&filetype=.flv $link = $get_array['link']; ?> <div id="container"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div> <script type="text/javascript"> <!-- var object = new SWFObject("argh_player.swf", "mediaplayer", "425", "350", "7"); object.addParam("allowfullscreen", "true"); object.addVariable("width", "425"); object.addVariable("height", "351"); object.addVariable("showstop", "true"); object.addVariable("file", encodeURIComponent("<?php echo $link; ?>")); object.addVariable("image", encodeURIComponent("<?php echo $img; ?>")); object.addVariable("type", "flv"); // this forces to read the file as an .flv file object.write("container"); --> </script>
×
×
  • 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.