Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. Again, I ask you -- did you check your mta? What is your mta? What is your operating system? What configuration settings for mail is in the php.ini?
  2. Did you actually read my post or just scan it? There is no concept on the server side of a request. Servers only provide responses. It is the client that specifies the type of the request. What the server returns is results... typically the html, or in some cases data of some form (when an image is requested for example).
  3. I'm not sure what type of answer you expect. The reasonable question to ask yourself is -- what if anything changed? If the code did not change, and you've tested the form, then it is reasonable to assume that the problem is in your MTA (mailserver). Since you provided no information about the server environment, there's not much more anyone could tell you right now. the mail() call simply dumps the emails to the MTA, and the MTA should deliver them. Furthermore, if this is a local MTA that hasn't been properly configured and passes the types of checks that mail servers require these days (SPF record, DNS entries, reverse DNS resolution) then it's possible that the "bell.com" server will reject the emails outright, rather than putting them in a spam folder. You need to check what is happening with the MTA, and see if messages are being queued or delivered.
  4. Yes, that variable will indicate if it's a GET request or a POST request.
  5. In your controller, you get your "GET" variables via $var = $this->_request->getQuery('key'); It's unclear from your code what the key is for the data you're passing. Typically however, you'd use the post method, and get the post variables like this: $var = $this->_request->getPost('key');
  6. I'll take a crack at elaborting on your question, just for the sake of completeness and perhaps future googlers. Everything in HTTP is driven by requests. The browser is the client and it makes requests to the server, which then provides a response. Client (Request) ----> Server Client So for every request you get a response. This is all described in the RFC for the HTTP protocol. At this point all modern clients (browsers and HTTP aware applications) support HTTP 1.1. The wikipedia page that kicken linked you to, lists the types of Requests that are supported. In the case of both GET and POST type requests, a url gets provided, which is how the server determines what resource (ie script) should field that request. URL's are allowed to have query strings attached (everything after the ?). Of course those querystrings specify variables in name=value pairs. From the php side, any of these url parameters are converted into "$_GET" variables. Now when you look at an HTML form, one of it's parameters is METHOD=. This can be either "GET" or "POST". It should be fairly apparent, that if you specify "get" the form elements will be transformed into url parameters. If however, you specify "post", the variables go somewhere else. Going back to the original idea of HTTP request/response, each HTTP request has a special data section called the "header" where variables can be provided. This is where url is specified, the hostname of the server, the cookie data and various other control and configuration variables can be sent. the wikipedia page lists these in detail. When you specify a POST, what the client sends in the header is typically these extra header fields: Content-Length: 89 Content-Type: application/x-www-form-urlencoded The Content-Length would be the length of the data being sent in the post, and the Content-Type indicates the format of the data that will follow. After this header, there's a linebreak, and then the client will send the rest of the data, which typically takes a form similar to a querystring: Let's say you have this form (right off the w3c html spec page): </pre> <form method="post"> First name: Last name: email: Male Female </form> <br><b You enter in some data and submit the form --- , then look at the Net tab in firebug, and open up the request: Content-Length 67 Content-Type application/x-www-form-urlencoded And the raw post data that was sent after the header will look like this: firstname=Fred&lastname=Flinstone&email=fred%40bedrock.com&sex=Male In conclusion, a get parameter is really just the header. There is no other data. A Post has the header, but it also is followed by some variable amount of data, which the server reads in, and depending on the encoding header, will parse up in various ways. PHP makes this section of data available in the $_POST and $_FILES superglobals, but its raw form is based on what the client sends to the server.
  7. Here's one solution: $scale = $this->max - $this->min; $pixels = 100; foreach($arr as $val){ $nTime = round(($val - $this->min) * $pixels / $scale); $data .= "data[$i] = ".$nTime.";"; $i++; }
  8. Starting/ending sessions is not what you should be doing here. A session exists to stitch together requests from the same client over a period of time. Trying to force it to become a timer is not how you should approach this problem. Instead, use one or more session variables. For example: $_SESSION['currentQuizId'] = $currentQuizId; $_SESSION['quizStarted'] = date; kicken provided one of the best methods for making the page interactive -- using ajax calls to synchronize your quiz app with the backend.
  9. First off, don't use '@' to suppress errors or notices. Fix them instead. Your problem is your attempted use of empty. The error message is VERY descriptive. It told you to look for "unexpected use of AND". Your code uses '&&" in one place, so clearly that's the place to look -- inside the empty(). You can't pass in a bunch of && variables there, and if you think about it, it doesn't really make sense. I suppose if you want to continue with that, what you should do is: if (!empty($nombre) && !empty($apellido) && ... etc)
  10. You prefix the column with the tablename (tablename.column). You only need to do this when you have to resolve the case where you have the same column name in more than one of the joined tables, so that the sql engine can not determine which . I should probably add that most people use aliases to make this less painful. The kitchen sink answer for using the wildcard '*' is this: SELECT v.*, p.* FROM price p INNER JOIN vehicle v .....
  11. Of course it makes a difference. Inside a function you can't just use a variable that you didn't pass as a parameter or declare global. Objects that contain resources (database or file handles) are even more sensitive.
  12. You have a bunch of code, and a lot of different things that could be problems. For example, you have a function .... is it a function or a method in a class? In that function you refer to a $db variable, which looks like a database class, but there is no instantiantion with new, and that variable is not a parameter or a global variable, so that would be a problem. Is that really your code? The biggest problem however, is that you didn't actually say, specifically, what doesn't work. "It's just not working" is not a sufficient explanation.
  13. Sorry but I felt I just had to respond to this. First of all, you don't have a clue what you're talking about. Out of all the communities and communication networks and forums I've been a part of, this one is BY FAR, the most easy going and newbie friendly. Look at some of the post counts of the people who have been answering you, and realize that many of these people have been answering questions for people FOR YEARS. Phpf is far more lenient and easy going than any other forum covering the same subject matter, and that is why it is the most heavily visited forum on PHP development in existence. While it is, to one degree a great resource for someone learning web development, it simply can not be a substitute for learning the basics, and it's painfully evident that you are way out of your element here. I have plenty of empathy, because the plain and simple fact is, that web development to a level of professional competency is non-trivial. Every day people come to this forum, having jumped, been pushed or were dragged into the deep end, and they're drowning. People here do understand that, and are far more willing to throw someone a lifeline, than in any programming related online community I've ever seen. The problem is, that there's a lot of material and you are struggling with basic basic stuff. What several people have said to you is that they were frustrated by your response to their attempts to help you. After answering a few hundred different questions, you learn pretty quickly when you are wasting your time, and for even the most altruistic person in the world, there's a point at which you realize that your time is better spent elsewhere. If you have any aspirations to do this at any level of competency, you need to find a decent book and immerse yourself in it, and show some humility and admit that you don't know what the hell you're doing, and that whatever you do create right now will not be very good. Also realize that it's ok to write sucky code, and that you'll learn and you'll get better. People who are far better developers than you could ever hope to be, do this constantly, because like nearly everything in life, there is both a science and an art to writing software. To illustrate this point further, in the PHP world there are 2 state of the art frameworks right now: the Zend Framework and Symfony. There are other popular frameworks, but they are not new, and don't use the latest features of the language. The architect of the Symfony framework built a substantial business and following for Symfony 1.x, but at some point, he realized, that the framework that he built that was being used by 1000's of developers around the world on a daily basis, and was powering sites from companies like Yahoo, had a lot of fundamental flaws. In short, he took a good hard look at what he had done, and evaluated weaknesses, and approaches that had been taken which in hindsight, had fallen short of their objectives. So he threw the entire thing out and started over from scratch, and thus there is now symfony 2, which is not compatible with symfony 1 in any way. That is the nature of software engineering -- you learn, you make mistakes, you adapt, and you relearn, and things change constantly. You have to continuously evolve and retrain and must be willing to roll your sleeves up and dig in and read and experiment, and accept that you will fail, and make foolish mistakes, and if you have the right attitude, you will learn from them. I think what emanates from your posts here, aside from the fact that you're floundering and confused, is that you don't react positively to people when they point out that you don't know what you're talking about. It would be one thing if this was just people shooting the breeze, but this is people providing you with source code. So when you say you don't understand what they did, the first question that has to be asked is... why not? What didn't you do to try and understand it? Why didn't you break it down, and look up every function provided, until you had an idea what those functions and syntax do, and why didn't you make a little test script or 2 or 3 to tease them apart until you understood them, and could apply them or dismiss them? This is basically how things work in the programming world. People provide code snippets, and you have to grok what they do. And every person who has a badge here, or 1000's of posts to their credit, does this on a regular basis. In short, to write code, you also have to read code, and documentation, and there is no shortcut or substitute to that. Having communities like this one, not to mention open source itself, where anyone can get the source code to some of the most amazing software created in history, and go through it line by line, and study and tweak and experiment with it to see how it works makes software development a very rewarding field, but there is no substitute for teaching yourself what you need to know, and actively learning. You've been acting like someone tasked you to build a car, and even though you've got no education as a mechanical engineer or even a mechanic, and because you think you've arrived at the equivalent of an auto parts store, you have the right to be upset because people are telling you that you can't design and build a custom car from scratch by buying a few spare parts, and asking a couple of questions of the clerk at Pep boys. This isn't an auto parts store. This is a forum for people who ARE engineers or mechanics to talk about specific issues they are having or seek advice from the same, that is also tolerant of people who are genuinely interested hobbyists, or dedicated students. I'll wrap up with a couple of final points: -Your question would have been closed on Stack Exchange, for not being of general interest. Also Stack Exchange does not allow for a meandering thread of back and forth like this one ended up being. Don't take my word for it however. By all means try it out if you really believe for a second that people there are friendlier. -Good luck on any of the php lists. You might have had an exploratory answer or 2, but people rarely will dig in and try and help someone who is clearly floundering and out of their element. -There's other forums out there, of course. -Try ##php on Freenode, where people regularly get kickbanned for using what senior members consider to be the wrong terminology in a question. -Phpf doesn't take banning people lightly. We don't ban people for being annoying, or to exercise our ban hammers -- you have to break rules, and usually we give people a warning first. Nobody threatened to ban you, warned you, or planned to ban you, so I'm not sure why you brought that up. Web development is complex stuff, and has a lot of moving parts. The state of the art is constantly changing. Even if it was less complex, there are programming fundamentals, and if you don't have those, it's easy to get lost down the rabbit hole. The people here enjoy seeing others succeed, and you really seem to be adverse to constructive criticism, which does not bode well for you. In short, if you can't adjust your attitude, I fear that you will soon find that while people here may have wasted their time trying to get through to you, that is not a big deal. It happens every day, and comes with the territory, and everyone who answers questions here is well aware of that fact. What is sad, is seeing someone like yourself completely wasting their time because they don't know how to go about how to learn. We can facilitate learning, but we can't teach you how to learn.
  14. Well it looks likely that you have a sql injection exploit. Did you use mysql_real_escape_string() to escape all the strings you are accepting via inserts, updates and deletes? I'm guessing no. Start there.
  15. Glad you sorted it out. I was in the process of replying when I saw your update. Another way to access child elements would be: $xml = new SimpleXMLElement($xmldata); foreach ($xml->response->resData as $entry){ $namespaces = $entry->getNameSpaces(true); $domain = $entry->children($namespaces['domain']); $cds = $domain->chkData->cd; foreach ($cds as $cd) { echo "$cd->name \n"; echo "$cd->reason \n"; } }
  16. No. CKeditor is a javascript wysiwyg script. Javascript runs in the browser. You could implement code that would allow you to read in the index.html code into ckeditor, and when posting it, to save this back to the server, but the code that does that would need to be a script that exists on the server. That script would need to be written in a language that provides the ability to write the file out to the filesystem. PHP is one language among many that has this capability.
  17. You should be able to adapt my prior answer to your followup. Without a SELECT query it is obvious you are not going to have a result set to fetch.
  18. Hi Ele. This is not a difficult task, however, this forum exists to help people learn how to program. If we helped everyone who was looking for someone to program something for them, we'd be innundated with these types of requests. We do have a freelance forum where you are free to post your request, and offer barter for your design services in return.
  19. We don't know what your database schema looks like so this is just as guess, based on your insert. It appears you have a table named register_vote that gets a row inserted to indicate a user voted. If you want to then query this table and display all users: $result = mysql_query("SELECT * from register_vote"); if ($result) { while ($row = mysql_fetch_assoc($result)) { echo "{$row['name']} Voted "; } } else { // query error }
  20. The basic principle is exactly the same as what I provided you a link to. The moving parts are the jquery.post which will let you send post data to your php script that looks up the data in the database and returns the results. There are plugins like http://jqueryui.com/demos/autocomplete/ or the combo I linked you to originally that take care of a couple of issues like handling how many characters are required before the post is first sent to the server. In short this is done with javascript, and specifically you are best off using the jquery library, and applicable jquery plugins. Do you know enough javascript to use jquery? Do you understand how to use innerhtml?
  21. Please use code or php tags around your code snippets. I edited your post this time. [code=php:0]yourcode [/code]
  22. This is not encryption/decryption, you are using a series of redundant one way hashes. A hash can not be "decrypted". All you can do is accept input, perform the same hash, and then compare the generated hash with the saved hash. This is often preferred over actual encryption/decryption because a hash can not be reversed, so if your system is compromised, the user's original passwords can not be easily discovered, and if it is a good password (not based on a real word, name or phrase) it most probably can not be found out. There is a technique where people can use a large file of typical passwords and generate all the hashes, using that to compare to stored passwords. To combat this, people use a "salt" which is some additional input added to the original input that is meant to deter people who compromise the system from comparing the stored passwords to their rainbow table of precomputed hash values. Let's say your password is: 'password'. Every rainbow table is going to have already generated the hash value for 'password'. However, if a salt was used: $password = 'password'; // bad password, but users do this stupid stuff all the time $salt = 'this is a 34343really 783 good salt ok?'; $hashpw = crypt($password, $salt); The difficulty with this method is that you need to store both the password AND the salt used to generate it in your database record, so that you can duplicate the operation when it's time to accept user input and generate a hash to compare with the stored hash. Many people will do this, or use something else in the user record as the salt. In fact you could easily use the password itself as the basis for a salt: $cleanpw = crypt($pw, md5($pw)); Now to check the pw: if ($storedpw == crypt($_POST['password'], md5($_POST['password'])) { // login user } else { // display 'could not login, please check and try again' } If you use crypt as in your example, without providing a salt parameter, crypt basically implements a salt algorithmically in a manner similar to the one I showed, based on the original input, without you having to store it. There are more details on the manual page: crypt as well as some warnings about the auto-generated salt created by crypt which depends on the server environment and installed packages.
×
×
  • 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.