Jump to content

SaranacLake

Members
  • Content Count

    58
  • Joined

  • Last visited

Everything posted by SaranacLake

  1. SaranacLake

    Plans & Promos

    My website allows users to purchase various membership plans which in turn gives them varying degrees of access to content and features. I was going to create a "membership_plan" table and call it quits, but then the marketer in me stepped in and posed some interesting questions... - What happens when a given "membership_plan" has a price change? How do you keep track of that? - What happens when a given "membership_plan" has a change to its features? How d you keep track of that? I am more concerned with how do I manage evolving "membership_plans" with what has already been sold?! For example, maybe I sell @requinix a "Platinum" plan today for $50/year, but then this summer i add in free podcasts in that plan, and decide to increase the price to $70/year. I need some way to make sure that Requinix doesn't see a price increase, because he should be locked in for $50/year until the end of his term. The more i think about this the more of a mess it becomes. I suppose all of this is more of a database question, but I figured i would ask it hear since it is also a programming rpblem. I am thinking I have data entities here like: MEMBERSHP_PLAN and PROMOTION and maybe PLAN_HISTORY or PLAN_DETAILS? Looking like there is a many-to-many here, but I could use some advice on how to build this out?! Thanks!
  2. SaranacLake

    Plans & Promos

    I decided to go with a m-to-m before you posted. Similar to a textbook Orders ==> Order Details <== Products set up where you have a unit_price and a sale_price, I will do the same (as you also suggest) to allow me the ability to keep track of what price I sell a subscription at to an individual.
  3. SaranacLake

    Taking the leap to MVC

    After many, many years of struggling, I would like to finally learn how to separate my website's PRESENTATION from its LOGIC. I have been working on a startup business for over a decade now. And one of the reasons it is taking me so long to build my website from scratch is because I am a horribly INEFFICIENT PROGRAMMER!! On one hand, I think I write solid business logic. But considering that each of my scripts averages between 1,000-2,000 lines of code, that is a monster to manage. (My website is over 50,000 lines of code at this point. All home-grown and hand-coded.) While it is hard to manage things while I am actively coding, what kills me even more, is when I get pulled away for months (or recently for 2 years), and then later on when I come back, it is a nightmare to load all of that code into my brain?! I mean if you read any of my scripts starting at line 1 and going through line 1,500 I think it reads pretty well. But who in the hell can keep track of all of that in one reading? It's certainly a struggle for me!! I definitely wantto strive for more of a "component archtecture" approach. (On a side note, I have heard "good" Object-Oriented programmers claim that if a class is more than 100 lines of code then it is too long?!) So anyways.... My #1 priority for v2.0 is to learn and master separating my website's PRESENTATION from its LOGIC using something like MVC. (And after that, my goal is to finally learn and master Object-Oriented Programming, but one thing at a time!!) I want to finally learn how to program like a *professional* coder. (A very successful and RICH professional programmer!!!) 🙂 So, can all of you gurus out there, please help me get started with a solid Model-View-Controller introduction and/or resources and/or advice?? I know the Internet is littered with this topic, but like anything done well, you need to find good learning materials and at least one or two good mentors. After all, if MVC and OOP and whatever were so easy, then everyone would be doing it, and doing it well. (And of course you realize that very few people actually do things like MVC and OOP well!!) So my goal is to become a "jedi", but I will need some good teachers to get there...
  4. SaranacLake

    Taking the leap to MVC

    And your answer to my other questions?
  5. SaranacLake

    Taking the leap to MVC

    @requinix, What about you? Can you recommend some books or websites or other sources where I can learn world-class MVC development? And do you agree that my next step should be mastering MVC before OOP or other things?
  6. SaranacLake

    Taking the leap to MVC

    Is the Fowler book agnostic? Will it work for Python and Java as well as PHP? Do I already need to understand MVC or OOP prior to reading it? Also, can you recommend some exceptional books (or online resources) for learning *proper* MVC? Based on what I know, it seems that learning MVC before OOP would be the best way to go...
  7. SaranacLake

    Taking the leap to MVC

    I appreciate the offer, but just like any sane business person wouldn't post their business plans online, there is no way hell I am publishing the codebase for my business on the Internet - not even a "private" Git repository. My code *does* work, and I have a viable product, so it's not like I can't code. My objective moving forward is to reduce the time it takes to ship my code. (There is LOTS of room for improvement there!!) It's one thing to post sample code, and clearly I am willing to do that, but to "turn over the keys to the kingdom", even to Bill Gates or Steve Jobs ain't gonna happen! But I am still eager to learn and accept help from others, just not quite on those terms. I'm sure you can appreciate my stance?!
  8. SaranacLake

    Securing 'hidden' form values

    If I store a value in a hidden form control, and then use that as a means to pass the value to another PHP script, could that cause any security issues?
  9. SaranacLake

    Securing 'hidden' form values

    Okay, I see what you are saying now...
  10. SaranacLake

    Taking the leap to MVC

    @requinix, So where is a good place to start learning MVC principles? I'm sure if I Google "MVC", "MVC principles" or "MVC architecture" I will get a million hits. (And if they are anything like info on OOP, then 90% of them are garbage.) So since I don't know the "right" way to do things, then how do I know which sources are teaching me the "right" way, and which ones are taking me down a path of failure?
  11. SaranacLake

    Securing 'hidden' form values

    Why am I making things complicated? The user is on page A, then choose a membership plan in a form, and it sets a value in the session that is then used on my checkout page. Not following you...
  12. SaranacLake

    Plans & Promos

    Fair enough! Psst... I created a most excellent thread asking for help on MVC... 😉
  13. SaranacLake

    Plans & Promos

    I see your points, except for maybe the last thing... if the only thing that changes on a plan is a rate change, then should I create an entirely new (and basically identitcal) plan just for the rate increase from say $50/yr to $55/year? I could do this this... MEMBERSHIP_PLAN -|----|<- PRICING_HISTORY That way if the price goes up of down I'm covered and don't have to muck up my database with clone records. However, to your earlier point, if things like features change, then sure, create a new record in MEMBERSHIP_PLAN with a comment like "Platinum (Winter 2019)", "Platnum (Summer 2020)", etc. Yes or no?
  14. SaranacLake

    Best way to escape PHP code

    I haven't coded HTML or PHP in several years and am trying to get back into it. Seems to me that there were some nifty tricks so that when you were conctenating HTML and PHP you didn't get a birds nest. Maybe it was using something like { } but I don;t recall. I also seem to recall that wisely choosing where to use single (') and double (") quote was key! For example, how could this code be cleaner? echo '<table id="membershipPlans"> <!-- Column Groups --> <colgroup> <col id="feature">'."\r"; foreach ($plan_names as $p_id => $p_name): echo '<col id="option0'.$p_id.'">'."\r"; endforeach; echo '</colgroup>";
  15. SaranacLake

    Plans & Promos

    But doesn't that create a lot of fragmentation? Because now I have "Platinum_v01" and "Platinum_v02" and so on in my database. I was thinking something like this would be better... MEMBERSHIP_PLAN -||--------|<- PROMOS or MEMBERSHIP_PLAN -||--------|<- PLAN_HISTORY The idea being that the "Platinum" plan for the msot part is the same old "Platinum" plan, but the price will certainly change over time and maybe a few features.
  16. SaranacLake

    Best way to escape PHP code

    It sounds like what you are ultimately describing is like Model-View-Controller design, right? My entire website is built off the one script, two-parts paradigm you mention. Now, my entire website is not in one script, but for each logical part (e.g. account registration, log-in, upload photo) I have a dedicated PHP sript where the top half looks to see if the form was submitted and any other logic, and then the bottom half is basically a pass-through where i display the HTML and any needed PHP variables as you mention. Probably my #1 goal for v2.0 is to FINALLY learn how to code "like a real man" *LOL* and learn how to separate the "presentation" from the "logic", because that is why my website development now moves at a snail's pace - it's so damn hard to manage!!! This could be a thread unto itself, but since you briught it up, do you have any advice on that topic? (And should I start a new thread, or can you relabel this one, because i would *love* to get some advice on how to become a better - mor elike "smarter" - PHP developer!!)
  17. SaranacLake

    Storing images

    Is it a problem storing images in MySQL? Long ago I heard it would blow up a non-enterprose database like MySQL. Is this still a concern?/
  18. SaranacLake

    Storing images

    True. Any idea the order of magnitude when it comes to directory limitations regarding file count? My VPS is on a Linux box. Are we talking thousands or tens of thousands of images, or something dinky like 500? Basically i am trying to figure out how much time I have before it would become an issue. And since I haven't built anything like this in my code and filename scheme, what would I do when I reached a limit? I mean it's easy to say, "Well design it right the first time?!" But if I listen to every person every time that comes up, I will *never* finish this website!!! If I can just complete the ecommerce module for this site in the next month or two, i can finally go live after years of pissing around. I am hoping I have 3+ years with my current design, which should give me enough time to build a much more robust v2.0 Thoughts?
  19. SaranacLake

    Storing images

    Yes, my script does all of that much more. I guess i was asking more from a management standpoint. See that is why i am thinking that storing images in MySQL would be advantageous... Right now I just have a naked file sitting out on my Webserver, where it doesn't seem like I have much control. If it was in a database, I would have controls that restrict how images can be ADDED, DELETED, UPDATED, and there would be metadata telling me when things happened. I'm not sure if you culd argue whether backups and recovery is easier if the images are on the webserver or in a database. Anyways... I am not arguing your earlier advice, but just following up to see if there are any other controls I should add to protect things. It's one thing to have 100 product image files in a directory, and quite another to have 20,000 member rofile images in a directory?! That is what I was asking for as far as DO's and DONT's.
  20. SaranacLake

    Best way to escape PHP code

    So it looks like you leave the HTML alone and just code the PHP as the exception? (Whereas the sample I posted tried to encapsulate everything as a PHP echo. What about those magic escape characters I'm trying to remember? { } maybe? I think you use those with variables or arrays or some special place to keep your echo statements clean? Ringing any bells?
  21. SaranacLake

    Storing images

    Several years ago I built a website similar to PHPFreaks where people could build profiles, send PM's, post comments (but not in forums). For the profles I just dumped all of the files into a directory. I honestly don't remember the specifics of how I implemented things. I do recall that I spent a lot of time making sure my upload script would catch any suspicous files. When I display a profile, I think I just query my database, it looks up the filename, and then I point to the pictures directory and load up that file? My point of mentioning is all of this is since you are saying it is better to do what I have done (i.e. story images on the webserver), do you have any words of wisdom for DO's and DONT's in this scenario?
  22. SaranacLake

    Storing images

    I thought the way it worked was that you stored the *original* image locally either on your web server or in your database, and then the CDN replicated that same image across the country/globe so someone in Boston doesn't have to go to L.A. to download the image. So in that scenario, I thought the original image was in L.A. on the webserver so people like Requinix could download it, but then the person in Boston would download the image from the CDN server in Boston. Point being, by definition, you always have duplicate images (i.e. the "master", and the copies) when using a CDN. So you were talking about caching being a pain with a database, and I was like why? So you stor ethe original image in the database, and then CDN does whatever it wants to with its local copies, no?
  23. SaranacLake

    Storing images

    Looks like I asked the right person! So then what would be the advantages of storing images in MySQL? I have heard that it is easier to add/remove images, and that in general a database just does a cleaner job of storing and manipulating the image files. What do you say? ********* As far as caching goes, can't you store images in the database AND use a CDN in parallel? What do you mean as far as MIME types and byte ranges?
  24. SaranacLake

    Storing images

    Right now for my meber images I just have them stored in a directory. I don't have a CDN because I haven't went live yet. Will likely use CloudFlare - more so for privacy/protection - when I get closer to go live. As stated, I have a Virtual Provate Server. One. And one MySQL database. Small potatoes! I just think storing everything in the database would be easier. You are starting to make it sound like it can be monumental? Maybe I don't want to go down that slippery slope after all?
  25. SaranacLake

    Storing images

    So what is needed to make this a reality? First off, how exactly do you store images in MySQL? And what other considerations are there as far as the server and network setup and anything else? I do have a VPS, so I am guess that helps, but everything is on one box at this time. My immediate interest in story all thumbnails and slightly larger product images for my product catalog which is very small (e.g. 100-200 items). But down the road it would be nice to store things like member profile images whch I hope grows very very large in number as my site grows.
×

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.