Jump to content
Larry Ullman's Book Forums

Matt

Members
  • Content Count

    173
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by Matt

  1. Ah, I missed that when I was going over it! That's true! I just want to filter out strings (i.e. data types that could be dangerous). Also, couldn't I use is_array to validate that the checkbox POST data is an array? Thanks Antonio
  2. Antonio, Thank you very much! That answer was far more than I expected! I just had a quick question: Is it better to use is_int or is_numeric? I was doing research about this before and several sites said that is_numeric is better because is_int will look at a string of numbers (which is what is contained in the array) as a string and not an integer (thereby returning a false answer). What do you think? Anyway, thank you again for an awesome and well thought out answer! Matt
  3. Larry or Antonio, I haven't been on here in a while and I apologize. Been busy with work and web dev! Hartleysan and I have been working on a site and I had a question about validating checkbox data. Larry doesn't cover this in his books (no offense at all, Larry) and it is something that is new for me. What I have is a checkbox group with values that are all integers. There are two things that I want to do before storing the data in the database: 1) I want to make sure that the $_POST variable is an array. 2) I want to check that all the values in the array are integers. I
  4. Larry, I took a look at the code again this morning and I think I figured it out! As I said, only the CREATE and UPDATE functions don't work with your Flex app. and AMFPHP 2. Those are the only 2 functions which are receiving data to be inserted into the database. I thought that it was possible that AMFPHP 2 has changed from passing an ActionScript object to PHP as an associative array and now appears to pass an ActionScript object to PHP as a "generic object" (like Zend does). I changed the PHP code to reflect the changes you make to the script on page 307, uploaded it, and it work
  5. Larry, Thank you for your response! I set up the database for the chapter 9 products app on my hosted server and got AMFPHP 2 installed. When I tested the app, everything worked fine except that I could only READ and DELETE records. This was strange, and I thought I made a coding mistake, however, when I went into the browser and tested the CREATE and UPDATE functions they worked fine. Having tried everything, I then decided to install and test with AMFPHP 1.9. I set it up in about 5 minutes, changed the url in the flex app., uploaded everything and it worked perfectly (wit
  6. Hi Larry, Sorry I haven't been around here in a while. I've been working on other stuff and busy with work! I just started reading your book again and went through chapters 7 and 8. I wanted to say that the whole data services with Flex thing can be a bit overwhelming at first, how ever I think you did a fantastic job of teaching it without skipping over any important information (which other books I've seen have done). It's all making perfect sense so thank you for that! I'm on chapter 9 now and getting into RPCs with AMF. I had a couple of questions: 1) It appears that A
  7. Larry, I have been working on this chapter as well, and although I haven't ran into any trouble, I still am curious about the following: private function getDepartmentsResult(event:ResultEvent):void { departmentsList= event.result.department; } If that was the line you were referring to, it comes straight out of your book (pg. 249). Why is it not beneficial to do it this way? I would think it's better separation of code.
  8. Thank you all for the great input! @Josee - Yeah, I did something similar a while back to see what the difference between !isset() and empty() was I have never heard of ctype before. Thanks for that! Matt
  9. Larry, I am using the first example from the book as the basis for a site I'm making. I noticed that you are just using standard queries for everything (registration, login, etc...) Would it be better to replace all those with prepared statements? As you said in your books, they prevent SQL injection attacks and can have a performance increase. Would there be any disadvantages to using them? Thanks, Matt
  10. Jeg er 1 / 4 norsk, og jeg bodde i Stavanger i 6 måneder. Jeg boddesammen med venner. (I can read and write basic Norwegian, but I still use Google translate to make sure it's correct ) Yes, the name Antonio can be a bit misleading. Hartleysan told me you were Norwegian! One more question: Would it be better to use isset() in this case? I think that's what Larry uses in PHP6 and MySQL5 for Dynamic Websites: Visual Quickpro Guide. Matt
  11. Thanks Antonio! So I'm taking it that using If(!empty($_POST['contact'])) is better because it not only checks that the array key exists, but that it is set also? btw - Er du Norsk?
  12. I had another question. I was looking at the way other people have implemented checking for hidden inputs and I found that there are two ways to do it. Here is an example form: <form name="contactus" method="post"> <input type="text" name="email" /> <input type="text" name="subjet" /> <textarea name="message"></textarea> <input type="hidden" name="contact" value="1"/> <input type="submit" name="contact-submit" value="Send Email" /> </form> Some just test if the hidden input is empty in the $_POST array: if(!empty($_POST['contact'
  13. Thanks Antonio! No, I don't display the login form once the user is logged in. However, I am using the modular site design that is in Chapter 3, so everything is being processed within one page. Anytime the page is reloaded using the POST method it has a listener within conditionals to see which hidden input was sent. Also, a guest can leave a message on the page and this will require a second form as well.
  14. Larry and Josee, I see your point! I'll use the hidden inputs. Thanks, Matt
  15. Yeah, I agree, and was torn between both solutions. After doing some more research I found out that the "hidden" input method used to be the standard way to detect multiple form submissions on a page. However, the new way seems to be to use the "submit" input field. It is much cleaner and apparently all new browsers support it. According to W3Schools browser statistics, IE only has 22% of the browser market now. IE is loosing it's position big time, and it's about time. Due to these pressures, and the growing usage of competitor's browsers, I think Microsoft is finally getting their a
  16. Thanks Josee! I did some searching and found this page: http://bavotasan.com/2009/processing-multiple-forms-on-one-page-with-php/ Matt
  17. Hello all, I need to include 2 forms on one page. One will be a login form and the other will be a form for the logged in user to change his profile. The site is a modular design, so all links (including form submissions) will call the same page. The problem is this line of code which handles whether a user has submitted the login form: if ($_SERVER['REQUEST_METHOD'] == 'POST') { include ('../../includes/gallery_login.inc.php'); ... } This is fine if the user is logging in, but what if they are submitting the change profile form? Does anyone know the best way of handling thi
  18. Hello and sorry for the late reply! Jon and I did indeed "kiss" and makeup We have a tendency to get at each other sometimes, and I was in a bit of a hurry trying to get a solution when I wrote this post, so my apologies again for being over abrasive with him. @Antonio - Thanks for the help and the kind words (I get pretty unsure of myself sometimes and it's probably not a good thing)! What I ended up doing was creating a separate query as I had originally thought about. I called the result set from query one $result_1 and the result set from query two $result_2. Then I could use
  19. Really? I take the opposite to be true! The offending line was: "If that's not a viable solution, please explain why, because otherwise, I think you're the one that is wrong." You may talk to the new people in this forum that way (which I've repeatedly told you not to do), but you will not talk to me that way in a public forum! Why does everything have to be a debate with you? You sound like a 5 year old who is trying to prove to himself, and everyone else, that he is the smarter one in the class! Personally, I really don't care! I was simply asking a question and was trying to g
  20. Jon, Sorry to offend your Japanese sensitivities, but I don't know how to get small 'つ' on this keyboard! What are you, Accenture Consulting? Nowhere in my original post did I ask for you to reevaluate my query structure or redesign my site. Believe me, with an IT degree, 4+ years of PHP and MySQL experience under my belt, and having read 3 of Larry's books from cover to cover, I don' think I need you to tell me how many queries I should have on a page, nor how to rewrite them! If I do, you'll be the first one I ask (after Larry, Stuart, and Antonio, of course)! Dude, doesn't some
  21. Jon (HartlySan)... good friend of mine... I'm banging my head against the desk here! Only if you mean the "profile" page, which is the first one users see when they go to a gallery. That data could certainly all be pulled in the same query. However, you of anyone should know the layout of this, and when it comes to displaying all the images in a user's gallery, or videos, or a form to add images or videos, then entirely different queries are going to have to be used. 分た? Here is a more in depth illustration of the problem. Query to populate header: $q = "SELECT gallerie
  22. I'm not populating the nav. area with "a second query". I'm using a value from the first. (see above) I'm already doing that! HartleySan, I appreciate your trying to help, but I feel that things are getting a bit off target and I am not really in the frame of mind to start explaining myself. The problem is very straight forward. Perhaps I should have explained it better, and I do apologize. What the first query is for is simply to grab the name of a person's page (this is for the gallery site I have been working on), the name of the file used for their logo, their first name
  23. Thanks Larry and Antonio, Basically, I am using the first query to populate a user profile page (first name, last name, pic, etc...), so it will return only one record each time. The second query is based on a boolean field in the the result set of the first query. It also will return one record. The results of that record will be used before moving on to the nav. section, which will use a row count check from the first query to determine whether a link should be created or not. I talked about this with HartleySan and he suggested creating a view of all tables involved and then per
×
×
  • Create New...