Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. Generally speaking, everything that's concerned with presentational logic belongs in the view part of MVC. This means that putting the controllers' methods would be a no-go. If you have a lot of shared functionality, which is commonly used in your views, then you obviously should not copy and paste it all over the place (which is exactly your problem). One answer would be creating view helpers. The implementation isn't set in stone (no patterns are), so you are more or less free to do it as you see fit. It's essentially a class/function/file that is given some input, and in return gives some output. I suppose you could call it a "sub-view" too, i.e. a view file invoked by another view file. You could take a look at the implementation in Zend Framework, which is my favorite framework. Welcome
  2. If by "install Zend" you mean "install Zend Server" (notice the ambiguity that appears when people use "Zend" to refer to "Zend Studio", "Zend Server", "Zend Guard", "Zend Framework", etc. - use the full name!) then yes. In fact, Zend Server and Zend Studio plays well together with the built-in support for debugging.
  3. WAMP means "Windows, Apache, MySQL, PHP" and LAMP means "Linux, Apache, MySQL, PHP". If you use Linux then use the distro's package manager. If you use Windows then the easiest is probably choosing one of the available bundles (I use Zend Server CE).
  4. http://www.phpfreaks.com/blog/testing-legacy-versions-of-internet-explorer
  5. Oh, I didn't see you used CURLOPT_FILE. Anyway, try to echo it instead of saving it to see if it actually downloads the file.
  6. That depends on how that menu is generated.
  7. I don't see you calling fwrite.
  8. Try to use absolute paths to the binary and to the file.
  9. Move <?php $sa = $_GET["SaleAmount"]; $ct = $_GET["cTender"]; $dif = $ct - $sa; ?> to the other page and then read the manual to figure out why it has to be so
  10. If you imagine a zone for example.com then @ will be example.com, www will be www.example.com and * will be any possible subdomain of example.com (including none).
  11. Okay, wait it seems like I misunderstood you. Yes, you'll only be able to have 32 permission flags with a 32-bit integer. I was actually talking about the different combinations you could make using these. Anyway, an ACL would be far more superior.
  12. An n bit integer can have 2n different values, so for an unsigned 32-bit integer, that means 0 through 4,294,967,295. If you assign a larger value then it'll overflow.
  13. You might find it helpful to learn some more or less advanced mathematics. It's the same kind of logical thinking that's needed in programming. You'll also need to learn how to decompose a large problem into smaller sub problems. If you can't keep it in your head, then write it down. Make a list of the features, then on each item, write a list of what's needed to create that feature. Creating topics is an essential part of a forum system. How do you create topics? Well, you will need a form and you will need a script that processes that form. That script will need to validate the contents and ultimately insert it into the database. Take a look at this: http://www.phpfreaks.com/blog/learning-to-think-like-a-programmer Otherwise it's just syntax, which you could get in a couple of days really. The syntax is the easy part, but getting a programmer's mind set is something much more difficult.
  14. Like I said, he shouldn't copy it verbatim and he should implement a more user friendly way of reporting form errors... Mind showing an effort yourself? If you want people to program the entire thing then post in the freelancing forum. We're here to help you, not to do your work for you.
  15. You might want to read this: http://www.phpfreaks.com/tutorial/php-security It's meant to be a primer on the most important security aspects in PHP.
  16. You can turn it off in your user agent. Once you've sent the output from your server then you no longer control it. You'll just have to ensure that people have no means of injecting the Javascript in the first place.
  17. Execute arbitrary Javascript on the client computer, and all that entails.
  18. It's a staff member at some company's forum, so I would assume it's not just post count padding. I can't remember where it is though :\
  19. Assuming you have made your form that has action="process.php", process.php could look like this: <?php // you might want to implement a more user friendly way of validating the values... if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { throw new InvalidArgumentException('Invalid email address.'); } if (strlen($_POST['name'] > 50) { throw new LengthException('Name is too long. Max length is 50 characters.'); } if (in_array($_POST['priority'], array('small', 'medium', 'high')) { throw new InvalidArgumentException('Invalid priority.'); } $numOrders = (int) $_POST['numOrders']; $priority = ucwords(strtolower($_POST['priority'])); $info = <<<EOF Name: {$_POST['name']} Email: {$_POST['email']} Number of Orders: {$numOrders} Priority: {$priority} EOF; file_put_contents('logs.txt', $info); It isn't tested, and you probably wouldn't want to use it verbatim, but it should give you an idea of how to do it.
  20. The highest I've seen is something like 130k+. I can't remember where that is though.
  21. Then why is it a problem to escape the entities on the file you're viewing?
  22. Yeah, but how exactly is it "imported"? You'll probably have to rethink the design of your application to have a page that solely provides the XML data.
  23. Then just do print"<td align=left><div $info_step_class>". htmlentities($step_action) . "</div></td>". NEWLINE; I don't see why that would interfere with Excel though. How is it being read into that? (And why do you put XML data in Excel?)
  24. You could store it in a cookie, use AJAX, or just do a regular GET/POST request to "transfer" it to PHP though.
  25. Well, "visible", how exactly are you outputting it? You can't just echo raw XML in the middle of an HTML document. When an HTML parser is parsing an HTML document, it'll just throw away unknown tags and attributes. What you are seeing is the rendered version, and what you see when you when you click "view source" is the raw source code. Programs that'll read your outputs reads the source, not whatever it has turned into graphically when it's been rendered.
×
×
  • 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.