Jump to content

Fyorl

Members
  • Posts

    273
  • Joined

  • Last visited

    Never

Everything posted by Fyorl

  1. OOP stands for Object Oriented (should be Orientated really but that's a different argument) Programming and as such is just a way of writing your code (as opposed to Procedural Programming).
  2. It would be better practice to only write methods that you use...
  3. Erm well you should only need read and execute permissions for the owner if your server's setup properly. If it's not then you might need to add execute permissions for group and/or others too. That's something only your hosts can dictate though. r-xr--r-- = 544 r-xr-xr-x = 555 rwxr--r-- = 744 (probably what it should be ideally as presumably you still want to be able to write to it)
  4. Woah, sorry, I didn't realise my reply was so badly formatted, turns out it parses 'pre' tags.
  5. If you display the text that's come directly from a textarea then you won't see any newlines because HTML ignores carriage returns. If you wanted to see the text as a text editor would display it then you need to put the output within '<pre>' tags. Anyway, to solve your you'll need to use: $lines = explode("\n", $m3u); As PHP interprets \n as the newline character when it's put inside double quotes.
  6. Try putting '#!/usr/bin/php' right at the top of the file, before the '<?php'
  7. Ooh it is indeed. You'll probably want to block passthru() and system() too then.
  8. <?php $lines = file('playlist.m3u'); $count = 0; foreach($lines as $line) { if($line[0] != '#') continue; if(trim($line) == '#EXTM3U') continue; $count++; $fcount = (string) $count; if($count < 10) $fcount = '0' . $fcount; echo "$fcount - " . substr($line, 12) . "\n"; } ?> That should be most of the logic, the output can be changed.
  9. Well I changed the method to 'get' and it submitted the get data to the right page fine. That was when it pointed directly to the PHP file. So I'd assume pointing directly to the PHP file would work with the post data too if it worked with the get data.
  10. Try putting a var_dump($_REQUEST) just above your if statement. Also try putting the full path to the php file in the form's action. If that doesn't work then try using $SERVER['PHP_SELF'] as the form action instead.
  11. Do you have a live version I could look at?
  12. But you can serialize objects and have them persist over sessions. Also, like Liquid Fire said, OOP has lots of benefits in terms of data structure and interaction. It's also much better for collaborative projects as it provides encapsulation.
  13. Well when you click the submit button does the current page refresh or are you taken to the new location? Also, try using print_r($_REQUEST); and see what output you get.
  14. OK, sorry. You need to use double quotes if you want to produce <em>valid</em> HTML. As it stands, that code will not pass any validation test. Yes, you're right, the form will post to itself. So, following the logic of your function a bit more carefully, you should have 'http://www.mysite.net/ec/login' as your form's action attribute. The first thing I would do is check that that is actually the case.
  15. Depending on how much code you allow people to post and what environment you're running it in there could potentially be a lot of room for malicious attacks. I'd say the curl functions could also be abused quite easily. Letting people use mail() would be bad too. Those are just some off the top of my head, if I think of some more I'll post them.
  16. Oh yeah sorry, obviously didn't look hard enough. Firstly you need to use double quotes around your HTML attributes. Secondly, your form action is calling show_site but not passing any parameters in so show_site will return nothing and so your form won't submit the data anywhere.
  17. Just put the path to the PHP script that you want to be run every 10 minutes into the cron manager in CPanel.
  18. Where's the form you're using to submit the data? I can't see a show_form function in your functions file...
  19. Have a look at <a href="http://php.net/serialize">serialize()</a>
  20. I think an array might be your answer.
  21. You've used 'if' twice, you don't need it after the 'AND'. Also, as the above comment suggests, the variables may be set but still empty in which case you need to use the empty() function. Or just check if they are false with: if(!$_POST['field1'] && !$_POST['field2'])
  22. What do you need the Sample Title for? You don't seem to be using it in your formatting anywhere.
  23. The tab character is what appears when you press the Tab key in text editors (unless they replace the tab with a number of spaces). It's what I use to indent my code... Anyway, when you use "\t" in PHP it's converted to a tab character in much the same way as "\n" is converted into a newline character. Phreeek had used date("... \a\t ..."); since it was in double quotes and not single quotes, the \t was converted into a tab character. Adding another slash before it escaped the original backslash so you were effectively left with the two characters '\t' and not the tab character. So, if you were to use single quotes instead of double quotes then the extra backslash wouldn't be necessary. Either way I'm glad you found a solution to your problem.
×
×
  • 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.