Jump to content
Larry Ullman's Book Forums

muuucho

Members
  • Posts

    18
  • Joined

  • Last visited

Posts posted by muuucho

  1. Thanks for your answer Larry. I am just spoiled with your other books where it is more clear. My favorite way of learning is downloding your scripts and play with them while reading the book. I actualy found your ch5 scripts and downloaded them. So now my battle to understand OOP and MVC continue. I also look back to your new "PHP Advanced.." book in order to, like you say, "hammer it home".

  2. Thanks for the reply. I understand that most of the code (or whatever you prefer to call it) might fit in i in Larrys CMS project. But since I haven't got any detaild info about the CMS yet, I am not sure what code will end up in the final result of the project. If I remove code like some suggested snippets is doing in ch5, will MY version of the CMNS project be able to work later on?

     

    Sorry but I am not familiar with yii yet, this Is why I bought this book. Also I havent clearly understand OOP yet even thoug iäve been struggeling with class Pet and other examples througout Larrys earlier books.

     

    I am a slow learner especialy from books, but when I implemented Larrys procedural CMS in his earlier books and then started to make changes myself, I learnd it, Maybe something is wrong with me, but this is the way I things.

     

    Maybe Larry could answer this?

  3. Hi Larry,

     

    In chapter 4 you started a CMS project that I am eager to learn more about. I was introduced to genereat scripts with the amazing zii module.

     

    Then, in chapter 5 you discuss various things regarding models, you also show by real world example code how it can be done.

     

    Now my question: Shall I implement all code snippets in ch5 in the scripts generated in ch4 in order to follow you towards the end of the CMS project?

     

    Maybe you could be clearer about when you show code that could/should be omplemented in the CMS projects and not.

     

    Great book, anyway!

  4. OK, I will try to take it from there. However the QuickForm2 is not covered so well in your book, you refere to forum on the web wich is fine, but I still feel that I need more real world (and more basic oop script) in order to understand oop once and for all. I think that a script that has features for new-update-delete of posts in a databasedriven table in the book had been great.

     

    I mean, thats what I try do in almost all of my small projects. When searching various forums there are comments that says that QuickForm2 is not very useful when you want to extend your forms, nor is it well documented.

     

    Maybe someone can post a basic oop-way to handle mysql-based new-update-delete issues of posts?

  5. Hi larry,

    Thanks for another great book, I bought this new addition in order to learn oop at last.

     

    However, I havn't found any part that covers databasedriven tables with add-change-delete features the oop way. Many web-based php applications is about presenting databased data in a table with abilities to add change or delete data/posts using buttons and forms. I know how how to achieve this the procedural way with validation and so on, and now I am eager to learn it the oop way.

     

    A simpel loginform is a start but forms with dropdowns, radios, checkboxes would be most apreciated to learn.

  6. Yes, I want to achieve a sticky from like Larry goes through vere nice in PHP6/mysql5 and also in the PHP5 Advanced. However in the Ecom book he is discussing putting the logic in the form process in a separate script so it can be reused several times in different applications.

     

    In a project I might have several "change posts" occasions: changing (updating) of posts in various tables that are storing stuffs like clients articles suppliers and so on.

     

    What I want to do is making a reusable function for this.

     

    In Ecom Larry is showing how to acomplish a reusable fumction for adding new posts to a table via a sticky form. What I try to descibeis the posibilies to achieve the same nice concept when you want to change an existin post.

     

    I hope this clarifies what I was trying to say from the start. If not, don't hesitate to ask specificly whats unclear.

     

    Best Regards, Muuucho

     

    I think I see what you're trying to say. You want to have an HTML table of data from a database that's organized, and when you click an "Edit" button next to an entry, another page is loaded with all the corresponding info loaded into a form for editing, right?

     

    Assuming that's what you're talking about, Larry addresses that exact thing in his PHP 6 & MySQL 5 book. He has a whole part about editing existing users, and it's pretty much like you're suggesting: Post the ID to a script for editing, which uses that ID to load the proper data into a form, and when the form is submitted all the values are checked for validity and the corresponding database entries are updated.

     

    Anyway, muuucho, to fully answer your question, you don't really need to add a function for this, because you'll want to call a separate script, which will handle any ID all the same, and since you only need to write the code once, a function isn't necessary.

     

    Does that answer your question?

  7. Hi!

     

    The idea of storing the logic in a form process is great since it's used over and over again in many (most in my case) projects.

     

    What I can't find in the book is an explanation how to use it in a "change case". Let me explain: Let's say I have a script for displaying contacts that are stored in a table in a db.

     

    The script display my contacts in my browser in a dynamic table that is based on this mysql table.

     

    The contact list only has first_name and last_name to deal with. (Let's keep it simple here)

     

    After each post I have a Change botton that passes the posts id back to the script.

    The scripts sees the id in the url and creates a sticky form, meaning it displays the posts first_name and last_name from the mysql table.

     

    I'd like to change the form_funtion in the book that it suits also this purpose (and only optionaly, since it is used only in this "change scripts")

     

    Can anyone give me some thoughts about how to achieve this?

     

    Shall I pass the first_name and last_name as some sort of optional arguments?

  8. Hi again. i've done it like this, does it seams OK in your eyes?

     

    If remember me is checked the script generates a random number to wich I add salt and then hash it. (By the way, does it do any good to security to add salt or hash it?) It's then stored as a cookie in the users browser and in a new column "cookies" in table "users".

     

    I have set the cookie to 4 weeks.

     

    If the user returns to the page within this time the loginscript look for the cookie and compares is to all values in the column in the users tables cookies. It finds a match and set the users sessiondata like when an ordinary login attempt is carried out. Also it gives a new 4 weeks to the cookie.

     

    Best Regards, muuucho

  9. Thank you both. It's fine for me to set cookie to expire after let's say 3 weeks.

    So, if you log in you'll get a cookie that expires after a while (depending on some Apache settings or some setting in a .ini-file?)

     

    A session sets a cookie in the users computer, right? Can I use the same cookie but add expiration info?

     

    Can you hint how to do if I want to add a rembember me checkbox (maybe a button is better since we do server side code?)

     

    Best regards, muuucho, Sweden

  10. Hi everybody. Anyone thinking about adding a checkbox named "Remember me" that is shown after a correct login? So that the user is automatically logged in when entering the page.

    I guess it has do something about setting a cokie on the users PC that never expires and then tell the database that this cookie shall login the user

     

    This could be convinient on sites with lower security demands.

×
×
  • Create New...