We’ve talked about Crud before, and I’m not being rude here, as we made reference to CRUD (create, read, update, delete) as a back-end task … at ASP.Net Dynamic Data Entity Framework Primer Tutorial.
Well, we’ve come to a point, with yesterday’s PHP Membership Website Primer Tutorial, where, in all fairness, we must talk about Crud again, and that is because a Membership Website is almost invariably one with a front-end component and a back-end component for our case of …
- front-end PHP/HTML/Javascript/CSS presentation of …
- back-end MySql database records
… but to extend your interest we would put to you that that “front-end” categorization could be extended to …
- front-end look for users of the website …
- front-end look for administrators of the back-end MySql database records (and the look of that front-end look for users of the website)
… and this thought may be that woahhhhhh! moment all people who just want to charge off into a job need to consider before charging off into the job.
If you are …
- not a charger
- you are a charger, but don’t want to be
- you are a charger, but want your boss to think you aren’t
- you can’t remember where you put the charger (you are not alone)
… you may consider doing a Membership Website project, if you are doing it from scratch, not based on another template or code set, to work from Crud and up.
By “Crud and up” we are not being that controversial, because it would make sense to many many many many many human beings, man, person, to design your database first, and work the rest from that. A “Crud and up” approach uses the same basic principle.
A “Crud and up” approach could be brought into the project …
- right from the starting design phase of the project, used as a tool to build up the database design … or …
- after the database design is done … or …
- after the “front-end look for users of the website” is completed to add in a website maintenance component
We came upon this great PHP product called ajaxCRUD to help here, and initially started using it for the second type of usage above, but ended up thinking it might be more useful for the first idea, though this could be influenced by a lack of expertise with its usage, just yet. As its name implies it uses Ajax techniques so that you perform database Crud operations without changing webpages.
Rest assured, ajaxCRUD is a really wonderful tool, but I did run into an issue with a field called “password” and am not sure that there isn’t something in the innards of the code that specially happens for such a field name, and which led me to believe it was best to let ajaxCRUD lead me to where the database would end up. The ajaxCRUD way is to just ask the administrator user … you … remember? … to tell it a database name, and it can do a lot of the rest .. we let it create an “example” set of tables and we worked off that … but where we went wrong was that it is better to make edits in the order …
- ajaxCRUD’s preheader.php (changes we end up with here ) … then …
- install.php (changes we end up with here ) … (or at the very least take a look at it)… before …
- example.php (changes we end up with here )
So we used ajaxCRUD on our Mac OS X MacBook Pro local MAMP web server environment to glean the MySql SQL necessary to create an ajaxCRUD friendly MySql table `ac_users` table we can then use at another rjmprogramming.com.au domain membership website arrangement as a live run here? (Hint: username=myuser password=mypassword)
We’ve done those skeletal codings for 3 pages (for this Crud arranged membership website), but the difference between the second and third is negligible (I feel a template coming on?!) …
- login.php (PHP source code login.php) is the landing page that is helped along by db_connect.php (as an include file handling the connection to the MySql database), changing from yesterday’s version as per this link, calling in the normal web flow …
- member.php (PHP source code member.php) is the page to go to after logging on, for our web application at least, calling, next, in the normal web flow …
- next.php (PHP source code next.php) is a “next” page (whose nextagain.php proposed web page was not written … but see what happens trying to go here) that is so very similar to member.php as per this link
Please feel free to augment the words of this blog posting with a view of tutorial slides of a slideshow here, and we hope it gives you ideas, especially all you “back room dudes”!
Previous relevant PHP Membership Website Primer Tutorial is shown below.
Are you after a website overseen by a membership arrangement involving usernames and passwords?
“Oh well … but how about you over there?”
“No … oh … well … but it stands to reason in our street there’s bound to be one.”
Yes, a membership website is a common sight (and site … chortle, chortle), and a common requirement on the internet. You can just display information without it, sure, but if you want interaction from a known user, then you’ll want to involve a membership website.
Today we start you off with those login basics of a username and password, and get as far as a webpage arrangement for non-login pages that acts a lot like a template … but we are not calling it this … though you can turn it into a template scenario should you wish.
Anyway, the work is in PHP, and when we started considering it with reading of these two great books …
- PHP and MySql Web Development by Luke Welling, Laura Thomson … chapter 27
- Professional PHP Programming by Jesus Castagnetto, Haeish Rawat, Sascha Schumann, Chris Scollo, Deepak Veliath … chapter 20
… we saw that there was an alternative idea to the old HTML form element POST (or perhaps GET) method idea … so that we considered both …
- HTTP 401 authorization method (with MySql database)
- HTML form POST method (with MySql database)
… and it became apparent after a while that option 2 was a lot better way to go … though the HTTP 401 authorization method could be useful, accidentally, if by some weird arrangement you are happy to allow access to a functionality by one successful login until that browser is closed (plus some perhaps?).
Okay, but let’s concentrate on option 2 because it allows for more personal control, rather than relying on Apache (web server) concepts.
With both options, actually, you can, with a simple requirement, think of (a lot of) the (core of the) job as …
- login page is the landing page and establishes user credentials
- non-login pages (even the page of the natural web flow (ie. navigation) after the login page, which we called a member page), in simplified thinking, can all start out looking very similar, with the one difference being the answer to “what is the next page called in the natural web flow?”
… so that non-login pages must be supplied a mechanism to prove that the login page (successfully negotiated) has preceeded them … look into the use of ideas such as …
- PHP $_SESSION[] variables
- form POST settings via the calling webpage
- form GET settings via the calling webpage
- web browser cookies
- perhaps the whole job can be achieved using Ajax techniques and not leaving the login webpage
… and we used the “form POST settings via the calling webpage” as our mechanism of preference.
The proof of the pudding of a reasonable working website arrangement is to type into the address bar one of the “non-login pages” and see what happens … there is a difference in thinking, for my mind between …
- navigating within the normal working web flow (ie. not using the address bar URL at any time other than to get to the “login page”)
- using the address bar URL to jump to somewhere (as we are suggesting with the test above)
… and we’ve made it with the PHP code logic that if the second method happens, they’ll be forced to login again to continue, though can see that this is a debatable behaviour, as you may wish them to be able to do this and not have to login again. One thing is for certain though, and that is that they should not have to login again with “navigating within the normal working web flow” if they have already successfully logged in, unless you introduce a timer that makes the session peter out after a certain time. We haven’t got one of these timers, here, today, but you’d probably want to use a PHP $_SESSION[] arrangement to make this happen.
So why not try the “HTML form POST method (with MySql database)” membership website arrangement as a live run at live run? (Hint: username=myuser password=mypassword)
We’ve done those skeletal codings for 3 pages, but the difference between the second and third is negligible (I feel a template coming on?!) …
- login.php (PHP source code login.php) is the landing page that is helped along by db_connect.php (as an include file handling the connection to the MySql database), calling in the normal web flow …
- member.php (PHP source code member.php) is the page to go to after logging on, for our web application at least, calling, next, in the normal web flow …
- next.php (PHP source code next.php) is a “next” page (whose nextagain.php proposed web page was not written … but see what happens trying to go here) that is so very similar to member.php as per this link
… as you may have seen, a lot of the work occurs with the membership “logging on” logic.
Of course it must be said that there are many worked through websites out there in “Open Source” land (such as on GitHub or SourceForge repositories), and you may wish to go down that route. Sometimes, though, it is good to work through issues yourself to help aid understanding, and you may want to augment the words of this blog posting with a view of tutorial slides of a slideshow here.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
I’m curious to find out what blog platform you happen to be using?
I’m experiencing some small security problems with my latest site and I’d
like to find something more safe. Do you have any suggestions?
This one is WordPress 4.1.1 … thanks for visiting.
I am regular reader, how are you everybody? This piece of writing posted at this site is actually pleasant.
An outstanding share, I just provided this onto a colleague who was doing a bit evaluation on this. And he actually purchased me breakfast since I found it for him.. smile. So let me reword that: Thnx for the treat! Even so yeah Thnkx for spending the time to debate this, I really feel strongly about it and adore reading extra on this topic. If possible, as you grow to be practical experience, would you mind updating your weblog with more particulars? Itβs incredibly helpful for me. Major thumb up for this blog place up!
There are some fascinating points in time in this article but I donβt know if I see all of them heart to heart. There is some validity but I’ll take maintain opinion till I look into it further. Good article , thanks and we want more! Added to FeedBurner as well
Hi,. can enybody please tell me other platforms that blogger, wordpress, posterous, dupral where I can make blog posts by email?. I need a list of free blog services that allow you to make your post by email..
Please let me know if you’re looking for a article author for your blog. You have some really good posts and I think I would be a good asset. If you ever want to take some of the load off, I’d love to write some material for your blog in exchange for a link back to mine. Please blast me an e-mail if interested. Thanks!|
Generally I don’t read post on blogs, but I wish to say that this write-up very forced me to check out and do it! Your writing taste has been surprised me. Thanks, very great post.
I precisely wished to thank you very much once again. I do not know the things I would’ve taken care of in the absence of those recommendations discussed by you over such subject matter. Certainly was a intimidating setting in my view, nevertheless being able to view a specialized style you dealt with it forced me to jump over gladness. I’m grateful for this information and as well , wish you know what a great job you were getting into instructing the rest via your webblog. Most probably you haven’t got to know all of us.
You need to participate in a contest for among the best blogs on the web. I will suggest this site!
Hi there, just became alert to your blog by way of Google, and found that itΓ’β¬β’s genuinely informative. I am going to watch out for brussels. IΓ’β¬β’ll be grateful if you continue this in future. Lots of people will probably be benefited from your writing. Cheers!
I gotta bookmark this web site it seems extremely valuable extremely beneficial
You made some good points there. I did a search on the topic and found most individuals will agree with your site.
It‘¦s really a cool and helpful piece of information. I am happy that you just shared this useful info with us. Please keep us informed like this. Thank you for sharing.
What a wonderful post you’ve got created. I just stopped in to tell you I really enjoyed the read and shall be dropping by from time to time from now on.
I want to show appreciation to this writer for rescuing me from this dilemma. After searching throughout the search engines and seeing recommendations that were not productive, I thought my entire life was gone. Existing devoid of the strategies to the difficulties you have sorted out by means of your entire posting is a critical case, as well as those that could have in a wrong way affected my entire career if I had not discovered your web blog. Your own understanding and kindness in dealing with all the stuff was crucial. I am not sure what I would’ve done if I hadn’t come upon such a stuff like this. It’s possible to at this moment relish my future. Thanks very much for your expert and amazing guide. I won’t hesitate to recommend your blog post to any individual who needs guide on this subject.