ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
class UsersController extends Zend_Controller_Action { public function registerAction() { if ($this->_request->isPost()) { $tbl = new UsersTable(); $row = $tbl->createRow($this->_request->getPost()); $row->save(); $this->_redirect('/users/login'); } } } <form action="/users/register" method="post"></form> The game doesn't change because they changed the rules.
-
Point your browser to 127.0.0.1:8888 and LEFT click hello.php
-
don't right click it, left click it!
-
What is it that you see when you open EasyPHP? hello.php.txt?
-
Change <? to <?php in your code.
-
Programming language for developing a computer game??
ignace replied to robert_gsfame's topic in Other Programming Languages
It's not only programming, you'll also need a good amount of working knowledge of Illustrator/Photoshop if you are going for ActionScript and 3D modeling if you go for something like XNA, Java, C++ -
The IF statement that checks whether the user pressed submit DOES NOT go inside the Model, ever! MVC is respectively 3 layers: Business, Presentation and Application. Only the Application layer can handle requests. GET and POST are requests so naturally only the Application layer can handle them, delegating work to the other layers. Handle the POST in the Controller, delegate the information to the Model. If your Model handles Application logic then it becomes less re-usable. To give you a better example: In Java you can develop applications for the desktop but also create Java server pages. You could re-use the same Model here serving both desktop and web.
-
The internal represenation of an array in PHP is a zval (as is for objects, integers, strings, shit.. anything really). I doubt that is of much use to you so I guess you'll just want to know how you can access the values? echo $prices['Tires']; // test1
-
The key here is abstraction. The View can be many things among HTML, XML, JSON, CSV, or even plain text. The same goes for a database. If you ask about databases you'll get answers like MySQL, PostGreSQL, SQLite. Some alternative answers would be Cassandra and CouchDB. An answer you'll never hear but is equally valid is a webservice. Most webservices provide the same CRUD operations any normal DB provides: PUT (Create), GET (Read), POST (Update), DELETE (Delete) or better known under the acronym CRUD.
-
MVC is a simple pattern. It's so simple that most programmers already use it without knowing. A possible Controller could be: if ($_SERVER['REQUEST_METHOD'] == 'POST') { mail($_POST['to'], $_POST['subject'], $_POST['message']); } include 'contact.html'; This little piece of code has a high separation of concern (which MVC promotes). The View (function include() in my example) knows how to parse PHP/HTML and pass the output to the browser. The Model (function mail() in my example) knows how to send an e-mail using the appropriate protocols. The Controller responds to requests and delegates the necessary work to the Model and the View (retrieve the form, send an e-mail). A simple example for a simple concept
-
I know about that but it doesnt update the account of the user that makes the payment.. Thank you anyway The hard part is actually making the payments updating the account's balance should be easy. Something along the lines of: $sql = "UPDATE account SET balance += $points WHERE account_id = $account_id"; if (mysql_query($sql)) { // succeeded }
-
-
Liberty Reserve provides ready made scripts for you to test/run at https://www.libertyreserve.com/en/home/downloads
-
A man and a pony walk into a bar ...
-
If they do pass the law, how will they enforce Firefox/Chrome/Opera/IE/Netscape/Maxthon/.. all update their browser and enforce their users to update their browsers? Whenever they do pass the law, I'm installing Windows XP and start using IE6
-
Don't know if this holds true for other countries but in Belgium as an employer you have to pay for playing music on the work floor. Guess what I'm bringing to work every morning? A nice shiny headset! One can also be charged when playing music to a crowd that is not family such as on a train/bus when your cellphone goes off. The company behind these CRAZY rules has an hidden agenda, if you inform them you are having a party with non-existing artists they'll charge you nevertheless while technically they can only charge for artists that signed up with the before mentioned company to protect their rights.
-
Get all accounts with a negative balance instead of retrieving all accounts: $sql = 'SELECT UID, sum(amount) FROM Transactions GROUP BY UID HAVING sum(amount) < 0'; $res = mysql_query($sql); while($row = mysql_fetch_assoc($res)) { // .. } Use mysql_fetch_assoc() or mysql_fetch_row() instead of mysql_fetch_array()
-
I thought the OP may misinterpret your text and falsely believe using POST in combination with SESSION is secure. I thought I should point it out to the OP. Reading my text again I now realise I have some real trouble explaining myself clearly, clearly.
-
and one. But who is counting anyway?
-
I rather roll my own then function o($str) { return file_put_contents('php://stdout', $str); }
-
That's your problem, right there!
-
Why should you learn javascript when you know php?
ignace replied to Bentley4's topic in Miscellaneous
JS and PHP both serve a different need. JS is aimed at rich-media interaction while PHP is aimed at data processing and enforcing business rules. You can't enforce these constraints at the client's computer. That said though doesn't mean JS can't interact with a database, it sure can but it wouldn't be secure for the same reason you use session's instead of cookies. -
Whether I use print or echo depends on what I want to do (whoohoo for consistency!). I use print() whenever I echo () a single value/variable and echo() when I mix text/ternary-operator with variables using the comma to separate them instead of the dot (I type on azerty , is easier then . to write) I demand a new option in the poll: both
-
Creating Website - Classified Like, Help appreciated.
ignace replied to diz's topic in PHP Coding Help
Your design only covers half of the work you face. I'm pretty sure stuff will start to get complicated when you are implementing payment processing. There are also legal issues here what do you do when someone is selling gold they don't have? How will you ensure fair transaction? How do you make sure buyers don't get ripped off? So you'll have to put a monetary amount on one unit of gold and this value may be influenced by the the number of sellers VS buyers. Then comes your bigger concern: security. Will you store credit card information? How will you ensure credit card information is securely transfered at all times. And I'm only scratching the surface here.. Back to the drawing board! -
I don't see why they should use a session to persist the value (although I do understand mjdamato's argument). But it gives a false believe of safety to the OP since I could mess as much with the POST-ed value as I could with normal query string parameters so I would still have to go through validating and sanitizing the POST-ed value as I would when I received the query string parameter except I would have to do it on every request.