Create A Perfect Blog CMS using PHP MySql PDO & Bootstrap 4 | Jazeb Akram | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Create A Perfect Blog CMS using PHP MySql PDO & Bootstrap 4

teacher avatar Jazeb Akram, Data Scientist, Web Consultant

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

69 Lessons (11h 26m)
    • 1. CMS 4.2.1 Course Promo

      15:54
    • 2. 1 Bootstrap Intruduction

      3:54
    • 3. 2 Connecting Bootstrap

      7:15
    • 4. 3 Basic Nav

      11:28
    • 5. 4 Using Icons

      3:44
    • 6. 5 Ending Navigation

      8:36
    • 7. 6 Footer

      7:08
    • 8. 7 Header

      8:01
    • 9. 9 Creating DataBase

      3:43
    • 10. 10 Creating Category Table

      5:15
    • 11. 11 Redirection

      8:05
    • 12. 12 Creating Session File

      12:32
    • 13. 13 Finalising Validation

      4:54
    • 14. 14 Date and Time

      8:30
    • 15. 16 Add New Post UI

      10:49
    • 16. 17 Fetching Categories

      8:33
    • 17. 18 Basic Validation for Post Page

      9:06
    • 18. 19 Finalizing New Post Page

      13:56
    • 19. 20 Desiging All Post Page

      6:50
    • 20. 21 Fetching All Posts

      12:48
    • 21. 22 Designing Table

      8:50
    • 22. 23 Limiting Content

      6:33
    • 23. 24 Designing Public Front end

      10:26
    • 24. 25 Showing Posts on Blog Publicaly

      14:30
    • 25. 26 Activating Search Button

      11:27
    • 26. 27 Full Post

      13:27
    • 27. 28 Edit Post Extraction

      13:18
    • 28. 29 Post Updation

      16:57
    • 29. 30 Delete Post

      8:54
    • 30. 31 Delete Image

      8:13
    • 31. 32 Designing Commenting Area

      8:04
    • 32. 33 Inserting Comment

      18:24
    • 33. 34 Creating Relation Between Tables

      9:06
    • 34. 35 Fetching Comments

      14:42
    • 35. 36 Designing Admin Registration Page

      4:28
    • 36. 37 Adding New Admin in Db

      13:38
    • 37. 38 Check Username Existance

      9:35
    • 38. 39 Designing Login Page

      10:44
    • 39. 40 Logging in

      14:02
    • 40. 41 Tracking Admin Activities

      7:38
    • 41. 42 Logout Page

      12:21
    • 42. 43 Tracking URL

      7:16
    • 43. 44 Restricting Login Page

      3:00
    • 44. 45 Comments Page

      16:15
    • 45. 46 Approve Comments

      7:48
    • 46. 47 Delete Comments

      2:21
    • 47. 48 DisApprove Comment

      5:24
    • 48. 49 Delete Existing Category

      8:25
    • 49. 50 Delete Existing Admin

      6:58
    • 50. 51 Designing Side Area of Dashboard

      6:43
    • 51. 52 Showing Insights of Blog

      9:35
    • 52. 53 Fetching Posts for Dashboard

      8:05
    • 53. 54 Enhancing Admin Experience on Comments

      16:44
    • 54. 55 Showing Comment Count on Blog Page

      6:18
    • 55. 56 Starting Pagination

      11:21
    • 56. 57 Adding Pagination Links

      12:42
    • 57. 58 Activating Current Page

      5:02
    • 58. 59 Creating Forward and Backward Buttons

      6:59
    • 59. 60 Removing Technical Glitch

      2:40
    • 60. 61 Filing Content in Side Area

      13:36
    • 61. 62 Showing Posts According to Category

      4:44
    • 62. 63 Showing Recent Posts in Side Area

      11:19
    • 63. 64 Designing My Profile Page

      9:11
    • 64. 65 Designing Right Area

      5:17
    • 65. 66 Fininshing MyProfile Page

      17:43
    • 66. 67 Designing Public Profile Page

      8:56
    • 67. 68 Adding PHP to Profile Page

      9:30
    • 68. 69 Testing

      18:43
    • 69. 70 Final Thoughts

      4:59
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

432

Students

--

Projects

About This Class

This Course will teach student how to create powerful Content Management System (CMS) with Admin Panel in PHP. 

Back End will be build using PHP and PDO Mysql whereas the front end will be created using HTML CSS and Bootstrap Framework V-4. 

In Case if the Student never worked with Bootstrap before he/she can still take this course. Because, the Course will also teach how to build attractive Front-End & Back-End Complete Application in Bootstrap. 

Note :

  • Basic PHP HTML Knowledge required.
  • No Knowledge of Bootstrap required.
  • Course will also teach Bootstrap 4 Essentials. 

Meet Your Teacher

Teacher Profile Image

Jazeb Akram

Data Scientist, Web Consultant

Teacher

Jazeb Akram is a Data Scientist and has been working as a Developer consultant. He has been working as a Freelancer since 2011. He designed various applications for many companies and also training individuals on development tools and languages. Jazeb Also has a university degree in computer science from the University of the Punjab, Pakistan, and a master's degree in Data Science from Western Sydney University, Australia.

You can read his full portfolio on his website jazebakram.com

 



See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. CMS 4.2.1 Course Promo: Hi. Welcome to this. Complete CMS scores. My name is John as a back room and all really constructor throat discourse. In this course, we will create this CMAs block. You can see this log post. We have image title off this post category. Hedman who published this post also date and time. And here you can notice the total number off comments on this post and by clicking on the read more, the user will be able tow the the full board. So this will be the full post off the cool laptop in history. And you can notice the different esteem LCS is and bootstrap styles on the content area off this post and all of the content, including images and styles, are coming from the dead hobbies and right at the end, you can see the total three comments appearing on this posed. The user can also add the comment using this form. So this post God total three comments. That's why one hour blog's main page. You can notice the three here, so this will be our blawg and you're showing total five posts on the first page off our flog and all of these balls has the same design. And at the end, off our block page, we have this pagination right here. So if I click on my second page, this is my second page off log. We have the same design here as well, and now in the imagination, we have selected the second link, and also our backward button has established. So if I click on my backward button, this is my first page, and I selected the first. So if I click on this forward button, this is my second page. And if I reached my last page off 7th 1 and if I go down to my imagination, you can notice we don't have any forward button here anymore so we could hear this complete imagination. And on my first page, I can also are the government on any off the post. So I'm going to add a comment on this cool laptop in history's off. First click on Read More. Burton. No. Here, on this post bottom area way have this form, so I'm gonna add one comment here. So giving some name, click, submit. You can see this message comments submitted successfully, and that comment will appear on this post after the Edmunds approval. So if I refresh my page and go down to the comment area, you won't be able to see that comment by Nick Water until the Advent approved that comment . So let's see our dashboard and approved art comment So this will be over. Log in page. You can notice the attractive icon on this page, so giving my user name and boss slurred. So this will be our main dashboard page and you can see regard the welcome message. Welcome, Josip from here and here are your pose off our blow. You can notice the total number off pose a bearing hair regard Total 33 post on this log. We have heat. Get the goodies. There are six people who are managing this block, and we have total 19 comments on over blawg posts. And here you can see we guard the mean area your post regarding title date and time. The daughter who created, disposed and also the number off comments according toa each post. So the green top of means disposed the cool laptop in History Guard total three approved comments and to unapproved comments which still required admin approval this avenges three post got order to approve comments. So if I click on the preview, this is My Avengers post, and you can see the total to comments here on this post This Post Guard total five approved comments and one on a pro comments If I clicked Brivio. This is my full post, and you can see the five comments appearing here. So if I go to my dashboard way, added one comment on this cool laptop in history so I can go to my commerce page by clicking on this button. Or I can navigate on different pages by using these buttons in the header area. So if I click on my approved comments tab, here is our comments page, where we have the unapproved common section and air the bottom. We have the approved comment section so we can approve the comment. We can believe this comment. We can click on the live preview Toto CD supposed there. The user added that comment. So if I approve this comment by Nick Water, click approve against you guard the message Government approved successfully, and now that comment by Nick Walter is appearing in the approved comment section I can also click on the disapprove button to divert the approval process. I can also delete this comment. I can click on The Life Review to see the back post where we have this comment. So let's click on the live preview. So this is our post off cool laptop in history. If I go down, you can see this comment by Nick Water on this post. So if I click on the Disapprove and if I refresh this page, you won't be able to see the comment by Nick Border. So let's approve this comment. And also one more thing at the time off. Edmund Approval. Our system is going to record the name off the Edmund Boys approving this comet. You can see the name Jazz back room right here. Let's see the other functionalities off the CMAs project on the dashboard page. We have the insides off our overall blawg. The hetman can click on this air deposed button toe are the new polls. You can click on this button to get a new category, use discordant toe, are the new equipment, and just returned approving comments. Then we have this supposed speech by which the Edmund can did any bulls admin can delete the post. Herman can click on the Life Preview to see the full post preview. And on this page we are also showing the panel off our post. We're showing the total number off comments. So this cool laptop in his tree postcard total four comments, which has the status off approved. And it has one unapproved goldman. So on this page off post, we're showing all off our forced main content. Then we have this categories. Page five, which Hedman can add. New category and also at the end, we have this table in which we can see the existing categories. We have this movie's category, which is created by the monthly loss 11 We have the science category, which is created by Obama. Admin off Tom. You can also delete any existing category from this page off categories. Then we have this manage at Mons Page, by which you can add new Edmund and air the end. We have this existing Hedman's Table by which we can delete any admin, and we can also track down which Edmund G. You did by whom. So let's create one Edmund So giving some user name off. Zoe Ripple T name, password. Click Publish. You can see I guard the other message. Use the name exist. Try another one. So we already have this admin Zoe Triple tree. That's why we cannot create a new argument with the same user. So if I could hear at Bundy, was a name off John 11 name, boss word. Look, publish. You can see this message. New admin with the name off. Joan Doi argued successfully. And now, in the existing Edmund stab, you can see regard this new admin, John 11 which is added by just. So if I look out and try to get into my Hedman speech, you can see I got this error message Logan required. So giving my and new admin user name John went one and password. You can see I'm on my admin speech and I guarded. Welcome message. Welcome, John Doyle. The admin can go to my profile page toe added his information. He can change his name. Headline Bio. You can also choose a picture off himself. So if I go to my vlog page and add some comment on any of the bulls For example, if I heard comment on this post off the Travel Diary 2015. A bit more so, adding one comment here by Tom Hanks. Click Submit. Comex submitted successfully. So if I go to my posts page, you can see on this salmon post the Travel Diary to regard the one red pop up here. So let's approve this comment. So if I go to my comment stab, we have this comment by Tom Hanks. Fact click on this approved button. That moment approved successfully, and it's appealing in the approved section. And also you can notice this comment approved by our new Edmund John. Doing so, we will manage each and everything on this project, and we will track down the changes made by different at Mons on this CMS project. So let me show you another features off this project. If I go to my blocked page, you can see we are showing the category off our forced. So by clicking on this category, we will be able to fetch all deposed very category is technology. So here, you can see regarding got to getting technology. Okay, Does bill it as well All the post with category off technology. And also, you can see we got this admin user name here. So this post is written by Joseph. So if I click on jazz, if I can be the bio off our admin Josip a come So if I go back and look for information off this Edmunds way, people three. So this is our Edmund Zoe Bond mescal, and this is his bile. And our admin can change this public information any time he likes by going into this my profile tab. And on this public page, if I give it some wrong user name, it does not exist in the work log, for example, the way for one to you can see a guard. The other message bag request. So we were taking off all the scenarios which will restrict the public nor to explore the security off over CMAs flow So I can click on any off the Edmund names appearing in the main area for beauty Bio off any admin. So if I click on this David M, this is my argument David Miller, and you can see his bio here. And this admin can update his information any time he likes, For example, if I look out and give it to use the name off Derek M and password and go to my profile page. So this is the profile off this admin David Billa. He can update his information any time he likes. And that information will appear on the public pages both over long. And here we also guard this live blogged tab by clicking. Hedman can see the life clog pores on the public real. So here regard this search tab by which the user can search anything. For example, if I search for happy click Oh, you can see I fashion disposed And here we have the happy So we will get here This complete search functionality never project and on the right area in which we have a different block designing techniques and here regard the categories panel By clicking, we can fetch the post with the element category. For example, if I click on this movie category, these are all the post Were the categories movies here? Yeah, and here as well. And if I click on any other category like word, these are all the post where the category is a word I can click on this fitness category. So these are all the post where the categories fitness and every single post has written by different. So after that, we guard this recent post area There we will show the descent balls on over Lord and the user can click any off the post toe, read the full post, for example. If I click on this relying on my jeez, this is over full post. So this will be our complete CMS blawg and I will not use any type off bootstrap template in this project. We'll get a year this complete project from scratch the dog using any template, and I will use bootstrap 4.2 point one, which is the latest version inside this project. And we will use B d o B. It's me that our object many deep database operations off our block. You will learn many things, including the different designing and security techniques inside the scores. And still there is many things to explore. Our whole CMS blood will be a complete, responsive one. So if I resize my browser window, you can see the local Manu is a beating here and the whole content which you can see is responsive. One and our public log page is also a responsive one. With the local menu at the top off the page, this whole CMS will have a complete, responsive design. This courses for those who already have basic knowledge off Ph. B. And for those beginners who want to learn pH be by building project. In this course, you will have all recording exercises and I will show you each and everything in complete details. So what you are waiting for, I will see you inside this school. 2. 1 Bootstrap Intruduction: no Before getting into the development process off this project, let's first learn about bootstrap if you don't know anything about. Actually, bootstrap is a framework. Now. What is Framework Framework is the combination off different things which have the functionality off different individual thing at one place. So in the bootstrap framework, it offer the styling functionality off CSS Java script and jiggery. That's why it's called Framework Bootstrap Framework. For example, if you have some Etch One heading in your ex TML file and you want to style it, then you can get this Lecter off s one. Or you can define one custom class off heading in which you can put many CSS styles, and you can link that class off heading with your Etch One toe. Have the stylish Etch One heading now with the blessings off Bootstrap. You don't have to write many classes. Four. Styling because bootstrap already have many classes, which you can use directly from the board strap and you don't have toe style or write the CSS or Js by yourself, so bootstrap. Have dozens off building classes which are going to save your time. All you have to do you have to call the class off that bootstrap, which you want toe Add in your court. No. One more great thing about bootstraps. Bootstraps is a responsive framework. It means that you don't have toe. Make your rep side responsive. You can use the board strap column grade toe, make your website responsive, and this column grid will going Toby in the classes off bootstrap as well. Normally, Bootstrap have 12 column layer, and it's different for different screen sizes. They have 12 column layout for large screens and that going to represent by Call LG 12. They have the same 12 column layout for medium screen and that going to represent body close off Call MD so they have the 12 column layout for small screen and that going to represent by bootstrap gloss off Cole S. M 12. And also they offer extra small screen, 12 column layout, which is also going to make Your rep is responsive according toa extra small screen. So these all large screen, medium screen, small skin and extra small screen are the board strap are the bootstrap responsively, or you can pick any off them and use it now, in case if you want to learn more about the bootstrap calling grid, you can find our the information on this website off. Get bootstrap dot com where you will find many examples and glasses off bootstrap, which are going toe. Help you learn about bootstrap more. I want to clarify again this nor the course off. Bootstrap. So let's move the word our next lecture. 3. 2 Connecting Bootstrap: hello in this movie will create our directory where we will add all the files off this Seamus project. So inside my C drive inside Zamfir Order, I have this as two dogs for the No. Here inside this folder, a feisty dogs. I'm gonna create one new folder with the name off CMS. And we will be using Booster of 4.2 point one version, which is currently version Esper 1st January 2000 and 19. So I'm gonna call this folder as Seamus. 4.2 point one. No, inside this folder. No hair in this CMS 4.2 point one folder. I'm gonna create one simple as female file with the name off basic dot as demo. No, Let's bring this fire in over a detour off atom. No. Here you can see we have brought over directory. I'm gonna create one folder with the name off CSS that will have the custom CSS file. And also, let's add one more folder. Not in this uses for the so I have to click on the Seamus for friend who burned one, and then I can create one new Ford over the name off images that will have all the images off the scores. And no, let's create when morph order with the name off includes that will have all the files PHP files, which we might require in different other PHP files. So this includes Ford. We will have our function file over session file and the files like that. We'll add those files later in the course. Oh, let's add one more folder with the name off upload and this folder will have our uploaded images, which our admin will add inside the post. So these are all the folders that we need Protess Project Now in this basic daughter steam L file. I'm starting with the simple basic A steamer includes I have couple of meta tax title off the document body tag and the ending off steam. L know. Let's at the bootstrap with this file off basic daughters Dimel. So here you can see I'm on this website. Get bootstrap dot com. Actually, there are three ways to install bootstrapped. The 1st 1 is using bootstrap via Syrian link, which we are gonna use in the scores. The 2nd 1 is you condone or the bootstrap files in your computer and Then you can manually connect each file video script. And the third way is by using NPM command. So if you want to download the bootstrap locally and then you want toe, connect it, you can click on this donor button, but I'm gonna go with the Syrian links. So clicking on this scared started button and here you can also see the current version of bootstrap is four point open one which we're gonna use in this course. So clicking on this get started button. And here you can see CSS Link and also the GS length, which include unified Jake reversion, proper door gs, and also the jealous gift for bootstrap. So I'm gonna copy this first CSS link and here right after the meta tag, I'm gonna add our CSS link here and no, let's copy all of these J query pooper, Georgie s and also GS for bootstrap. And let's based these ones right before the body attack. Right here. No, saving this file. Now. Make sure you put all off this Jaqui proper George s and Jascha for bootstrap, right before the ending off body tag the court that we're gonna lie, it will be here before line 13. This is because letters when someone is going to bring this file in the browser first, the browser will go through all the HTML and CSS, all of this court. And then the browser will look on these serial links to find the jail escape that we need for all of this as HTML and CSS scored. So make sure you put all of this before the ending off body tag. No, saving this file right here. I'm gonna add one each one tack. And inside this I'm gonna call Hello, Word? No. Let's bring this firing of a brother. And if I can open the console panel, you can see there is no odor at all here. Which means we have successfully connected over Bootstrap with this basic daughter schema file. No, as I told you in the last movie, boots have have many parroting classes. So let me show you the magic, often off bootstrap class, which would be display dash one. If I refresh this page, you can see this stylish hello word now seem like we have displayed ash one. We have other classes displayed as to which would be a bit small than we have display Dash three, which would be a little bit smaller than display to then we have display for and then we have display five. If I refresh this page, you can see all of this. So 1234 So it means we only have display for classes in port strap. So this is how you connect your file with the port strap And one more thing before ending this lecture, make sure you have a working Internet connection if you want to work with the Syrian link because all of these files the CSS one DJ Equity one the proper Georgie S and D Jolla skipped for bootstrap is on the Internet. So if you don't have Internet, your bootstrap is not going to work. If you are using the city yelling, so make sure you have a proper availability off Internet when you are using this Syrian link. Otherwise, you can don't know the full board strapped version and then connect it with your file. And in that case, you have tow don't Lord. The bootstrap source files 4. 3 Basic Nav: Now, in this movie, we will start working on the basic header and footer that we need in every single file later in this course. So this basic door test demo in this file, I'm gonna remove all of these headings that we added in the last movie. And no, first off all, we will start with the basic never bar. So adding the comment here. So for adding the never bar we need never Dag. And this nafta will have bootstrapped claws off. Never bar. And I want this knave Barto expand on a larger screen. That's why I added experience Dash lg. And inside this navigation, I will have on Dev with the claws off container which is also ah, bootstrap class. So basically, containing add a bit off margin at the left position and at the right. So if I show you real quick how ah, container looked like in bootstrap if I had a custom style and I give it some hide, let's say 10 p x and beg owned Toby a dead one. If I say this one and let me show you, our container is gonna look like you can see that this container have added couple off margin at left position. And also where the right position. So we will air our navigation starting from here, starting from here. That's why I added this container so that we will have a margin on the light side and also on the left side. So for the brand off our navigation, I can add one and Kurtag and this anchor tag will have Ah, bootstrap cloths off. Never bar dash brand. And for the link looks tired hash for now. And here I'm gonna add text. Toby josie backroom dot com So this will be the brand name off over website. If I saved this one and refresh my page, you can see jobs become dot com right here. You can see this does become dot com has, ah blue color do toe the link. So I'm gonna stick with divide color. So let's open this year Says for her now inside this CSS folder, I'm gonna add our file with the name off styles dart CSS Inside this file, I'm going to define that all the anchor tag must have ah, color off light. Now let's link this file with this basic door test email. So right after this bootstrap CSS ling, we will have another link. So the target will be the address inside my CSS water. Go for this styles dog CSS file. So if I refresh my page, you can see regard jobs back from dot com in the white color. So this will be our brand. Okay, so this will be the our brand inside this knave tag inside the container, we will have our unknown ordered list that will have a boards draft class off Neve Bar Dash Neff. And this list will have couple off list items. And every single list item will have a bootstrap class off. Now, dash item. And inside, every single item we will have on anchor attack that will have pash for no and a glass off Never dash link. No, let's aired this list item couple of times So copping this one and pasting it couple of times. So one, 234 56 and seven. Let's add the text for each off link. So if the first link will be my profile, the 2nd 1 will be dash board. Then we will have post then categories manage at Mons. Comments and life Blawg. No. Every single one will have a link that will take us toe profile, page dash more page or post page. So adding the expected file name. So my put a file dot PHP dashboard dark. Teach me bulls dart being to be gotta bodies dot PHP at months. Start BHP governments dog pH Me and Blawg Dark PSP and we will have pagination later in our blawg. So we will start off a block with D pages equal toe one. If you don't know anything about it right now, you don't have to worry at all because later, when we will create a pagination for over blawg, you will understand it on a flood for Don't worry about it. So let's save this while on No, Let's refresh our page. You can see all of these links here. We can add color to our navigation bar. So right here. You know where Nafta ag I can air bootstrap claws off BG dash dark that will have the black that grown to over navigation. You can see the black color, your navigation and if you will want tohave a blue bag known you can add the bootstrap class off primary that will air the blue background. If you want to add bad grown Toby Green one, you can have bootstrap class off success that will have a gain effect at the background. Similarly, you can also add jello one with deeper strapped class off warning. And also you can have a great background if you apply bootstrap class off scan DRI. So I will stick with basic color. That is, that is bt dash dark. Let's remove this red color because I just wanted to demonstrate worse divert off over container so we don't need this anymore. So I'm going to remove all of this style. Well, let's save this one and refresh my page. You can see our whole navigation looks a bit better. You can see these list items are floating at the right position so you can add a margin to the right side and you can make the margin toe auto. So right on this, um, tag, I'm gonna add margin from the right side to auto. So in bootstrap, if you want to air the margin, you can mention class off em. And if you want to air the margin toe the right. Third, you can have a class off M R. If you want to air the margin to the left, you will have a class off M l. If you want to air the margin at the top, you will have a class off empty. If you want to air the margin to the bottom, you will have a class off and be so I mean margin and be means bottom. So I will air the margin from the right side. Toby, order one So that all off A list item to floor at the left side. You can see it looks better, right? No. Right after this one ordered list, I will have one more on order list that will have a class off Nev Bar Dash Neff. And here will have list items and inside of a list item, we will have a anchor tag. So we'll have a simple list item as a low goat. So all of our list items will be here, and then we will have one logo. Burton. Right, Erda. Right position. So this one will have a dress off log out dart. BHP and its anchor tag will have a class off knave Dash link Seem what we did here. And the list item will have a class off. Never dash item. Ah, bootstrap class. So if I refresh my page now, you can see lower button right here. And as we made all off these ones door have Ah, right. Margin orto margin. So this list item will have margin left Toby, Order one so that it would floored her the left position all the time. Okay, great. No. In the next movie, we will add the icon to each list items wherever we need, and I will show you how you can add icon in latest bootstrap release. 5. 4 Using Icons: in the earlier version off bootstrap. When we have toe air the icons we used Google if icons which are not sported in latest bootstrap version. Now, instead, off cliff icons, we have formed awesome, which have a larger collection. So in order to use the phone Awesome. I'm on this outside phone. Awesome dot com slash start Here. You can see this CD in Link. So I'm gonna copy this city in link back to my Rita. No. Died at the top where we have our CSS style link for bootstrap online seven. Right before it. I'm gonna add the link, which I corporate from fort awesome dot com. And in order to use this phone Awesome. For example, if I search for user, then I can select the few tag. If you want toe use pro pro one. You can go with the pro version. So here I like this icon. So if I click on this one, you can see this simple s demo tag. Just got B this tag, and then you can simply put that I tag in your court and you will have the icon. So, for example, I want to air that user icon before my profile, so I can addict right here. So if I save this one and refresh my page, you can see regard this icon right here. Let's add a space between these icons. So no, If I refresh my beach, it looks nice. And in orderto change the color off your icon, you can add the bootstrap class. So, for example, here is this my attack. And here we have this FPs affair. Dash, use a glass so I can add the text dash success that will have a green effect on our icon. See, now I will add one more icon on this log out button. So what I need here first, Let's go to our local pretend, which is right here. So I will add the tank that will have a glass off F E S f e dash user dash times then. But sire despairs If I refresh my page, you can see the logo button here. Let's make all off this color to be that one, so I can apply the color on the this I tag or I can directly add it on our anchor tag. So next dash danger for red one refreshing my page. You can see this nice low guard burden right here so you can use different icons from this website off phone or some dot com, and there are plenty off icons you can choose from. 6. 5 Ending Navigation: Hello. In this movie we will add a toddler effect on our navigation. For example, if I make this wonder some website a smaller you can see this toddler here. And if I click on this toddler, you can see all of the list off our navigation. So we'll add the same effect on our navigation here. So back to my Anita right here, Right after our brand right before our a nordeste. I will add one Dev with the claws off collapse. So this one will have a class off, never bark laughs. And then for this day, we will have some I d. So I'm gonna call this idea. Toby Neve Bar collapse CMS! And now let's adapt all off this. All of this A northern list inside this div So adding it right after this on order list. So this one was the ending off our left side on order list. And this is the ending off over. Right side on order, Little adding the ending off our def tag here. No schooling up. As you can see, I have given it some I d. So before doing anything. If I save this one and let's refresh our page. Next scroll down. You can see on certain break point. We cannot see our navigation anymore. And we don't have the button d Barberton here. So we need to add that button by ourselves. So right here, I'm gonna add our Burton soul and start off any form type button. This button will have some class, and their class will be never Bar dash, Tobler. And then it will have ah Gela script at Riboud. So Data Dash Gogel is equal toe collapse. And then it will have on more attribute with them off data dash Target, in which we have to mention this idee that wrapped up our whole navigation items all off our on order list. So I have to mention that idea right here. So when we call that our total, it means that we are requiring some functionality from the JavaScript. File off, Bootstrap. And make sure this i d this divide e that have all off your own ordered list, including all the list items. All of these ones must match with this that our dash target. Otherwise, it won't going toe vogue. So these ones are same If I save and refreshment beach. So on certain break point, you can see we don't have anything except for this one. Course this. Yeah, we need to remove this one. And inside this Burton, we have to add one span tag that will have a glass off knave bar dash Fogler Dash icon. No saving this one. Relax the fresh over page. And also you can see regard this anger bracket before logoed. So first, let's remove this one. It started here. No schooling up. If I refresh my page again, you can see regard something here. But it's not working. Vice not working. It's because this Dave has some i d. And in order to strike on this I d. In the debt, our dash target. We have toe mention this idea and we can specify the i d buy hash symbol. That's why it wasn't working. So if I save this one and all, refresh my page. No, If I click here, you can see this doctor is working completely. Fine. But there are no lines on this one. It's because in your nafdac you have tow add one class that is never bar dash dark that will make your all of the contento darker color. So no, If I refresh the speech, you can see this cool, never icon, and you can click on this icon to view all off your never bar items. See, it's looking completely perfect to me. And as we have applied this nab our dash dog loss on our navigation. So it has also changed every single color toe darker color. So, for example, in start off their bar dash dog If I apply nab our dash primary. Let's see what's gonna happen if I refresh my beach. You can see we don't have that here anymore. So we cannot have a primary color on over navigation bar. So back to our darker color, refreshing my page you can see with this darker color. Our never Bland has a wider color. But all off, these items have a bit gray color, which means by this nab our dash dark colors. We don't need this anchor attack Toby Water one. So I'm going to remove this from here, saving this styles. DOrtiz, This file. Now we don't have anything in styles. Daughters. Here's a file anymore. So if I refresh my page, you can see everything is working completely. Fine. So this is all for our navigation bar. Now, before ending this lecture, I will add are 10 p x line at the top off this navigation and also where the bottom off this navigation so that it looks a bit more better. So back to my Arida right before this navigation bar right before this NAFDAC I will add one Dev that will have that will have a custom style. So giving it some hide or 10 p x and it's bad Good owned. Toby, this color No. If I save this one and refresh my page, you can see the school Dev, with this color, let's also for this Dev right after didn't have tank here. See, it looks better, right? And let's also add a comment Never bar. And so this is all for our navigation. Now in the next movie will work on over photo 7. 6 Footer: Now, in this movie, we will add over footer. So right here, let's air the comment. So ending the footer tank and this foot it I will have a class off Bootstrap that will be BG Dash dark and all off. Our footer will have our next off white soared. Next dash white will be bootstrapped loss. No, inside of her for her. We will have on Dev with the claws off container. And our container will have one another day with the claws off the rule. So, actually, door means occupying the whole container because bootstrap is a responsive in. So row means all off this length all of the length in any container or def. So inside this live off room, we will have on Pitak. That will have ah, bootstrap class off lead. And also, we will have all off our text to be placed in the center so you can apply the bootstrap gloss off text dash center. Similarly, you can apply the class off text, dash left or text ash. Right. So here in this p tag, I'm gonna force a team by jaws. It a crumb? No, Let's are the GOP are symbol with esteem, ill special characters and copy Semi Colon. And they're said, Oh, right, these other scene where it's gonna look like So this one is right here. So right after this deal said when each one tag for no so basic saving this one. So it's not in the center, although I told you earlier, when we use bootstrap glass off rule Road means occupying the whole young as every single draw off our webpage has 12 boards. Strap column. So, in orderto fully functional withdrawal, we have to specify the column How many columns we want out off that rope. So in our case, we want all off the column so you can mention all off 12 column like Gold Dash MD Dash 12 or Gold Dash LG dashed well, or you can simply mentioned Dave off coal. So live off call will have all the 12 column. So I'm gonna wrap up all off this inside this live off call. So developed row means occupying the whole role, and they have call means occupying the 12 column out off Dacko. So if I refresh my page now, you can see this one in the middle. So if I make this a bigger or a smaller one. You can see it's still responsive. And if I remove the coal glass from here, you won't be able to see the proper working off over column so you can mention the exact number of column. And in case, if you are sure about that, you are gonna occupy all the 12 column You can directly use this class off coal that will have all the 12 column off. Bootstrap. So right after this jazzy a crumb. I will add day here so you can air the year like this 2018 or 2019. But better is by using Jolla script eight functions so that you have a current issue. So right here, right before the boy attack, I'm gonna add one custom script. So this custom script, we'll get some I. D. So, for example, the idea will be your so dollar means out off our J quitting get the text and by using JavaScript function off, Getting a day ain't we will get the full jeer out off over Did no here. We mentioned the year in hash homemade so I could mention the i d. Here so adding the span tack And this parent, I will have I d off is your So this one will match that this year. And by using Tele skipped it will are the front yard right here. So if I refresh my BH, you can see 2019. Let's add one space between the computer symbol. So for saving your time, I'm gonna drop couple off more information here. So I added this be dug which have an anchor tag that have some building style and have this address and this great symbol. Then my website name Kurt symbol, you Demi and so on. So if I saved this one a nurse to refresh our page, you can see all of this information. So let's make it in the center so we can add a bootstrap class off text dash center to make it in the center. And let's also add when bootstrap claws off small, that will make it a bit smaller, right? It looks great. No, Lex air This guy blue line are dying off our page. So we have this death with 10 p x here. I'm gonna go Pete and basting it here. No, refreshing. My page. Looking great. 8. 7 Header: Now there is only one thing left in this basic daughter, Steam l file, and that is adding the header. So I'm going to move this heading from here and no, let's start with the comment. So for adding the Heller, adding the header tag and this header tag will have one Dev with the claws off container and it will occupy the whole 12 column. So adding dear Oh so for no alerts air the that you want bag here Basic. So if I had a fresh my page, you can see basic is starting from here. And if I inspect my page, inspect this one, this one did the H one heading. This is our whole role. So this is over complete header. This is on a roll and over Ruiz inside the container. That's why this basic is starting from him. So if I remove this container class from here, save my page, you can see this basic is no starting at extreme left. So that's why Inspector tohave a container class so refreshing my page inspecting again You can see that this one is occupying the whole the drawl. So let's this time if we delete this glass off role and refresh my page. Inspecting the page, you can see each one is occupying the whole area, not any death. So this is our container starting from here. This is over each one. That's why we add container en route. No, let's give it some backbone. So adding the class off B G Dash dark and its text Toby White freshen my page looking great . But let's add one BR tag so that we can simply separate overhead and photo for now. So if I refresh my page No, it's better. So this header is quite tiny. You can add a petting on X axis or y axes. So in bootstrap, if you want to air depending on via CSI's, you can mention bootstrap claws off be that will represent petting. So if you want to air the reading on via axes, you can have beav I. If you want to add the spreading on X axis, you can have be X P X means air, depending on both sides on right side and left side, and P vie means air depending on via axes, both on top and also on the bottom. If you want to air depending on stop, you will have PT If you want to wear depending just on bottom, you will have BB. Let me show you how it's gonna actually look like. So I will start with B vie, so provide dash three. So if I save this one and refresh my page, you can see it has added betting on top and also on the bottom. So if you want to have a larger petting, you can have people dash for so it will add petting both on the top and also NDA bottom See if I go for people Dash five c So we have padding for people. I dash five So if you just want to add a petting on the top So PT dash five so it will air depending just on the nope Similarly, you can go with being be that will air depending on bottom only bottom like this. So if you want to go over the x axis you can have p x if you want to wear depending on the right side PR on the left side Beale So here I'm gonna go with b vie are depending on both top and bottom means on y axes and give it putting off people. I dash three refreshing my page It looks perfect. Now we occupy our containing first let me show you by inspecting this page real quick. So this was over. Header, This is our heading. This is our room and out off this road this row has 12 bootstrap column for occupying all these 12 columns we can go with Just call or we can go with other way. Like gold Ash energy dashed well for larger screen Cordish MD dashed will for mediums high screen Cordish sm dash well for smaller screens. So right here inside this room, I'm gonna add deal with the claws off call dash MD dash Well, and I'm gonna wrap up my heading with this. Dev No last thing. I will add one phone. Awesome icon before this h one. So back to my data. So right here If you want to have a larger phone. Awesome. Before your text just mentioned inside the one back. So I have this photo, some text dash hide. So if I save this one and refresh my peach, you can see this phone tossem text height. You can also change the color off your fort. Awesome. So you can apply tax dash success or text dash danger class on your phone. Awesome. Or you can at the custom style or custom color. So, for example, if you want tohave some if you want to air some random color so you can add it by applying the style and then you can go for color property and then you can mention your color. So if I refresh my page now, see no one changing color. So instead, off this you can mention here your local, uh so it will air the color to your Icahn like this. So as we are following the sky blue color So I will go with this sky blue. So this is it for our basic website structure. This will be our header. This will be our navigation throughout the project and this probity foot. Now, in the next movie, we will work on our actual core off this course that is creating dynamic pages by using PHP . So, first off, all we will work on over category speech 10. 9 Creating DataBase: Hello. In this movie we will create over database and and connect our database with descript. So let's bring our Zam Pierre starting my skill clicking on the Erdman for Peter Mayer German. Now click on this new Britain in the left panel. Give your database name so I will go with CMS 4.2 point one. Click on Create Better Career database. That's it. No. The other part of creating table. We will create our table one by one throughout our project. So we created the start of a CMS 4.2 point one. So let's create our database for so inside my includes for the I'm gonna create one new file. Did the name off db dot b It's me inside. My includes Order said OK, so starting my PHP tag. So I will have this variable connecting Debbie that will create our be deal in which we will mention the para meters off our database. So in the first perimeter, we have to mention which PDO layer we want to use. So I will go with Maya skill and our host will be local host. Then we have to mention our database, which we just created, So db name will be equal toe CMS 4.2 point one which we just created and all of this would be in a single court. And we have to Addison Michael order. Now all of this that we also far waas the first perimeter. So in the second perimeter, you have to mention your user name off database as I don't have any account associated with my database. So I will go with the default one, which are the route will be my user name off my database. And then I have toe put the password in the next perimeter. I don't have any password on this database default database off route, so it will be empty. String? No. Make sure that you don't add any space between db name and equal. Otherwise it won't going toe work. We created our database, and also we connected over database. Now, all of this part that you see here the first perimeter, we call it the S and Data source network, So I'm gonna cut it from here. And instead I will write when variable online, too. D s n and Noel export dark string here adding semicolon here so in the first parameter. No, I can simply mention this DS in so mentioning DS in here. That's it. So we successfully connected this db dot PHP file with our database off CMAs 4.2 point one , which don't have any password. And using the default database root account? No. Whenever we have toe work with our database, we can simply grab disconnecting db variable that has all the information off connection to over that of is, and we can use this variable toe, insert our data and database or fresh data from the database. 11. 10 Creating Category Table: Let's create our table off category. So in the previous movie, we created this database off CMAs four point to burn one. So first click on this CMS database, and then you have to specify the name off your table, so I will create our table with the name off category that will have four columns. You can also increase or decrease the number of column later if you like, but I think we will have only four columns in our table off category. So click on this Coburn. No, In the first column that you see here, you have to specify the name off your column for each item. So our first column will be our I. D. And it's time will be in. It means it will have only numbers. There won't be any characters in our I D. And in the length column, I will specify its length would be upto 10 numbers. So, in case if we have length more than 10 numbers, our debt out won't be able to make it to our database. And in most of the cases, we will not have that many ideas in our table, so it would be fine in the next column that do you have to focus? Is this Index one. So click on this index Select Primary King. So this prime Mickey will help us toe update our category later or delete over category. So by making it primary were saying toward that, I waste that this I D column would be unique. There won't be any duplicate entries in the I. D column. Click on Go Now here you can see Auto Implemented. So also take this order and commit because will not add the i. D. Manually by ourselves. We will make it automatic so that whenever some category entered in our table off category , it will have automated i d. The next item is name off the category, or you can call it title, so I will call it title and it's type would be watcher. So it will have numbers and also characters as well. And the length off over category would be limited to, let's say, 15 characters only, and you don't have toe mark anymore. Column From here, the third column will be the water off our category in the person who is getting getting this category via CMAs and your style would be virtual as well. And author name. Let's make it upto 50. Great, because I think we'll be fine. The last column will be date and time the time and did then our daughter is going toe career this category so specifying over date and time. Here it's type would be water as well, and it will be upto 50 correct process will. You can also change the title of category more than 50. It's completely up to you, but I will stick with only 51. No, we have made this table and if I just click on this say, Burton. Now we have created this table off category and also all off the Ghanem name I d title author Date and time are in the lower form. Also the name off this table categories in the low farm. So be sure when you are creating your table that which type of style you are choosing because if you are not sure or mentioned the wrong, call them name in your script later it won't going toe enter the data in the database. So now we created this category table So back to my Evita now in order to work with this table. First off, all we have to bring this database tower script. We already created a connection in this file off David or PSP in the previous movie. So now we can simply include this file in Catalyst or PHP and we can use this connecting DB variable the work the databases so no in categories dot PHP file first, starting one PHP school that will require this db dot ph me so I'm using the function required underscored ones that will require this debate or PHP file one time. So this file is inside. This includes Hola. So first mentioned, this includes further than go for Devi dart PHP file and semi colon right here. So now we included this file off David or PHP. It means that we can use this connecting devi variable no in categories dot PHP file to insert over data in our database. And also we can fetch our data from our database later 12. 11 Redirection: let me walk you through how it's going to work. So our admin will pour some title in this input field off category title, for example, the report technology as, ah, category name. And then he will click on this publish button. So we have to consider two things. 1st 1 will be the category title that admin is putting on this import feel. And the 2nd 1 is this publish better. So we will get this technology text. Then admin will click on this publish Porter, and then we will take that text and save it in our table off category. Know how we can get this publish button? Let me show you how so. Back to my Anita, I have to go to my main area where I have that pertinent. So you can see that I'm in the main area online 67 and online 88. You can see this publish Burton. That is inside my fault. My former, starting from 1971 lives ending at the line off 19 3 So I will get this publish Britain by its name, and it has the name off submit. So I will say on top inside one PHP script that if my admin click on that button off published so I can translate this into one PHP function that is is set. So I will say, if my button off publish is said and they're button, I can get that button by a super global off post. So if that button which has the name off submit it's said, then you should perform all off this court. We'll make sure that this submit must match the name that you had given to your But you can see I have given it a name off S u B m i t. And here I have the same one s u b m I t submit. So no, I mean this condition. If this person is set, then we will take this text out off this fear so we can get this text by same method off super global off post. So hair If I can show you real quick that here is this input field and this input field has the name off title, I can make it get agree title so that you can clearly see So now we have to take this name this input field. So I will say here one variable that will be get the goodie that will be equal toe one super global off boast in which we will have that category title So now we saved this post category title inside this got to get a reliable category variable. So now, first off, all before entering this category title in my database and writing cuties toe do that. I will apply some basic validation on this category title so that we can sanitize our debt up before and drink it Indoor databases. So right here I will say it. If Edmund leave this feel empathy, they don't. And there's the M pretty data in the database, so I can translate it into em. Pretty function off PHP. So I will say, if this get a goody variable that has this input field is empty, then you should show admin some error message and say that all fears must be fared. Oh, so we can show this message are a clean former Fenella, but better approaches by using session. So after showing this error, we can simply redirect or you can say district over Advent, Toby On the same page off categories dot PHP So I really find one function that we can call any time whenever we need. So I'm gonna create a new file with the name off functions Dark BSB. And this file will also be in my includes for the starting when PHP tag and let's get a year dysfunction that will have a name off redirect underscore to So this function takes one argument as the location where we want, Oh, redirect our Edmund or user. And inside this function we will make our header goto this location and we will concocting nated with this new location that we're gonna define him and then we will simply exit this function. So this is just a simply direct function. Very simple. We will take some argument and this argument will have some name. So it will have a name of categories dot PHP or db dot PHP where we want toe the direct our user and we need to going here. So let's see if this fine and now we need to include this functions are petrified in order to use this for so right here Online to I will include this file. This file is in inside include solar and its name is function Start Beat me So we'll show this error message and restrict our admin toe Stay on the same page. So we will say goto this category dot PHP So it's get agrees dot PHP So I have to mention the correct one here. So the idea is this is very simple validation. Then this input feature will be empty. We will run this simple veneration check. If you have this empathy, fear, then show this Enter message and the direct our admin toe this categories door PHP pitch and also be included. This file which means we can simply use any function or any variable from this functions or PP fun and here in functions dot PHP file. We have this method that will take the VEB address as an argument and then it will direct our brother toe Goto dislocation and it will exit No. Here you can see I have just in police show Better inform off error which is not good in the next movie will create one session form that will help us toe cario These other message back and forth on any page 13. 12 Creating Session File: sessions are the great We're toe carry data from one page to another. When you give credentials at any websites such as your log in today's emails and prospers, then that website you session toe, take your email and password and send it to database. There the database validated those email and possible and send it back to you. Inform off, enter or success. So in this project will use sessions for the communication off data and we will show our other message and success message by using session. So here I showed you this at her message. Now we will define one mechanism to show these others in more efficient way. So I would get here to a new file the D name off sessions dog be it be and this file will be inside. My includes Hola. No starting this file with the PHP school. So, first of all, we have to start over session and we can start over session by this function Session underscored starred. So no week started our session. No, we can define success message and enter message function. So first I will start with error message so I will have this function with the name off at her message. And inside this function we will check whether our intercession, it's that or not. So I will say, if this editor message so in orderto make this error message as a session, I have to put Super global off session around this enter. So let me make this one as another message. So I will say that if this error message off session is set so I can ported here if this session off at her message is set means if you find this at her message, then you should show this error message. So I will have one variable with the name off. Hard put that will have one string. Let's put it in form of our Dev so that they will have board strap glass off alert. And the alert I'm gonna show will be a large dash danger for the red color and then the ending off this death. And as you can notice, I'm using double court inside of Al Gore. So I have to escape this double court and also we need ending off our class double court here, and we also have to escape this one as well this will be the starting off our Dave. Then on the next line, we will Khunkitti Nate, this variable with our actual session message. So whenever you are showing some data or or putting, some data must apply this function off esteem entities so that you won't break any single STM. Oh, Syntex. So we will showed that at her message here. And then we will get initiated with Dean ending off. Oh, were did we use this? Dart concurred in here. So actually, this report is our complete one Variable. I divided in three lines. If you want to do this way, you can do this way. Or you can write all of this in a one line. And then after showing this error message, we have toe clear our session, Tono, so that it should not be visible. Terrible user all the time we will clear the accession message off better and we can clear it by Equalling it with no And at last we will return our this output. So by this error message function, we were take some error message and in case if it is set, we will apply the dangerous class to have a red background and we will apply this team and entities function on this session every message so that we don't break any estimate. And here we are setting it equal to know so that at the beginning, off browsing this category start PHP page. First time we won't have this any other message and we will done the orphan. Now same way we define this error message. We can also have one success message that will follow the same syntax. So in start off calling this error, we will call it success message. So it will take some argument in form of our success. And instead of having dangerous closet, will have learned dot success glass for ah, green bag known. And also we have to mention the success here and then we have toe mentioned our success. Yeah, there's it. So we could hear two decisions dot PHP fun. Now we can simply include this sessions or tpp file here so I can require this file off sessions start being me. So we have the simple one vegetation check. If this field off category is submitted without putting anything, we will show this error message that will go to the Sessions file and bring this error message off Alert Day engine and show us that message. And then, by using this redirect function off this functions dot PHP file will simply redirect over user to the same page off categories or PSP. Let's test this simple meditation check. So in orderto check this PSB, we have to refresh this page to Lord the PSP. So if I before typing anything, if I click on this publish button, you can see there is nothing happening here. It's because, as you can notice, these editor message and success message are two functions and in orderto have some enter message. We have to call these functions in our categories. Door Ph. Me five. We can call these function in our categories Doris Ph before. So it's like scroll down to my main area, my main idiots starting from here and here you can see the form. So just before the form, I will have on BHP school in which we will call these boo functions off error message and success message. So as both off these functions are your turning something so we can call these functions by ICO statement So ever message function A water success message function well, saving this one. If I refresh my page will bring the be it me. So if I click on this publish button now you can see nothing is happening Which means this person is not working. So we have to look on this person. So back to my data we have toe go to this person You can see there This Britain is here on 9105 It has the name off submit, but it's type is better. So in order to make this one work, it's type should be submit. So saving this one? No, If I refresh my page to bring all the HTML and PHP and before entering anything here If I click on this accomplishment now, you can see this error message with the alert, danger background And in case if I air something here, click on publish. I don't have any other message. And also let me show you If I change this session at her message toe success message, I will have the greenback room so refreshing the page. If I click on this publish, you can see nothing is happening. So we have to make sure that this success message is also correct. So this one has spelling off s U Double CEO Douglas. So super global off session here as you single. See? So I have to mention double c. Sorry about that. Oh, here. You can see this one. God, the ball. See Devil s double to you, Douglas. So now if I refresh my page, you can see this green message here, so as this one would be and a message, So I'm gonna change it back at her message. So if I freshman piece down click on this publish button, you can see this red message. All fields must be furloughed. And one more thing before ending this lecture, you can notice online nine in sessions dot PHP file I made It will be No. So if I commend this line and just bring this categories dot PHP page and click publish, you can see this message. And if I refresh my page, you will still see this red Error message. Although I refreshed my page. So that's why I added this line nine so that whenever we see some error message, it won't be visible after a next page refresh. So Darcy purpose off adding this error message to know after showing the better and everlasting make sure you call these functions here inside your father him. Otherwise you won't be ableto see these error message in the previous CMS scores. I have been getting so many questions about this problem that I'm not able to see my error message or success message. It was just because off not calling these functions which you defined in sessions dot ps before. 14. 13 Finalising Validation: in this movie, we will finalize our basic relegation so same as we did here. We wrapped up this validation inside one if conditions. So for reading next to a relation, I can simply add one else. If block in which I will say if this category title is less than two characters, we will show user some enter message doctor category title should be greater than two characters, so let's do that. So in orderto find the length off this category, we can use string length function off PHP str Elian and we will put our category inside this function. So if the lent off this category is less than to, then we will show you the error message so I can simply copy the session and redirection from here and put it right here. And no, let's change this message toe category title should be greater than two characters, and we will redirect our user two categories or PSP life. I see this one and that's the first. Refresh your page to bring the PHP new PSB. And if I just add one collector here like our publish, you can see I'm getting this at a category title should bigger than two directors. So if I aren't just two characters here publish, I'm not seeing the other message. So let's make it. If this category title is less than three characters, then it would not accept title with two characters. So first off, all that saved this one and refreshing the page to bring the new PSP. And if I adhere to characters, we are seeing this ever message, so same what we did here. We can also specify the upper limit so I can copy this whole else if block and based it right here. And this time, If the length off category is greater than 49 characters, then we will say category should B 50 characters The reason why I choose this 49? Let me show you what. At the time of creating this table of category, we specified that our titles will have 50 corrector length. So in case if we send length more than 50 characters from over script our that I won't be going toe enter in the database and we will not be a there. The reason vie over data is not entering in the database. That's why I add this simple validation to district our admin nor to add category title more than 50 characters. So this is it for basically tradition. I'm not going to add 49 characters inside this field in order to show you whether this one is going to work or not. That's it for these basic validation. So if we don't have any problem with these simple degradation, if of a car ticket writer is not empty, our string length is not less than three or excreted, and 49 will have finally one else block debt will have duty toe insert our category title in our database. But if I can show you real quick in this table, we got author and date in time. So we are getting the title out off this field. But what about the author? So, as we are in the beginning off this course so we don't have any registration system for no . So just for no, I will add one dummy autor that will be equal to this variable admin, and I will equal it with one string off Josip. Later, when we will dwell off a registration system off Edmund, Registration, we will are the Edmond Naim dynamically toe over table off category. So for now, let's just stick with this default. Josip name. Now we do have a more field left that estate on time, so let's learn about date and time in PHP. Deal quick in the next movie. 15. 14 Date and Time: in PHP. You have to use date and time when you are doing stuff. For example, you are adding some category in your table off category and you also want toe tracked down the date and time. At that moment, you can do that by using date and time. PHP functions well. There are a couple off things which you can use toe create date and time in PSP. First off, all PHP offer you one simple function off time that always return you the current time in second. So if I add one variable off could learned time, hear an echo this variable saving this for non regardless file of their time dot PHP You can see this is the current time in seconds, although it's the relative time, but we cannot read it well, that is the place where you can use couple off PHP. Other functions toe read This time, so be it. We have one function off. Str f time means string. Former time. You can call it so I'm gonna add one more variable off date time and when I quit with the function off str f time, that is the function off PHP and dysfunction will have to perimeter in the first perimeter . We are going to see it in the moment and in the second perimeter you have toe past the current time in second means you have to pass this variable off current time. Now, in the first perimeter, you have toe past the perimeter as in the way you want to get your time. So here I have opened this official website off PSP dot net slash men well slash in slash function dot day dot PSP. But you can use a couple off things to create date and time. Although it's a very broad topic off pH. Me. But I'm going toe cover the essentials that gonna help you to create your own date and time . So, in case if you want to add the daito 01 toe 31 you can add de inform off string in this perimeter with the percentage sign and in case if you want toe show the day as Monday or Sunday. You can use this Dean capital form. You can use this jato denote your day, Toby 1 to 31. And here a couple off. Others form it as well. You can use capital. Why toe Have the full year toe 1999. 2000 and three like that. Or you can use the small wire to use just the ending off your two numbers off year, and you can also use this small M toe ad. You're month from 01 to 12 and in case if you want to use the month in the corrector form, you can use this capital M toe. Have the geN Through December and seem like the dates. You can also use the time for mitt as well. If you want to use the time as an AM or PM, you can use small A or you can use capital a toe. Have the AM and PM in the upper form. You can use the 24 hour for made by using capital Etch or Laurette with 12 over. Form it so you can pick any off the order, which you want. There are a couple off things available and also in the forum. You can also see some off the information about a question and answer so this website is very helpful. But remember that the date and time are very broad topic off PSP, so you have to learn it if you want to be a good developer. So now back to my editor. So in the first perimeter, off this function off str f time I'm going toe Add first off all these year and I can add the year by using capital of I and I have to put percent a sign with capital. Why then I can use the person page m for month. Then I can use the percentage small D for date and then I can use percentage Capital edge for ours percent age capital M for minutes and percentage s four seconds. No, this is all so No, If I record this date and time saving this one ordered, you can see 2017 months five and the day two days 17 as well. But we're getting some problem and you will see if you are going toe code it by yourself that the time is not right. Because if I can show you what the time is in my computer, you can see it's a lemon 36 b m. And the date is right. But here we're getting 2035 p m means 8:35 p.m. So this one is not right. It's just because this one is getting the time off this zam server. So in case if you want to use your own computer time, you have to use the one PHP function that is going toe. Define the date and time off PHP according toa your time soon. So here is this one more link PHP dot net slash manual slash en slash time zones dot PHP where you can see couple off time zones as I'm in issue. So I have to select the issue. And now in Isha, I have toe find our the time zone for my country's. So my time Zoom is Karachi and that is right here issue slash crunchy so I can use this time zone toe make this time correct one. So back to my editor before anything I can use one function off date underscore default Underscore time Zune underscores Set in which I have toe pass my time zone and that is issue slash Karachi. So no saving this one out If I refresh this page No Now you can see the time is correct. 1 23 38 And this is the correct time, according to my computer. No, no, This former that we used so far is the former tall fescue all if you want to apply some SQL functions on your date and time, this is the former. But let's make our time much more understandable as we're not going to apply any Haskell function or date and time. So let's make it more readable. So I'm gonna paste it one more time. Let's comment this one from here and ah, changing the percent age Vier Toby percentage be. And in PSP Date, you can find out information about be so changing device for being for the month and then insert off percentage em. I'm gonna add small d right here and air. Then I'm gonna air Dijon and for the rest off the things that quite good. So sitting this one out if I refresh this piece now, you can see the time is still the same but the order off our port exchange. So we guard this May 17 2000 and 17 to be dead and this is our current time in my computer . So in case if you want to use the AM or PM notation. You can find out the percentage scored on this website off PHP, and you can make your own time. So I'm gonna stick with this time in the whole project. 17. 16 Add New Post UI: now the same way we added our category in our table. We are going to do the same thing for adding Ah, complete block post in our table. So first off, all we have to design the you I off adding post in our table. So this page off categories dot PHP I can save this file ass Ah, new opposed dark beer to be so now we will change this file toe our new poll. So first off, all, let's not focus on the PSP. First, we will focus on the design off this page. So all of this would be the same all links etcetera. So instead, off manage categories, it would be a new post in the header section and then going toe demain area. And in the main area, you can see we have this title air new category, so I will make it air new post the card rest of the thing would be the same. So here you can see we just have only one field for adding the category, so I will make it toe Bost title. Then let's copy this whole one and paste it right after it. And also we have to change it toe posed. The second field will be Jules category and instead off our input field, we will have one select field that will fetch all the categories here from our table off category. So for now, as this lecture will be focused on the U. S. So I will have simple one select the D bootstrap glass off form control and it's I d would be category title. So we have toe put this one hair for here as well, and its name will be category title as well. All. Instead, you can just make it category. Let's make it category. Then, for this select, we will have couple off option. For now, I will have a couple off Kropp est option. We'll put all the categories here later. But for now, just adding 123 and then we have to close our slicked back. No. First, let's save this one and see this one in brother. So going toward directory Rose in this file, our new post you can see this are being post here. So we have this field post title than choose category 123 And this one looks ugly, right? Because we already have this air new post title here, so let's not add this guard header. So back to my leader, I'm gonna believe this. Div off guard header from line 1172119 No, let's check this one. It's better, Right? So after this div off category, we will have one del that will have bootstrap class off form group and inside this day we will have a label. So this time it will be for image and here text will be select image. Then we will have one input field video type off file because we will select some image so it's type should be filed and the name off this import field will be image. And for i d. It will be image select. Let's equal this image slicked hair as well in start off, just image. So now alerts refresh our page to see what looked like. So this is not very attractive. So you can make this one attractive by just adding one more div with the bootstrap glass. Or that's true that so hair on this in port I will have one div the d bootstrap glass off custom dash file and let's portable whole input field inside this one. No saving this one. Let's refresh reputational. So it's on the next line, but it's not still not that good. So we added one David the custom file, but we did not added custom file class on this input field. So we have to specify von class on this import tag, and that class will be custom dash file dash input. Next, the fresh repeats. No. So if I just click here, you can see I can still select some image. Put your snore showing. It's because I added this bootstrapped loss and this support strapped loss also need label associated with that custom file class. So right on the next line I will have on label, and this label will be for this in the select. And for the class, it will be custom dash file dash label. There's also a bootstrapped loss, and here you have to specify some text level. Specify this select image text here. No, let's refresh your page. No, you can see this select image, and if I select some image like this one, you can see right after selecting this image this field has gone blue. You can notice the blue correct its border. And also, if you hold your most, you can also see the name of tart image three D paper door to cheap, Easy. So although we do have our label duplication here as well, you can see regard this first simple label office demon And then we have this label, the Deport strip close. So let's combine both off these ones. We can combine both off these ones if we like. I think if we already have the select image next here inside the field, we don't have toe ride this label at the top. So I'm gonna delete this one. This one looks a clip. So saving this one refreshing over page. Good. So after selecting other image, we'll have one last div off heading off a post text. So right after this image, Dev, we will have another day with the bootstrapped loss or form grope. So for the label, let's copy some label from here and it will be just bost. It will be four boast. Let me make sure that whether we give that label toe something else or not. Okay, so the post title has the level of title, so it would be fine if we give it a label off just post. So right on the next line we will have one text area which name will be boast? Let's also make sure whether we have given this name for this title field or not. So this title field has three name off post title, so we can have this name toe posed description and these rows and columns are the minimum range off over post. So let's first stick with these default ones. And on this text area, we will apply the A glass or form control. And for the i d excited would be forced as well seem as level. Okay, saving this one looks a fresh ever page. So here you can see the post area. So this select image in post looks quiet close. So I will add the margin bottom on this select image death. So back to my Rita Here is this still so I Willard MB dash one. So if I refresh my page see, nights looks perfect. So this is it for designing this air New post page in the next movie will vote on the PSP part off air deposed dark PHP file 18. 17 Fetching Categories: in this movie will create our table off posts. So opening PHP environment clicking on or database first and then click on this new Burton to create a new table. So we're table name will be post and we will have seven column You never posed. So as we have four column here, so that's hard. Three more column So the first column will be i d. In The second column will be our date and time. The third column will be our post title, so it will be title. The next column will be Get a body. Then we will have column off water. Then we will have our image column. So so image. And at last we will have opposed content. Call them so I will have just I called him with the name off boast so I d will be Intertype . Then every single thing will be vulture. The length off idea will be 10. Date and time will be 15. Title will be 300 category will be 15 then autumn name will be 50 years. Well in his name will be up to 50 and post will be upto 1000 characters. The first column off Heidi will be or to implemented. And also we will put the primary key on it. And that's it. So, no, we have toe save the structure. So click on the save button. So no clicking on the structure tab. This is over, table off poster and you can see all of these Colon's so back to my editor. No, this file off air New Post will develop BH being to grab the content out off these feels. But first off, all you can see this div off Jews category in which for now I put the option tag off 123 So in start off showing these 123 I will show the actual category that we have in the table off category here. So here in this select bag and start off these options, I'm going to remove all of these options and we will fetch our actual categories from over table off categories. So we need one PSP scope here. So first we will grab our connection Variable connecting d being first. Let me start with the comment here. So you will have on SQL. So select Starik means select all the columns off my table. So from my table off category and on the next line we will have one variable with the name off. SD empty debt will grab over connection off database, inform off object and will call the PDO method off Q T And we have to bass this SQL here on the next line. We have to fetch our results so we can fetch a reserves with Divi loop. So this while loop will fetch every single category. So I will have on variable with the name off data rose and that variable will treat this s t empty as an object and call the PDO method off Fetch No. Here we will define our variable that will store the dessert that we're getting from over database. So I will only take two column from over table off category. As you can see here in category table, we have four columns. I will only get two columns idea entitle. So I will have this variable hiding that will be equal toe This data does and out off tax data rose I have to specify the column name that I want to get. So the first column that I want to get Is this I d So mentioning this idea in lower form and the second column that I have want to get here Is this title all in Lawful. So I will have this another variable with the name off, get a green name. So out off that fetch statement, we will get our column off title all in lower for so this title and I d should match with these ones. Otherwise it won't going toe work. And in start off selecting all the columns you can just like two columns I D and title Or you can just select idea column. It's completely up to you. So I'm just fetching two columns from here. And then I have to put these ones in the form off option tack. So here you can see this Ph. Me school. So I will have on option tag that will have one PHP scope in which we will simply echo this category name this one So putting it here. So no, If I refresh my Peter and save this file first, refreshing this page. If I click on this category, you can see what you have. Just only one category of sports so sports category ing is Earth and ducks off. Four. Why we're not seeing these three categories. It's because the ending off my loop So this while loop ending is inside the PHP scope. That's why you only see one category. So if you want to see all of the categories you have toe cut this. Why loop ending from here? And you have to put that Why loop ending after the option tag so that it will I trade every single category name so I can put this violent ending here. But I must put this vile opening inside one PHP scope. So putting it here inside one PHP school. So if I save this one and just refresh my beach collecting on this tab off tools category, you can see No. We have fetched all the categories from over table off category. So that's how we fetch our reserves in PDO by using the method off Curie. No, In the next movie, we will work on other part off this file and that is putting all the enter data in our table off paused, which we just created 19. 18 Basic Validation for Post Page: So it's timeto put all off our data in over, table off, post out of this air New Post or Ph before, So I'm gonna scroll up. So we have all these includes online 123 And then when the user clicks on our submit Britain, we will get every single thing by using super global off post. So the first super global off forced will get the title off over post. So if I scroll down toe my foam here, you can see that this form has the action attribute off categories. So first off, all I have to change this toe. Add new boast dark ph me. The method will be posed as well, but this time this form will have one more argument and that is adding the ink type attribute. So this ink type will help us to get the image and save the image in other desired directory. Because we have one field off, image this field off select image, so we can only work with this feel if we add additional argument inside of a form and that is ink type. So I have to define this ink type and it will be Marty part slash form dash data. So I added just distinct types toe handle the images. So after doing that, you can see regard this first if in which we have this input field that has the name off post title. So in order to grab this poster till we have to copy this name off this field, you know, let's scroll up to the top. So we will have this variable post title and we grab that one with the name of forced title . Then then let's see your other variables. So after ever post title, we have this Jews category that has the name off captivity. So grabbing this name off Carter getting scrolling up, I will have disagreeable Carter getting putting that Got a goodie here. Let's indented orbit. Then we have this select image feared so scrolling down the image field here you can see this image field that has the name off image so grabbing this one scrolling up. So here on the next line, I will have this variable with the name off image, and we cannot use the post super global hair because its image type. So we have to use another super global that is called files. So I will use this other super global off fires that will take care off our image that has in him off image. And one more thing. We cannot save our whole image directly inside hours database. We just saved the name off our image in our database and we save the actual physical image somewhere in our directory. So we will save our image in the folder off up floors and in the database. We will just save the name off other image. So out off the super global or files off image, I will just grab the name off my image. So this one will have the argument off name to grab the name off image that the user is going toe upload. So after that, we have to pick care off another field, and that is last one off this boat. So first scrolling down to the tech stadium. So here is this live off post and it has the name off forced description. So copying its name, no scrolling up. So I will have this video bubble Bost decks. So, by using super global off post, I can put it here Okay, then we will have what, Edmund default when Josip and our date and time by using this date and time function. So we grabbed every single field. But as I told you, that we save only image name in our database and I saved the image name by using the super global off files. But I have to specify some directory where I will save my actual image. So here, online nine, I will have another variable. With the name off target and act variable. We'll have the location off our image so you can see this applauds folder. We will a Plourde all off over images inside this folder off upload. So I will have this a Plourde for their hair. And then inside my upload folder, we will save over images. So we have toe save this image name that we got here. So I will apply dysfunction off based name that will take this whole file images as an argument. So I will put it right here and semi Colon Erda. And so this target image will move our image later. Toe this location off a Plourde with one function that we will define later. So then here you can see online 16. We have basic validation. So I will apply this basic relation on our post title. So here I will say that if my Bost title is empathy than you should say, Title can't be empty and redirect toe the same paid off air New poll start PSP. And in case if the title length is less than five, we will say that both title should be greater than five directors and we will redirect it toe and new ball start BHP. And in case if the post description means this text area is greater than 1000 characters because inside this feels like me show your structure off this post table. You can see that disposed has the structure off 1000 length. So I will say here in my court that in case if my boast next is good, it'd then 999 we will say Bost description should be less than 1000 characters. So when we don't have any problem with all off these renovations, we will goto this else block So we will have uncurious toe insert our forced inside our database when everything is fine. So now we will change all off this insert gored According to this post table in the next movie 20. 19 Finalizing New Post Page: So let's right this insert uto add data in our table off post. So first off, all that's changed all off the Z direction toe the same paid off earning post. So Air Newport here and then in the success message here and in the other message. Hip sitting, this one. No, you have to focus on this block from Line 27 to line 34. So first SQL insert in tow instead. Off category, we will insert in our table off boast alerts confirmed this planning off this table in that is posed in lower form. Then we will have a couple of column, the first columnist date and time. So putting date and time at the beginning, The next column is titled We Already Have Title. Then we have got a green so putting category are third, then we have column off water. It's already there. Then we have column off image. So putting it here, then we have column off post. So putting arda and hit. So now we have to specify the named perimeter for each column, so the first column will be their time. So putting it at the beginning here, then we will have the title column for our paused so defining it here as an opposed title. As I told you before, it will be a dummy name so you can put any type off text here. So post title will be 2nd 1 then the category. So we already have category name here. So then we have water. We have Edmund name here. Then we have image, so we will have image name then At last, we will have our boast, so I will call it posed description. After that, we will prepare this whole SQL and then we will bind the value. We already bind this category name toe this variable off category. So let's confirmed this category variable. So scrolling down to the teach me report the category name inside category the Edmund name will be admin. The date and time will be date and time variable. But let's do all of this in a complete right sequence, according toa our named perimeter. So the date and time will be at the beginning, although the order does not matter. But I think it will be easy for you to look if all of this in a sequence so 1st 1 will be the date and time. Then we will have second SD empty. That will bind this both title and we need call in here also. We need colon at the beginning, off data in time. So the variable that we need to put here will be posed. Title this video able. Then we will have captivity. Name we already door docked one admin name and then we will have over image name. So our image name is saved inside this variable off image this'll one online it so we can mention simply this variable off image here. Then we have posed description. So copping all of this and paste it here for forced description. And the post description has the variable off bossed text supporting that variable here. So now saving this one looks to move unnecessary lines from here. So after that, we will execute our whole statement and then we will show the statement with a success message or at our message. So if I save this one and first, let's refresh our page to lure the new PHP. So I will say here first boast and choosing my category toe fitness. So selecting some image from my folder off downloads. So I was like this three door GPD image. If I hope it on this tab, you can see three door deputy and in the post description, I will prepare something like this is testing boost. So if I click on this publish button, you can see I guard this message category vid i d 100 successfully. So I need Toe Jane this title. So let's danger to post with I D or something. So we added this one. So first, let's check by clicking on first this table and then clicking on the broads tab, you can see the name off my mystery door deputy, the auto name, the category fitness, next date and time and the post description. So if I open my uploads further So here is my applause for the inside my Seamus four point open one. But there is no image hair at all. It's because we wrote all of this script do and the data in our database. And I told you earlier we cannot save our whole image in our database. We can just simply save the name off image that would didn't Here you can see the name off her image. Three door deputy. So, in orderto save your image, you have to save it. Toe other directory here. If I can show you real quick, I have this variable off target online nine very specified. The location where we will save our image. But we have toe move our image from its source toe its destination. So this will be the destination off her image. Very well. Save over image. But we have to use another function. Don't pick our image from Downloads folder and save it to this upload folder. So ride inside this else block right After executing this whole beauty this whole one, I will have one simple PHP function off. Move under school uploaded underscore file and dysfunction will take our image by using the super global off files. And our image has the name off image. And then we have two special five on Mawr thing here. That will be the MP underscore name. Actually, whenever PHP will a Plourde some file, it will give that fire some temporary name and it will be different than the actual file name. And PSP will only remember the final name with this Hans turned off the MP underscore name . So inside this function off move uploaded file. I'm saying here, toe PHP that by using the super global off files, take this image, which has some temporary name given by you given by PHP. So in the first argument, we will specify this one and the second argument. We have to specify the location. So we already wrote the location Informer for Target variable. Here are the top online nine. So it will take our whole image and put it in the target location. That's it. No, if I see if this script and first let's refresh our page. So heading second boast selecting Summit Ridge, for example, this any mission Dart gpt and bost off second clicking publish button you can see post with idea to weather successfully. So here you can also see the second post name off her image. But we have to make sure that they'll be applauded in the folder off a Plourde or not. So but this is my applauds Fuller. It's still empty, so this up floors for there is empty, so we have to find out worse t error. So back to my data here is this function. Move, underscore Uploaded under school file. Then we specified the temp rating Name going straight hair. And then we have the target here. So we have to check whether this target is okay or not. So scrolling up hair, I said goto this a Plourde fuller. And here we have applauds. So I have to add the s hair because this folder name is applauds, not upload. Then we will have Bs name Underscore files image her name. So if I save this one, a nurse to refresh the page ending Third post this image off esteem All five seasons Three door deputy boast title forced description will be third post dummy. Publish Well structured successfully. Here, you can see the third post. Let's check it off. Upload folder. Congratulations. We finally made our script toe a Plourde defile in our directory off uploads. And here is this image. So this is how we enter our images. Now let me walk you through everything. What I have done in this file off air New Post. So it's very simple file. First, I grabbed every single field by super global off post, but for the image I used this super global off files that take our file that has the name off image. And I saved the whole image name inside this image video ball. As I said, we cannot save our me directly in our database. We can just save the name off image. Then we have this post text which we grabbed out off the field off post description we have Edmund and date and time. We have these simple validation. If Post title is emptying, if length is less than five or greater than 9 99 we will show user some error. Otherwise, we will ride this insert statement that will put all off over data in our table off posts. After that, we executed over curing and move our uploaded file from its source destination where PHP is holding that file in the super global of fires Foodie destination where we want to save that file and dad location. Is this a Plourde? For the then we are showing the success message and our message. Now lost comments for this lecture is make sure that you add one additional argument inside your form and that is adding this ink type two multi part slash form dash data in orderto process your images and also we are putting our category dynamically. We are fetching all the categories from over table off category. So that's how we process images and data. And we saved them in our database in BHP by using video. 21. 20 Desiging All Post Page: in this movie, we will design one simple page that will show us all the existing blawg posts. So back to my Anita closing this air New Post or PSB file And also this daytime dot ps before also db dot PHP five Let's bring this basic daughter s team a file. No, I'm gonna save this vile as post dot being me. And first off, all changing its title from basic boom blawg both and for awesome, which I'm gonna use will be affair dash block F A s effort dash block. So first, let's save this file and bring this file in our data. So going to my directory here is this file of post brought PHP here you can see this block post speech. So right after this block post, I will have cup alof links here so that we can navigate toe different pages categories or our new post more a city and more attractively So going to this block post death here, you can see inside this header We have this div off call MD 12 and after that, I will have on mawr death that will have bootstrapped loss off core dash LG Dash three. And inside this Steve, I will have on anchor attack that will have a glass off beating in BD en dash prime me. So, actually, we are creating couple off Burton's here, so it will have bt and dash block class as well. And here inside this we will have our I tag that will have formed awesome claws off half A S f a dash and it and for the text, it will be at New post. So let's first check this. Do what it's going to look like refreshing my page. You can see this our new post button right here, so seem like this with the last couple off more Spartan. So I'm gonna copy this whole Dev off call algae dash three and basting it for there you cattle body. And for the fourth awesome, I will go with affairs affair dash for the dash plus And for the color, it will be in full. And for the link it will be categories dot PHP. And also, let's mentioned the link here on Neil forced dark PSP saving this one. Let's check it and browser No, let's add when more Burton. So it will have a glass off warning and we will have this tab off Air New Hedman that will have phoned awesome class off affairs F you dash user dash Plus And the link will be Edmunds dog Ph b. So saving this one checking in Broza. Great. The next one will be for our comments. So I will have the text off approve comments here and we'll have a class off success. The address will be governments dart PHP and photo. Some plus will be affairs f your dash check saving this one layer. Soudan Broza. It's looking cool, right? So if I move them no small container, you can see these ones are responsive. But at a certain break point, you can see all of them are sticking together. So every Laird margin bottom to each one. So let's share the margin. Barton. First on this death can be dashed to and they're doing it here, here and him. So MB dash toe saving this one, refreshing the page. Just looking Perfect. Right? So what's complete? Responsive? No, this is all for designing over header. No, We have to fetch every single post from over table off post in the main area. But first, let's change this title document toe post. So here at the top, changing this document to both and no schooling down. So let's fetch all off over post in our next movie and we will put all off her post in the main area right after the header in the next movie, so see you there. 22. 21 Fetching All Posts: Welcome back. Now in this movie really develop the main area for this post dot PHP where we will fetch all the entries from over table off posts. So back to my Aditya here I have this file off post door PHP. So right after their our head is ending. You can see this be our time forced. Oh, for removing this PR tag. So I was started the comment. So in the main area, we will have one section that will have bootstrapped loss off container. Let's give it some betting on why access toe to and some margin bottom off. Four. No, inside this section, let me a couple of spaces. Okay, so inside this section, we will have one div that will have bootstrap blast off grow and then inside of a road. If we will have another day that will have bootstrapped loss off called dash LG dash. Whoa! So we are occupying 12 column, all of the 12 column out off over container. So here we will show over. All off post informer for table. So I will have this table attack that will have couple off column. So the column will be inside the tr attack. So we'll have couple off columns in our table so that when you add a couple off the edge tag where the headings So the first heading will be the number one. The 2nd 1 will be the title off over post. Next one will be over category. Then we will have our date and time, so date and time here then we will have our daughter. Then we will have our banner. So inside this banner, we will show the image off over opposed. Then we will have comments, then action if you want. Oh, update the post or delete a post. And at last we will have a live preview to see the full blood post. No, this is it. 40 yard table heading. After that, we will have P D tag in which we will show all off over posts. So So we will show over post by calling our table off posts. So here I will add one PHP scope in which we will write our curie, so first grabbing my connection off database. So, in orderto grab this connection, I have to include all the files, including session, database and function far so I'm gonna open this air New post on deck scoping the headers 123 From here and paste it inside this post door Peace Be fun right at the top, saving this one scrolling down. So no, here I can called actually able connecting db as a global scope Because in case if someone off you are using PHP 5.6, they can still work. So after that, we will have on simple at school that will be select static. Select static means select all the columns from my table off bulls And then on the next line we'll have this variable s t empty that will call this connecting db connection, inform off object and call the method off duty and inside the security we have to pause over SQL. And then we can simply fetch our table. So inside this why love, We will have on variable with the name off de Toro's that will go through each one by using this object off S t empty. That will call this mattered off. Fetch No, inside this while loop will have couple off variable. So the first variable will be i d. The 2nd 1 will be our date and time. Then we will have variable that the name off title or you can call it Bulls title. Then we will have variable within him off. Get a getting. Then we will have one variable with the name off Hedman, then image, then our post. Next, let's indented a bit. So for grabbing this I d. We have to love it. Data rose and then we have to go inside this column off I d which has I ending in the lower form supporting I nd the lower form. Then for date and time, we have to go through data Rose were to go through debt or was not a true So let's make it totals also here. So we'll go with date and time all in the lower form, same as this one. Then we'll go with title, then go to the knee both her than image and at last post. So, after fetching every single thing, we have to go outside the PHP school and we will have won t r that will have couple off TDs . So adding, do you do Dag total nine times. So for the first TV, we will have our hash as a serial number for the second TD Here you can see we have our title than category. So I will put when PHP school in which I will put this title. So this title is saved inside this boss title variable. Then the 3rd 1 will be over category. So putting this category that we fished here Skopje this one and based it couple of times so that we have PSP back. So 3rd 1 was get a goody and then we have daytime than authored and banner. So the time, well, her Benner and received banner as image. So it will be image and it's start off water. It will be Edmund because we saved Did you die in the form off Edmund So Edmund hair And after the banner off image, we will have garments. So for the comments, insert off putting some PHP, I will add just a simple text comments. Then you can see we have this action. So for the action, let's stick with the action for no without any thing else. And for the live preview, we will have a simple text in de live but evil. So saving this one So I have faced all off the get off out off this table off post and saved every single thing inside these variables. No basic purpose Off this page off post door pH is having one page where you can have different links who added or delete or see the life review off your page is not ah, blood page for a public. This is admin page, so we don't have to show every single content. That's why I will not show the post text inside him. So first, let's save this one and I'm gonna refresh my page. Toby Gard this at a post title. Unexpected online 113 So we have to see a record. I have to add something. So this is lying. 113 post writer and online One month to I missed the damn Summer Cola. So be careful with these semi colons alter times. So saving this file no alerts professional page from one more time so you can see that we're not ableto fetch of results. Why is that? It's because we are just putting these variables inside over Tedy Tak. We're not Equalling. These variables are so in order to see your are put huge. Must call your variables. So it called disposed title also echoed this category. It go my date and time I got this one. It go my image. So if I refresh my page and all, now you can see we guard the text and only it's showing us the text off one post. So this esteem and five CSS three door jpg is this third post. So we are seeing only one post. It's because as a mentioned in our air new post or PHP file where we finished all the categories, I told you where their time If you put your while loop ending here inside that be it the school where you are extracting your data, you will be able to see just one record. And in order to see every single record you have toe, I create your while loop for every single item. So you have to put the ending off your while loop just before the ending off your table here in a PHP scope because we can ride over pH being in a PHP scope. So I will put the ending hair life. I saved this one and refresh my page. You know, you can see all of these post, so make sure that you put the ending off your while loop after every single TD just before the ending off your table in order to see your whole table. No, you can see that this whole table looks quite ugly. So I'm gonna design this whole table in our next lecture by using board strap glasses. 23. 22 Designing Table: So let's design this table with Bootstrap. So back to my data here where we have this table tag online. 94 I will apply the bootstrap class on this table, and that is table for this PR. This whole PR will be table head. So I will have this d had back that will have the board strip class off, be head dash dark. And let's wrap up all off this PR that this d had supporting it here right after the ending off PR. Then we will have over PHP. And here you can see the TR for table data. So this one will go inside one tag off body. So adding the ending off Peabody here. No sitting, this one, there's the fresh over page. So now you can see very attractive table. The next part is I will apply them or class on this table, Dag. And that is table dash stripped. So if I save this one and refresh my page now, you can see this grape grown toe these table data, I can also apply one more tablecloths. That is table dash over. So if I refresh my page now, you can see this whole effect on each off the field. And also, if you want to change the color off your table data, you can apply a glass off bootstrap on any off the items. So, for example, you can apply a glass off people dash danger on your table, that item off post title. So if I refresh this page, you can see that this one guard red background you can apply the glass off table dash primary on this airman one. So that column will have a blue background. But I have a lot applied these colors. I just wanted to show you If you want to do that, you can applied these colored glasses. Well, as you can notice hair on this hash symbol, I'm just showing the high symbol what I want to show here. A sequence from one to so on. So I will have on variable Here s our serial number, and that variable will be equal toe zero by default. And inside this, why look after extracting one single item, I will in agreement in this video, so s on will be plus plus. So then inside my table, that item I can just simply are this BHP school and I can. It echoed this s are So for the first time, it will be zero. But in the while loop, it will be one here. So we will show Von Ness are for the first time and then so on. So for a freshman page, you can see 123 here. Now, here in this action tab that you see right here, I will add buttons off, edit or delete. So let's do that. So here you can see this action table data, so I will add the button. Here we will have one anchor tag that will have address off hash for now and inside here we will have one span tag that will have bootstrapped loss off beauty and beauty in dash warning. And for the text it will be edit and ending goes to spend. So let's save this one and refresh your page So we will have this 100 Porton. Let's also add one delete So hoping this one and adding this anchor so it will have dangerous class and its name will be delete refreshing of a beach. And then we will have this person off life preview so we'll have one anchor tag here that will be life review, and it will have a class off prime eating. So saving this one fleshing of her page. Now you can see this life preview button here. And as in the field off banner were just Equalling the name off over image, which is not good. So instead, we will show a smaller image hair. So for showing image, we need Hamish tag. So here where we are showing this echo image, I will add one image tag here, and that image tag will have some location. And that location will be goto this applauds folder because our images saved inside this folder off applauds. So we have to say goto this applause for their Then look for this image by Equalling the image name and we can give it some written height. So putting all of this inside the double court off source and davit, I'm gonna give it victor off 1 70 p x. Let's save this one and refresh your page. You can see this image right here because at the time, and we added these images over move, upload function was not working. That's also or just its height as well. So I will give it some height off. 15 bx urging the court a court here. So we very fresh my page. See, It's look perfect. So now I'm gonna delete all of the's post from here, and I will add complete posts with a complete title so that you can see all of those posts here. So going to this air New Post, which so every lad couple of dummy post here selecting some category, selecting some image, basting some text, random text publish putting characters. Morton 1000. You can see a guard. This outer boroughs description should be less than 1000 characters making it right. Publish poster. Dude, let me a couple of posts here. So I added couple off pose in my table. Now let's see these posts. So going toe my page off. Bulls dark pH. Me, you can see a have a couple of post here, and these bulls look ugly, right? Because at the time, and we have a bit more text, it's putting my text in a second line decks. Wife's collapsing my edit and delete button in another line. So, in order to make these buttons in a single line. I can apply when str function on this text would restrict how many characters I want to show on this pitch. 24. 23 Limiting Content: you can see a have a couple of post here and these bulls look ugly, right? Because at the time and we have a bit more text, it's putting my text in a second line decks Wife's collapsing my edit and delete button. So in order to make these Britain's in a single line, I can apply when str function on this text to restrict how many characters I want to show on this pitch. So back to my reader, as you can notice, I have a problem with this title, so I will goto my Bulls title and here I will say that if the length off my title is greater than 20 soul, I can map out with if condition. So right inside this TD, I will have another Ph. B school and I will say if my Bost title is good, it'd than 20 so I can put it all inside this condition and applying. Str Elian string length function on this post title refers greater than 20. Then make this poster title to show me only first 15 directors and I can restrict this by one simple function off sub str in which I have to pass this boast title and in the second perimeter, I will specify that. Show me from the zero Index toe 15 and semi column here. So basically, I'm saying here, if the length off my post title is getting, then 20 then make my post title toe have only 0 to 15 directors, so zero will be the beginning. First corrector and 15 will be 15 corrector. So on the next line, I'm just equaling this one. So instead, off having another PSP scope, I can remove this one from here, and let's also remove this one. So it's looking all right. So if I save this one on refresh my page, you can see we are only showing 1st 15 characters. Let's make it 20. So I will say, Show me from 0 to 20 characters. It was refreshing my page, but we can see this 20th index just all so instead, we can put dot, dot, dot toe indicate that it's still continue. But we are showing only first 20 characters so I can put Door Door Dart here with this suggest er so I will concur ordinated with the string off, dot dot So if I save this one and refresh my page. You can see No, we have dot dot here and we still have the problem here. I think we have toe make this up only you're doing one. If I refresh my page or its looks perfect Right now we tackle this problem off. Having more characters now will do the same thing for the other ones as well. The next check will be own our admin name. So I will apply that Jack here. So if the string length off my admin is greater than six, just show me Edmund letter from 0 to 6. So putting the admin hair and also make my ironman this one. So if I refresh my page, there is no effect because jazz it just have five directors. Then we will do the same thing for this get to getting. If my category length is greater than, let's say eight characters, then make my category. Show me only from zero to it Corrector only. So we're saving this one refreshing my page. So now you can see their technologies showing technolo and then dot dot So we'll do the same thing for our date as well. So back to my leader. We have to go to the tables. That of you we have that did The date is right here. So we will say, if string length off our date and time is greater than 11. Then show me my date and time. Only first 11 characters from zero to 11. So we felt fresh. My page. You can see No, everything is completely perfect. So this page is basically for editing, undulating over posts. That's why this information is no Arthur element. Because Urban can check the complete description off these balls by clicking on this life review that we will enable later inside this course. So let me in, Dent. All off this. CDs. So this is it for this file. See you in the next movie. 25. 24 Designing Public Front end: in this section, we will design the public view off other block. So I'm gonna bring my basic daughter CML file and let's save this violas, blawg dart BHP No. First of all, let's bring this file in our editors So refreshing My directory. It is this five long dark PHP No, our file off blogged or PHP. As I said before, it will be a public file. So we have to adjust our Manuela. So I'm going to remove this my profile dashboard link and changed these links to more related to public view. And also we need to delete this logo Britain. So back to my editor going first toe this title making it oh, log Bage. Then let's go to our anchors. So the 1st 1 waas this my profile. We don't need this my profiling more And then we have this dashboard I'm gonna make it home . And for the link it will be just, let's say blawg dot PHP Then we will have about us. The link will be hash, just hash, then long, dark pH me and the link name will be long as well. Then we will have a contact us page. These are just to fill out our main menu. So contact us cash features hash here and then let's remove this one. So in our right side on order list, I will have ah form. So this form will have action attributes off blawg dot PHP because literally, when we will have this search tab in our block, we will add the same PHP for searching over blawg on this page of blogged or PP. So respect her toe. Have this section attribute here and for method. Let's not focus on the method for no. And then inside this form, we will have an input field with the type off text, and its name will be third and looks air the place holder. So search here. Let's make a type here because we will have the button off search. So this whole input field inside div off form group, you know, input field will have a class off form dash control and right after over input field, we will have one button with the claws off beating n bt and dash primary. And for the text, it will have a text off search for the name. It will be search Burton if I save this one and let's refresh this page off, blogged or PHP so you can see regard these links here and this one looks quite ugly. So in start off having type here, I will make it such here and make this problem go. So Nico will be here and type here in start will surged ahead. So both off them are on the next line. So I will make them in line with the bootstrap gloss off form in line on our form bag. So adding the bootstrap class or form in line saving this one refreshing. My page looks better. They are both sticking together so I can add margin right to mine put field. So here, in this fear, I will m r dash. So if I refresh, my page looks better. So if I see for a different screen view these ones here, if I go the smaller view you can see that this one is okay at this break point. And if I goto the small at some screen view like this, this one is collapsing. So we can still are just eight and by adding couple of port strip classes. But I will make this search taft toe not tow appear. Then we are using smaller screen toe access This blow Oppose. So right in this form I will add more strapped loss off display none and display on smaller screen as block. So if I save this one and now, if I refresh my page, you will not see the form in the smaller screen. See? No. At a certain smaller break point, our form will disappear. So we will have form with us like all the times. But when we will go to the smaller view, we will have just over menu. So they're sit for designing this mean area. Know Lex air the basics for our main area right after our neighbor. And we have this header. So I'm gonna delete all of this header tags from here and insert. We will have our day off bootstrapped loss off container and inside here we will have another div in divorce, trapped class off role. And then we will have another deal. The divorce trapped class off goal Dash and Sam dash here. So I'm dividing my whole screen in tow views So the first day will have the main area content with the eight column on smaller screens. And then we will have the just four column forever side 80 off over block. Inside this room, we'll have another deal that will take the dressed off the four column on smaller screens. So call sm Dash for Alexe for better demonstration and style. Quit so I will give it some minimum height off. 40 b x and background will be rent. Let's also give the same things for our main area so that you can better see. So if I saved this one and refresh my page, you can see we have the whole red one. But there is no other color. Why is that? I have to change the color. So let's make this second color toe a green one. Well, you can see this will be the main area, and then this will be over side area. You can also make your second side area to take a three column. So if I saved this one, refresh my page. But now we have one column left here so I can add offset glass right off. Recall a sum it and, let's say, off sect dash as him Dash one so that we will have one column in the middle. So it has added the column here, stirred There's take it from here and put it right before Cola. Sam Dash three If I had a freshman Bees No, Now you can see we have this one column here, three columns here and rest of the eight column here. But I will go with call as I'm here for the main area and call a Sam Dash for for the side idea. So now this will be our main area. So other start my main et of it one, Etch one tag. So right here. First, let's air the comment here. No, Inside our main area, we will have one heading, and then we will have another restaurant. So saving this one, refreshing My page Start. Now, let's remove this red background first and also the minimum hired. This one is quite close to overhead er, so I'm gonna add the margin top to toe the whole role so that we can shift it up it downward. So empty dash for Martin here. And for the second heading, I will air bootstrap class off lead. So we're saving this one refreshing my page. No, it looks better. You can also see the margin from the top. So this will be the basic design off public view. Off or block. Now, in the next movie, we will extract our blawg post on this page off blogger dot PHP. 26. 25 Showing Posts on Blog Publicaly: So let's fetch our posts from over that abyss. So right inside this main area, I'm gonna add BHP School and first off, all we need our connection to the database or adding connecting. Do you be variable? And we don't have the header DB file function finance session file included in this blog's or ph me. So in order to work with db dot PHP file, we need to require this debate or petrified. So I'm gonna open my posts dark PHP. And let's copy all of these 100 from here closing this one. Let's put them at the beginning off this page. So now we have included this debate RPS refile, which means began easy to work with that file content. So defining this one as on global, in case if you are using be it before I burnt six version. After that, I will have on ask UAL statement so select static from my table off boasts. Then on the next line, we will have this variable off esteem empty that will grab our data base connection and called the method off beauty which is beauty and bossing over s girl hit. After that, we will have our while. So I will have this variable de datos that will use ste empty object and call the method off fetch. Then we will have our variables. So let's bring first the structure off our table. So here I have this post table, so I will fetch every single column off this table. So the first column here is you can see this post i d. So I will have this variable the name off Bulls I D Dr Will fetch the column off over i d from over table. Then we will have really able off the time that will fetch our column off their time, all in lower form. Then we will have our column off title Bulls title putting title in the lower form. Same as my database. Get going here. Author, Immigrant post After fetching or post. No, it's time to show your post right here. I will show my post by using cards so adding Dave with the bootstrapped lost off guard and there will be no card harder. No, Right inside this card, we will have our Dave off guard dash party and I will start with the guard title. I'm not adding the card had done here. So I will have on h four tag the D Bootstrap class off guard dash title. And here I will have on PHP scope, in which I will echo my forced title in orderto seem opposed Title. Then after my card title, I will show the date and time. I'm gonna have the small attack so I can say get it done. By then I can put my Edmund name in the BHP scope. And right after this one right after my Edmund name, I will have the dare so written by this admin on this date. So cool did time. Then I will have an hr tag. And at last we will have one Be dag in which we will show over paused description. No saving this one. So if I refresh my page, you can see this. And also you can see this one Look quite nice Editing by Josip on the street and time You can skip this time by limiting the characters. It's completely up to you Or you can choose your own former toe, make it nicer, or you can have two separate column. One will be for date and one will be for time. And you can just simply show the date column here, nor the time it's completely up to you how you want. Organize your quarterly. Just want to show you board date and time at one place. That's why I was using the same one column on this text. I will apply the bootstrap gloss off guard ash text, and then you can see we have this small tank. I will apply an underclass off. Bootstrap, that is text dash muted. So if I refresh my page, no, you can see it looks a bit great, which is good, right? So we're not showing of image. So right after the guard class, right before card body, I will show my image. So adding the I am G tag. So for its location, go to my uploads further and then look for this image in a PHP scope. So it go image and we have to put all this inaudible court. So if I save this one looks a freshman page, this image, if I make this one on a smaller screen, you can see there. This one looks ugly, so I will apply the bootstrapped losses on this image, so giving a bootstrapped loss off I am G dash fluid. So make this image responsive and I can apply one more class off guard dash stop, so make it appear on the top. So if I had a freshman beach, this one looks responsive. So it's possible that this image waas occluded according to divert and height off our block . But there will be some cases when we have a larger image. So in that case we can add a style off maximum height 4 15 p x. And you can also define the minimum hired for your image. So saving this one refreshing my page. So it's already fit. That's why we don't have to worry. So you can see this guard is very beautiful. And after that, after one information that this was written by a jazzy on January, this one you can see we have this text. So I will. I heard the badge right there decide for the comments as we have not covered over common section inside the scores. So for no, I will just add the comments text that we will fare later inside this course. So right after this smaller tank. I'm gonna add the span tack that have the text off gourmands. 20 and let's make it float at the right position. So adding the style floored right, Refreshing. My page can see this text here. Let's also apply. Somebody tripped class off badge. Refreshing my babies. No. So commerce 20 guard this badge. You can make the color off badge red, green or blue so it will be bad. Dash dark for the darker color C. And also, let's apply the bootstrap class off text ash light on it. So after this next, we will have one Burton. So right after this be tag, I will add one anchor tank that will take our user. So this full forced dart PHP, where the user can add the comment on that post and also see the full post. Let's make it appear in the right so floored Toby right one and earning one span tack with the bootstrap glass off Bt in BD and Dash in full. And for the text, I will have this Britain read more and adding these angler backer two times. So if I save this one and let's refresh my page, you can see this retreat More button. So basic purpose Off this button toe have some Burton where the user can see the full post . So if we have another pay to see the full post, we don't have to show the whole text here so we can limit the content off this text by adding the sub str function. So right in this spirit periscope off post description, I will add, if condition same what we did with the poor start PHP file. So if my length off this paused description is greater than 1 50 collectors then just show me 0 to 1 50 characters. So here I will add this posed description variable and make this variable too sub str from zero to 1 50 and then we will concur, Teenager with $3. Then we will call it post description. Let's make all of this in a one line. So if I save my page now and refresh my page, there is nothing. Why is that? It's because we have toe cut this and laying off string length function from here and put it here If you're a freshman piece. No. So you know, we have only 1 50 characters here and then we have read mobile. So we'll click on this. Read more Britain toe, Beautiful post and one last thing which I've want to Claire here, Whenever you are showing some going turned out off your debt, Amis, it's always a best practice to use STM ill entities function on your echo statement so that you won't break any esteem ill syntax. So I will apply the demon entities function on every single data. So applying as Deimel entities here, then both title. Then Edmund done my date Dan on post description here. So saving this one, refreshing my page. So we're just seeing only one post. So in order to see every single post, we have to cut the ending off our while loop from here. And we have toe put that ending just after the ending off our guard. So it will be here, but we can only put it in a separate BHP school. So if I say this one on refresh my page, you can see we have all deposed here with the same design. Cool. Right. So this is our first post on this blawg. And if I can show you real quick hair is disposed. This is the first post on this block. But technically disposed is the order one. It's not the latest post. So in order to fetch the latest post which has the later idea off 13 you have to apply the order by on your select duty. So I will apply the order by Klaus on this I d column. So I have 100 Sure descending So D E S c here saving this one If I refresh my page, See? So the life off insect is our Dynex off first on this blogger dot PHP bed and also you can see it on the 13 which means it's still it exposed. So if you're following the date and time for Mitt off SQL, you can directly apply the SQL function on date and time. But I'm not following the SQL form it. I'm just writing my own form it here. That's why I cannot apply the SQL function on this date and time. So the idea one is working quite well. So that's it 27. 26 Activating Search Button: in this movie, we will active over search button. You can see this person right here. So you will dive something here in this field and then you will click on the score. Burton. So we have to get first this search button. So we will say that if this person is collect means if this person is said, we have to go to this person, I maturity basic demonstration are me or the button. And then we will fort act Gord or demonstration in our actual PS people is so we will have on if condition in which we will have this function is set. And we will say that if this button is set so we can Jack, whether this part Anisette or not by super global off cat and passing the name off this button, that is search Britain. So we will say that if this burden is said, then you should get this input field which has the name off search. So I'm gonna cut this if condition from here moving downward. So right in this call as some eight right after the Etch one tag. When we have this PHP school, I will air that if condition here and after saying if that But in the sector we have to grab our input field. So I will have another variable here with the name off search and that variable will get our input field. So by using super global off get now I have to specify the name off my input field so you can see that this input field has the name off served. So copy this one going Don't word no putting that input field here. Then we will show the deserves according to this input field. So when we are showing reserves according to the user's search, we don't have to show these default reserves which we are getting from our database out of this simple as cool off select static from post order by I d d sc for descending. So we'll show the reserves according to the input field. So I will wrap up this, Ask your inside the else block and export this global connecting db at the beginning off this PHP school. So basically, I'm saying here, if my input fearless said, then we will have this SQL that I'm going to write. Otherwise, our SQL Statement will be this one. So let me air the comment here. So writing SQL for this search button when this search button is active so over a skill will be like static. All the columns from my table off both their every single column off mine match with the input field that RV is the user is entering. So I will say there My dear time column in my table is like my search. Actually, I'm using the name perimeter here. So this date and Time column belonged to my database. This statement Time column and I'm using the like operator toe match the user. Enter data with my table, so select all the post very. You find it. Date and Time column Like the so stab board, you find the category column like the search, Uh, so we need another like hair of letter or the post means this column off post this search down. So I'm using the or operator, which means if you find reserves according to whether it's a title or category, your post show me deserves. I'm not using the and operator because in and operator it will only return me deserves when all the conditions are true. So I'm just saying here if any of the condition is true, then show me results. So right after this SQL statement, we'll have our ste empty variable that will use our database connection and prepare of a rescue and we will pass over a school inside as a perimeter. Then on the next line, we will bind our named perimeter, so find value. So in the first perimeter, writing this named perimeter off search this name perimeter seem like this. And in the second argument, we have to pass this search Variable this import fear. So busing it head Now, as we are using the like operator here off SQL. So we need to pass the percent a sign, so I will posit percent a sign at the beginning off my variable and then ending off my variable. So, in the binding values, I'm saying here in my database, look for this search input field And don't worry about the beginning data or the ending better. So this percent age is representing the whole content off Dad column There. Our SQL is finding this reserve. So right after that we will have our semi colon and then we will execute over beauty. So whenever you are taking some values from a user must use PDO named pedometer like I did here so that your qd will be SQL injection free So you can see that if this search button is certain, we will have dis SQL Otherwise in the answer block, we will have dis ask your and the rest off the content is same here. So we have to do the little bit mortification here because for this else block we have this has t empty and that is using the q t mattered. So I'm gonna cut it from here and we'll put that beauty method here in the else block because here we have this s t empty that is using the execute function. And here we have this s t empty that is using the Q T function and then this s t empty will be used hair as a fetch, no matter which type or function. We used to run our curing like we did execute hair and curie here. So if I say this one and if I refresh my baby to bring the new PHP So if I search for something like insect click on Discovered in. It's not working. Why? It's not working. Let's see the structure of this person So moving up. We have this button right here. You're Stipe is important. So if I remove its type d four type and refresh my page now for some insect here, go. So we guard the Saturn XY gut. So I have to ride correct spelling. So execute here, saving this one. Refreshing my page. I see. No, we have only God, They're post ville it finding insect in our title. Let's check if some day it is like this. So I'm just gonna served 06 test in 2019 for details on time column Go. You can see we have this post were 06 2019 also here and also here. So if I search for third, you can see Third Post and I got only one search dessert. So if I check the description because in all off over post we have the d Ford next off Loadem IAP some. So if I go on my blog's or PHP page, you can see all of the Post has the same description. So put me out a new post. So going toe my directory earning post besting Neil one. My name is on Nash. Publish Post are dirt large school over blocked page Sore testing Human is at the beginning . So if I search for John click go You can see it faced only that post were fired The John So it's checking in my title in my date and time in were text if it can find the searched data So let me summarize all of this I divided my block page in Toto Scenarios. One is then my search button is active and I said when my side but it is active the Eckstine empty object will be This s t empty execute and you will have this Ask your else You will have this SQL and he will use the STM t on this duty method And the UAE loop is the same. I don't have to change anything here So just divided hole in not different scenario. Later we will add more scenarios when we will search according to over categories or we will learn the pagination. So that's how we worked with search bottom 28. 27 Full Post: Hello in this movie, we'll work on this. Read more, Burton. As you can notice, we're just showing only 1 50 characters here. So when the user clicks on this, read more Burton, he will goto this full posed or PSP. You can also see this football start Ph. B who were link. Then I put my Kirsten on this Read more Burton. So the use of a click on this read more Burton and will go to this full post door pH me where he will be able to Oh, dear. The full post. So back to my data. First off, all in this file off blogger dot PHP where we have this deed more button online one or tow . You can see we have football start PHP, but we can only go to the specific boards to which has that button with its i d. Because I d column waas unique. And we made it primary. So I will air the search query perimeter Here I d. And that will be equal toe one PHP scope. So adding the PHP scope here? No, here I will simply go my post i d. So if I can show you real quick. Here is this poor study that we are fetching out off our debt arose I d so putting that post idee hair. So if I save this one and refresh my page, if I hope my mama's you can notice that this one is not getting the I d. Why is that? It's because I have to cut the ending court from here and I will put it right here. So if I save this file now and refresh my page So if I hold it on the street in Barberton, you can notice that this one guard, the idea is equal to 13. This one has The idea is equal to 12. So this one will have the early off 11 and so on. So every single post has unique I d invite that I d. We can read that full post. So here you can notice that search query perimeter is already everything. Which is after this question mark gold surgery perimeter. So this idea is called search query perimeter, and that is equal toe this post i d. So where search perimeter is equal to the idea. So this file of blogged, or PHP as over football star PFP will have the same design. So I'm gonna save this file as full post dart BHP. So now if I click on the story more Burton, I'm on this full post or PHP the ideas 11 but it's the same as the blood post. It's because we are fetching these posts according toe the SQL that we don't So now we will make our rescue to show us only dark post which has the surgery perimeter idee lemon. So if I goto my full poor start PHP we had to go to a rescue So here you can see the before the school Curie So I will say select static from post order by I d de es e So right after the from I will air the bear claws Very I d column in my table. Off post is a cool toe This idea that we have in our you are so I can take that Heidi by using super global off. So I will have one variable paused i d from euro And by using super global off Jack, I will take that I d that we are seeing you. Never, Broza. So now we can put this variable post ready from your own here. So where the idea is equal to this forced I d from your own. And we don't have to ride disorder by I d d sc hand anymore. So if I see if this one and refresh this page, you can see now we have only one posed, which has the idea, Philemon. So we don't need this Read more Britain anymore on this page. So I'm gonna go down first off for deleting that read more, Burton. And also you can see the destruction on our poor's description content. So I'm gonna remove this whole if condition because the basic purpose off the space to show the full post. So if I refresh my page, you can see the full content. So what I did here first. Awful. I it called the idea Indeed. More button. So this one guard the i d off a lemon. This one guard led off nine. And this one has the idea off is equal toe for And if I can show you real quick in my blogger dot PHP page here, you can see I give this search perimeter I d which is equal to this post I d. So if I click on this one our physical toe four. I'm on this full post or PHP page where the idea is equal to four and this is our fourth i d. So, in case if I make this search query perimeter instead off I d I make it Bost save this one . This is blogger dot PHP page. So if i goto blogger dot PHP refresh that page over on read more you can see paused his equal toe for Nor the idea animal. So if I could weaken, read more button you can see I'm getting this error, that undefined index idea because now it has the search perimeter off post, not I D and full posed or ph. Beef file is designed in such a way that it should take the I leave from the browser, But so you should have the i. D. Here in order to beautiful post. So changing it back toe the idea. Seven. This one refreshing my page off blogger dot PHP First clicking. Read more. Now we have The idea is equal to four. No, there is no matter at all here and this is our fourth I d. Post no. One more thing. I want to show if I remove this four from here and enter, you can see I don't have anything I don't hear. But if I give it some wrong ready like five it enter Still, there's nothing no content here. And if I just delete all of this I risi caldo and enter. You can see a guard. The editor on defined index i d. So make sure you have your riding in the search. If you want toe, see some post And also one more thing. If I delete all of this like if I delete all the i d just for post or PHP, I'm seeing the index and you don't want to show these type off enters to your users out on the Internet. So I will add one thing in this script football star pH me. So going up, I will add one if condition. So this is blogged or PSV. So closing this one. So in this football start PHP page, I will add one if condition that if this variable off post rt from you, Earl is not certain. So I will put this forced i d. From Ural here. If it's not said, then show one at her message. Bad request and the direct user toe blawg dot PHP page. So if I save this one and we need to confirm whether we have included, yeah, we included over function file, which means we can use dysfunction off. Redirect underscore to, and we included this session file, which means we can work with session on this file as well. So if I refresh this page, you know, first off, all our school toe blogged or PHP clicking on the street more Burton Why it's showing me blogged or PHP Eimear dysfunction toe check. If this post already from your analysts said so in order door, make this one. If that not said I have to wear the north symbol, that's why it was redirecting me toe blogger dot PHP page. So if I see if this one and now if I goto this read more for post or PHP ideas equal to 14 here is this full OD for post. If I remove all of this, you can see ammon blogger dot PHP, but there is no session messages. It's because we're not Equalling our functions off sessions one of her blogger dot BHP bit . So let's grab our functions. Call from air New post page. So in order to see the other messages, we have toe makeover session functions. So I'm gonna copy from here. Let's close this one. So opening my first blogged or PHP page right after the h one tag, I'm gonna add our take off at her message Obsession message here. So now if I Yeah, you can see this message is completely working here. So if I go to this remote Britain, this is full post. If I could move this 14 from here, you can see there is nothing here at all. So if I remove all of this, including the i d click Bad request and we on the page off logged or PSP And if I click on this, read more Burton and instead of fighting if I give it bulls is equal to whitey enter. You can see still bad request. So always make sure that you take care off these browser fields because you will not have good people. All the times you brought your website, there will be some people who will love to find out the loopholes in your website. So make sure that you take care off these type of scenarios. So what I did here, let me devise all of that again for you. So I did one Lincare full post, or PHP and I called the I d by the ICTY because our i d was the unique one. So then we went toe this football start pH me and I said here, If this post already from your girl is sad, then you should show me the reserves according toe that post. So we are only showing one reserve according to this post already from Europe. So I added one scenario And if this post already from your Elise North said, send the error message as a Baird request in the session function Andrea, director blogger dot PHP And the first time we were not seeing the other on blogged or PHP page. It was just because off not calling the function off at her message and success message here. So, in order to see your error message and success message always call the function off our messy and success message. So that's it for this lecture 29. 28 Edit Post Extraction: Welcome back. Let's sport this blogger dot PHP Public view for Ah, hold and let's move back to over Edmund View. So I'm gonna go to this page off post dark pH. Me. And here you can see we have this edit delete and live preview button. Now, in this movie, we will active this edit button. Let's browse this post dot PHP page first. You know where Dita it is This speech. I'm gonna go to that edit button area. So here is this edit and it has the address off hash for No. So now we will create another page with the name off. I did Bost dart being me and that one will have the search gripping a meter off idee equal toe one PHP scope in which we will echo airs I d So let me show you exciting. You can see that we are extracting it siding and putting it in the variable off Heidi here . So now the same what I did with the full post or PHP. I can't do the same thing here so I can echo its i d. So if I saved this one and if I hold on you can see God. The idea of four, five, six, seven So same what I did here. Let's also do with this delete page so it will have the address off. Delete posed dark BHP search people. I mean, the i d will be equal toe saving this one refreshing my page over. You can see the deposed or PSP irony is equal to four. No, let's also active this life review so it will take us toe the page off Full forced dart pH me and the cool I d. Here. I saved this one. Refresh this page. Click on this life preview. You can see this full poor start. PS period is equal to four. This one is working. Let's also Arabic target underscore blank opening the new time. So I will add here a lot of get underscore Black saving this one refreshing my band. So if I click on this the new phone 2019 Life Review, you can see that disposed new phone 2019 Complete post ideas Equal toe then. So now we can easily navigate on every single life previewed opposed from here. But in this movie we will focus on this ad important so that we can added our complete post . So if I click on this addict, you can see added post or PHP ideas equal to four. So I designed the speech. I will design it in the similar way we added a new post. So opening my r new post or PHP, I'm gonna save this file as and it post dart BHP. So if I refresh this page So first off changing its title from categories it should be and it post no, here you're such one would be and it boost assuming good on refreshing it. You can see this bitch Now The idea is I will fetch the existing content according to this idea of four hair, so that before ending any post, you can see the existing content and then you can add it that content and update your post back to my reader. So this edit post will be a two way thing. First, we will extract the existing government. So in this call LG 10 death, I will add the connecting DB global and let's first air the commenter. So the first variable will be search Q t Better Mita that will get our i d from the EU era . You can see this I d So we have to get this fourth. So we guard that one with this super global off cat And then on the next line, we will have or ask your select all the columns from my table off boast there where I d is a quarto This search security perimeter that you're getting in your grill. Then on the next line, we will have ste empty as TMT of a statement where I can call it has TMT four est empty pools and then using connecting db to call the method off curing passing the SQL here. Then we will have our y loop that will goto est empty fetch complete a rope later. So s TMT fetch and we have to do put STM tiff post such and it will be equal. Do Dr Ruth, let's stick with the one former that we have been using so far. So then here I will have couple of variables, So the first variable will be title to be a predicted. These enviro I'm using these long names with the special style is because the basic purpose off these old and courses is toe teach you in the best and easiest way. That's why instead off using the hard core programming style, I used these long lose names so that you can easily the variable and get the idea what this variable is going to be about. So title to be updated will be equal to our data Rose And it will firstly column off title that was in the lower form. Then we will have another variable Get the goodie will be up there did selecting column off category, then image to be updated and then lastly Bost Toby objected. So if I save this one and no at every single place off input field, I will put this extracted data in the input field So for this 1st 1 this input field that is about the Post Writer in the value attribute I will add one PHP school in which I will echo our Daido will be updated. So if I save this one and refresh my page See, I put my title here in this field No. 40 category We already have the category here so I will add another span here right in this death. So I will hurt this pan back that will say gloss off feared in four existing category will be span and then we will have PHP scope to show the existing category. So echo, get the goodie Toby updated. So if I save this one, refresh my page, you can see existing categories news. So let's make this Jews category on the next line. So b r bank hair. So we are showing did that down this page. Then we will have this choose category where the user will choose a new category in case if you want toe have a different category after everything Post and then we will have the select image so seem like this I will add Seems span here. So right after this Jews category, you can see that this is fetching all the articles from curricular table. So here in this Dave, I will have existing image and then we will have one BHP school source go to my applauds for their and find out this echo image. Toby objected. And for the default verdict, I will give it 1 70 p x and for height leaving this on refreshing my page. See this image. It looks ugly. So we have to end our image tag here. So if I save this one refreshing my page now you're going to see the existing image. And you can also add the margin bottom to your existing image, if you like. So ending Multan bottom. So bootstrapped last off and be Dash one, saving this one. Then we have this sports stadia. So for the post area right here, inside over tech stadia I will. That goal my variable off Supposed to be deterred, Saving this one refreshing My page. Now you can see regard this text here. This was the first part. We finished our data according to this post ideal for so if I goto post are PSP end goto this it caused the left off in history. Click on this added Burton. Now you can see we first the data off this idea, Lemon No. In the next movie, we will write one script there. In case if you added disposed to like this or you give it some different category or some different image that update, we'll also goingto happen in that database and it will make a change in your this post so that we will do in the next movie 30. 29 Post Updation: in the previous movie, we completed first part off this edit post process image. We extracted our post on this page off added poor start PHP with some I d. Now, in this movie we will take this dirt down, that the user will enter or chain here and we will save it in over same record with the idee off a lemon. So back to my data. So, first of all, we have to goto this form so schooling up. First of all, changing its action attribute Toe dude, Paused dart BHP And one more thing I have toe add here this time which is adding the search curing perimeter because we will have some surgery perimeter. According to that, we will date over post. So right are that off? I'm gonna have one variable. This variable name will be searched Curie perimeter and it will get our i d from euro. We also declared the search perimeter. Don't word. When we fetched of opposed, let me show you where it's right here on line. 1 24 So we don't have toe decree declared it so I removed that one. So we had the search perimeter at the top. No, we can and it over form. So all form will have that search Caterpillar metal here. So adding one PHP school and go this search beauty that I mean saving this one. First the method will be posed. The ink type will be multi part slash form dash data and then we don't have to go into this form anymore. No moving upward where we have our some important. So if is certain sum Mitt Burton, then we will have this variable off post writer that will grab the post title than category than image Name. Target Post text The default admin name will be jazzy so all of this court would be the same. If the Post article is empty, then we can se Title can be empty and redirect our user toe bulls dart BHP And if title length does not better Same bitch post dot PHP the detection. And if description has less than Tozer collectors length. What was do you director Bull start being me. I think this length is quiet. Minimum right 1000 characters will not take that many words. So let's add your destruction off our table. Click on the structure. Go to change first ofall select the column so I will select Post Column change. So instead, off 1000 Let's make it 10,000. So looking on save So we saved it. So in start off 9 99 I will make it 99 99 So saving this one, there's also changes Basic validation Hardening post PHP file sliding 999 Saving this one closing this one. So then we will have our else block in which we will have our curie. But this time decree will be update Curie Nordion surgery So now changing this given you to update so cute Ito update Boston DB Then everything is fine. So I'm going to remove all off this curie from here, including the binding values repaired and a skill So writing this new Eskil So this SQL will be dead my table off post and set my column off title So this new title So the new title will be this post title So we will change only in our title in our category, you know, one image and in our polls description So the next one will be jeans My get that goody So this new captivity and change my image, This new image and my poor's toe This forced next Sam I got in here. It's divided in the second line, so basically a certain here of gate might table off posts and set this title column. This title column put this post title which you have in the super Global off title and set my category toe this category image to this image and posed to this post text. But this gold will update every single post until we define the very close. So right on the next line, I will have very close and say there the I d column has this search beauty bellamy toe So where the idea is equal toe this search curie perimeter. Then we will move our uploaded file cooked are a good location. We will have the success message that boast updated successfully, we would be director boosts dark pH me and also in better post dot PHP. So, in order to run this SQL we have toe call the mattered off duty. So right here I will have this execute that will call my database connection off connecting Davey and call the method off duty. So passing my SQL here. So Michael in here. So if I see if this one and refresh my page, let's make this title will be left up in board. Select some other image like this three d wall changing the post description toe testing. Changing my category toe fitness publish. You can see we are only paid off posts door ph me, but there is no session message. It was just because off not calling the functions off better and success in our post or PHP . So I'm gonna called those function. So I have those functioning air New Post, so going down to call to copy those functions. Hey, you can see at her message and success message in order to see the sessions. So I'm gonna opposed them in my file off boasts Dart BHP. So inside this file, I will show the error and success message in call algae. It'll just before the table. So you find based them and save this file closing this post dot PHP. And if I refresh this bitch, see a guard, this message board stop deter successfully. You know, there's make sure let there be actually of digital post or not. So I'm gonna try that one on this edit off. This is the first post. So I did so making it, particularly fitness. Selecting some image toe this three door deputy and for your stacks to it will be testing, clicking on publish regard the success message. But still, the post is not updated here. So over both is not updating. Why is that so? First, let's debug of record. So instead, off this if execute redirection. I'm gonna comment all of this and I'm gonna see what's going on with this. Execute by war. Dumping it. So what underscored Dump putting this executive here. So saving this one if I goto this added click make this title toe nothing and then news image to this three door deputy and hold this text toe testing. You can see a guard. Couple of feathers. 1st 1 wars on line 30 and it says undefined category, so category. Sorry. So I rode the long variable. That's why I was having this better. So first off, all online 30. So it should be gotta goody. So there was over second enter then online five. We have defined index idee. And also, if you look at north this there is something missing here. It says edit. Both start Ph b Question mark for So we have to correct this form. Action attribute. So going to my farm? Yeah. I have to add the action attributes here. So edit post art PHP and then I d is equal to so saving this one. No, let's go back to this page I physical toe for no changing it toe nothing and content toe besting. Publish. So I got this Bardem String. Want to it? Update poster title. Nothing category. Let's go to the post page now see? No updated alert Boast. So let's tried for one more time. So going up? No commenting this far dumb and un commenting this condition saving this one. So if I refresh this page, click on this button. This stays nothing. So I'm gonna change it. Toe nothing. Second, ginger gets category toe news and its image to three door deputy and testing do bost content. So if I publish, you can see nothing. Second news, this new image and this forced content right here. So it means that our categories working perfectly fine But there is a problem with our edit post If I chain just the title. For example, if I make this poster toto problem and just change the post Artur click on Publish Button, you can see that problem has updated and it also deleted over image, which means that when we're not changing over image, it gene the image to nothing by default. So we have to add it. This update Curie, so that then the Edmund don't want to change the image. The image won't get updated, so we will say here when, if condition. If our this image. If this image is not empty, then we can have this. Q T. Otherwise, our Judy will be a bit different. So I will add one simple function. If not m pretty. And here I will put directly my image that has the super global or files image name. Or I can put directly my super global off finds and go for my image, this image and this complete one image name or I can put this image. It's completely up to me, so I will go with this whole one. So if this file super global off image name is not empty, then you should have this sq statement and otherwise in the else block I will have on other SQL and see if they're snorting. Case Do not update my image column so I can simply delete this image feel from him. So I'm saying here, if this image name is nor deputy than update my image advise you don't have toe worry about image. Just update my title category in post where the ideas search perimeter. So if I save this one and if I click on this added burden first off fallers. Change of image toe this three door jpg so publish. You can see this new image. So if I click added and just Jane, this post title toe oneto one. I'm not doing anything with this image clicking on the publish. You can still see our image, and it's a supposed to touch for bigger than five. Electrolux jacket again. So 11 and then I'm not doing anything. Hear clicking on this publish, you can see boast of Richard Successfully. You can see the title, and we still have the image Life a click, edit and change the image toe this three D ball click publish. Now you can see the new image, so that's how we update our posts. Take care 31. 30 Delete Post: Hello. In this movie, we will work on this delete button. So when I hope were on the street Britain, you can see in the bottom left side off my browser that this one guard, the idea is equal to four. This one idea is equal to five. And then this one is equal, though. Six. So let me show you the structure of this posts Page. So going down here, you can see this anchor tag for diluting post button online 1 60 which is working same as area post dot PHP research school perimeter Boss, I d So same here we have the surgery to pedometer i d and really sequin diary. So by using this, I d. We can go to this page off, delete poor start PHP. And by that page, we can delete over post. So the structure and the gold off added post dart pH. B can be used in this file off delete Post are pH. Me? Because the operation will be different. The dust off the court will be Sam. So this file off added, pull start PHP. I'm gonna save this vile as delete post dart BHP No, First in this file changing its title also each one hurting. And then for publish, we will have our delete and the beauty and glass will be danger for the red color. So no, If I brought this page, you can see this too liberal and start off dick Less air, some other phoned. Awesome. So I will go with F s effort. Dash crash like on so refreshing My page. See this delete button here. Okay, that's it. Now, instead, off making these fields visible, showing the content in a adit moored. I will apply the disabled class on every single field and also insert off fetchingly choose category. We don't have to fetch this table of choose category because this speed will be act as, ah preview. So we don't have toe show this Choose category field here. So also this field off Select image. I'm going to remove truth category and select image field. This is our field off in port. So I will remove this Dave off custom file and then we have this devil form group in which we have existing category so we don't have toe show this whole Jews category select and fetching from that away so removing this one as well. No, here starts to move this form equal to form dash. So we don't need this imbued Ashman if we make it good. So right in this input field I will apply the same bird attribute. So if I save this one and refresh my page So now I cannot click on this post Writer It's December that's also do the same thing for over post. So going down head, you can see this spools text area making it the same bird. So saving this one refreshing my page. Now you can see this one is also not under a table or clickable No, let's work on removing the Necessity court from our file. So when this submit button will be clicked, we don't have toe get these fears because we're not editing other post we were just delete our post. So removing this bunch of court from here and also we don't have to air these validations so removing thes validations from here and we will not have the else block and removing all of this So this belong toe descending. So removing this a necessity calibrates so this one belong to this one. This one is for this one and this one has the ending at line 19. So instead, off duty update, we will have kill you too. Delete. I am opposed to NDB when everything is fine. So now it's time to write our SQL for deleting over post. We already have the search kitty perimeter out off the scope off this sub in Britain. So before writing or SQL, we have to change the action Tribute off other form. So going down to my farm here you can see online when a five instead off I did post we will have delete bulls dot PHP id It will be seen and then we will equally search beauty perimeter then going on top. No hair online nine I will add when we're able with the name off a skill and this variable will have our delete Curie sword. It will be delete from my table off post where I d column is equal to my search beauty pedometer So seem like added post were take this search the perimeter I d And then well Saito over. Ask your that only lead that record where this I d is entered then on the next line, we will execute our security and we don't have to move the uploaded files. So they're moving this line from here. So if I save this one and make it Oh, forced deleted successfully. Okay, so this is it for the lifting of a post. So if I say this one and first off all, let's refresh this page toe, bring the new pH. Me. So if I click on this delete button, you can see pours diligent successfully? No, let's also delete Disposed, which has the title off. This is a second Bost delete silicon distillate button. Si, no, that post off second also deleted. Let's also relieved this 3rd 1 click Delete. No third post has deleted as well. So that's how we delete over post. But when we are diluting our post over images nor deleting from over directory off uploads if I can show you real quick inside my upload folder, you can still see this street or deputy and three devolved art deputy. So, for a better demonstration, let me select some image which is unique here. For example, this image off sky blue background It's name is a female course door GPT. So if I delete this post with this image, the late click delete No, Dad post is not here anymore. But our image is still in the directory, which is not good, right? So in the next movie, we will work on this case which will make our CMS toe delete the image When The Associated Post got removed by admin from the Edmund panel. 32. 31 Delete Image: in the previous movie. We saw this case when we delete a proposed the associate ID image still stays in our directory off uploads. So I've ever tackled that case in this movie. So back to my editor. No. In order to delete our image, we have toe add a bit off cored in this block off summit and we have toe use one function off one link by using, we can delete over image from over directory off uploads. But for the leading our image, our name off image should be present in this submit school. And for that we have to fetch our table off post and specifically that record. Where did eluting operation is going on? So we are fetching our record downward, not in the submit button. So if I try to excess any off the variable from the cord, for example, you can see that hair online 94 toe vinyl tree. We are accessing our database. So if I try toe record this image to be updated right at the top, for example here, save this one. And if I click on this delete you can see I will have this error on 96 Because first off, all other script will execute discord. Then it will execute discord and online. Six It will say this guy is echoing this image to be updated variable. But this variable is not defined online. One toe five. So it will show us the error. So before Equalling some variable or before using some variable, we have to declare that variable. So we are declaring this variable online one on one right here. So we cannot access this variable if we declare this variable after. So I have to cut all off this scored from here because it's a one time via loop that will fetch only one post. And it's ending. Is not I creating the STM metal content so I can got disgorged from here? No moving up. So now All right. Online six. If I've based that gold here and save this no, If I just refresh my page, you can see we access this image name. Why? Because no other browser execute of a court from Lyon one And then it moved online selling than air 9 10 and then online 13 So online 13 it go rd variable image to be updated and online 17. We requested it to show us this image to be updated variable. And it says, Yeah, I guard this variable value from line 13 so I can show you that variable. That's why this time we are not having our editor. And every bit off court is working. Same because it was divided loop which don't have toe. I trade for every single post. It was just made for one post. So right here. First, let's Goldman this echo. Now inside this summit, Britain, Right after deleting over post from over table right here I will add one variable with the name off. I thought I get bunk, So delete image and that variable will be equal toe. Oh, water up Lords folder. And then inside this fuller Goto this image, Toby updated variable then going toe. This applauds Fuller go for this image. So we have this image online. 13 image toe being updated. Let's make all of these variable toe deleted so that you can read the score later easily without confusing yourself. So I will change all of these variables. Okay, Now we also have toe. Jeez, the echo variable that I'd here so category to be deleted. It means to be deleted, Supposed to be diluted here. So I replaced all the aptitude with this Richard. So if I saved this one and just refreshed this page, regard the other online 26. So what's the other? Yeah, I have to wear the semi column. So if I save this on and just refreshed this speech, you can see we are fetching all off the post content. So I just made the simple change where I changed a variable name from title to be updated toe title to be deleted. And I also change every single echo statement which we were using to show over existing content. You can see this category to be literate, imaged with Richard, nor the abducted anymore. So right online 25 I will say goto this applauds folder and then go for this image which has the name off image Toby deleted in the earlier version off PSB. You can only mention this variable name inside double gold if you add the godly braces. But in this version, if I don't air, the calibrates is I can still work with this variable. So saving this one so this was over part toe delete over image. No, we will use one function that is unlinked image. I have to specify my target bunt. So that's it for the leading over image. So if I save this file and first let's go to our post page, so I will select this image that has the name off. Ask your concepts, door deputy. So here is this image. So if I click on just delete button goto this believed post village it successfully and you cannot see that image here anymore. So that's how we delete our image by using this function off on link and make sure that you put all off your fetching existing code, which is helping you toe fetch your post at the top. Otherwise, this court is not going to work. And you will have this error all the times undefined it Mr. Be deleted. So make sure you put all of this court here the reason why I am repeating myself again and again. It's because in the previous CMA scores, I was having this question a lot of times. Then student make these type of mistakes and desperately vase their time on D begin. So whenever I repeat something, listen it carefully. So that's how we delete over images 33. 32 Designing Commenting Area: the next couple off movies will explain the comments, part off discourse. So the idea is, when that was ever click on this, read more Burton, he will be able to do the full post. And also on this post, he will add the comment. So first off, all we need some comment form on this page off full post door PHP. So back to my Rita. So back to my editor now opening my file or football stars Ph me? No. We have to add the comment form on this page. So going toe the main area. And so here you can see our main 80 IES ending right here in this jail. And then we have this side area with the background green so right in this main area. So right inside the ending off remain in here, dear. So ending one, Dave here And before that, we will air the comment here. So right inside this div, we will have one form and the action attribute off this form will be for paused dark. BHP and I d will be searched the perimeter. Let's see whether we have defined our search perimeter here or not so going on the top. No, we don't have anything here. But in this area, Off the Ford, Ask your security. You can see we have this sports tidy from Euro. Get the I. D. So let's not do anything with this variable instead, right on the top. I will hurt this variable search Beauty better, uh, meter. And by using the super global off get I will get my i. D. So now we can put this surgery perimeter right inside our form. Action attribute. Okay, So putting it hair in a PHP school and we have toe record this one. So inside this form, I will add my whole feels inform off our card. So adding one David the bootstrap glass off guard. Let's give it some margin. Bottom off three. And then inside here will have another deal. The D Bootstrap class off guard header. And then we will have on at five with our custom class off feared in full and for the text . I'm glad Share your thoughts about this post. Then after developed card header, we will have another deal. The D bootstrapped loss off guard, dash body. And here we will have another dear lady board stepped loss or form dash group and then input field with the type off text. Its name will be commenter name and this place holder will be name. And let's also apply the bootstrap loss on this field form dash control. So if I save this one and refresh my page or full post, you can see this guard and this is our field off name. Let's also add one icon before this field to make it a bit more nicer. So right here, after a reform group, I have allowed another do the D bootstrapped last off input dash group, and it will wrap up our whole input field. So where dingers ending here? Then we will have another day. The deport strapped loss off in port Dash Group Dash three. Spend so reading one span here with the claws off input dash group dash text and then adding the I tag for foreign awesome with the glass off airfares F a dash user. Okay, so if I save this one and refresh this page or full post, you can see this attractive icon. So it seemed like this We will add another field, so I'm gonna copy this whole form group Dev and pasted right after it. And this time it will be for our email. So I will add the placeholder email and its name will be commenter email. Your style will be he meal and for foreign Awesome, it will be envelope So saving this one refreshing my page You can see another feared So then we will have our deck stadia. So adding wouldn't do the deport strapped laws off form dash group And here we will add our text area Its name would be commenter parts and adding the bootstrapped loss or form dash control. So if I save this one on refresh my baby you can see this deck stadia If you don't want to have as many columns or rows just delete this Rose Idiot and columns is equal to 80 from here So then you will have this tiny one. So I think Let's stick with this one and instead off aircrews we can have six rows better Then after that, we will have in some mid Burton. So right after this form group Dave, I've allowed another deal and adding When Burton here it's type will be submit and its name will be summit as well. And for the bootstrap class, I will go with Bt n Beauty and Dash primary and making its name cool. Submit. If I save this one and refresh my page, you can see this person. But for the text it will be submit. So this will be over form by which the user can add the comment on this post. So for the other part, off inserting comments, we need our table in our database off CMAs 4.2 point one. So in the next movie, I will create the Ark table, and also we will insert our moment in our table. 34. 33 Inserting Comment: in this movie, we will work on the PHP part off comment. So, first off, all we have to create another table in our database. So opening my PHP mired hman no clicking on my database CMS four point open one Clicking on this new and giving it some name Soul comments will be our table name and we will have five column So 1234 Let's add one more column here so the first column will be I d. 2nd 1 will be date time. The 3rd 1 will be name. Then we will have email and then we will have government. So I will be in type. Date and time will be watcher. Name will be watching as well. Email watcher comment will be watched as well, So the maximum number off characters you can add in the comment will be 500. Email will be restricted. Let's say 60 name will be 15 date and time will be 15. I'd even to be. Then our idea will be primary one or tow in, commented clicking here and exit for the structure off this table, clicking on the save button. So here you can see we have this table off comments? No. We can insert our data here on this table. So back to my Rita, this is my file or football star PHP. So we will have the same type off scored for date and time and basic validation. So I'm gonna open my file off categories dot PHP. And let's copy this PHP scope in which we have this submit button and also what? Insert duty so that we will not vest over time. So I'm going to copy all of this closing this Fine. Now pair in this file basting that gold off categories. So if my button off submit is said so let's confirm the name off over Burton. Yeah, we have the same name off submit so we can use this name. Submit going up? No. Make sure that you put all off this gold at the beginning off your bridge so that this file should execute every single chord before reaching toe the actual form at that time when the user will air the comment. So if my button off submitted set, then you should get a year to variable with the name off name, and we have to get the fear off our commenter name. So you can see that this is over form. And here you can see the name off over fear Input field, that is commenter. Name and matter disposed. We already Acholi search beauty perimeter here for this form. So going up, putting the name Toby Commenter name. Then we will have another variable with the name off e mail and that variable will use super global off post. And for the name we have to go to our field. So here you can see the name off this fearless commenter email hoping this one putting it here. Then we will have our actual go meant. So that will use the super global off Bost and we have to grab the name off our text area. So here you can see ever text area that has the name off commenter thoughts coping this one basting it here. We don't need this Edmund name anymore. Removing this one we will use our date and time for two different time column. After that, we will have the simple valuation. If the commented leave the name field empathy, then you should show him better. Or we can also apply the same restriction on this email, so I will apply the empathy function again on this field off email. So if this name fearless M pretty or this is this way off writing the or symbol in PSB double pipe sign. So after that we will have. Or if the commenter leave the comment field empty our text area So adding the comment variable here, then you should say all fears must be furloughed and redirect our user toe the same page off full forced dart BHP. So we have to give it i d. And here we will have over searched Curie perimeter in orderto stay on the same page. And in case if you're using lower version of PHP, you have to article Liberace is here, although I don't need it. But still, it's a good practice. So then we will have another restriction that if the comment is greater than 500 characters , then you should say comment. Length should be less than 500 characters. And do you directo the same pitch there? He's adding that comment so hurting here and then we will have this another restriction. We don't need this one, so I'm going to remove this house block and beauty to insert Go meant in baby when everything is fine. So first off on, let's check this validation so refreshing this page. If I click submit, you can see him in order getting the session of her message. So I have to include the call off error message and success message here. So opening categories. Doris Ph Me Going toe the area where we called over functions. So here are our error message and success message, hoping these ones and now in football star PHP the right inside over the main idea right after a Brach won Tak. I will add those ones here. So if I just refresh my page, you can see this error message. And if I put something like length more than 500 characters here, click submit. It's still give me that other So giving name off John Emailer Toby. This served the rate off JD dot com adding content more than 500 click submit. Common length should be less than 500 collectors better here, so our validations are working fine. So let's work on over Curie to insert our data so we will have our global connecting baby variable and then on the SQL will have SQL off insert into my table off comments all in lower form. And then we have to specify the fear. So the first field will be date time. Then we will have another field. So let's see the structure, name, email and comment. So then we will have name E mail. Comment. No defining these ones. Hair. So our daytime. Then we will have named pedometer off name, then e mail. Then go meant. So then we will have or binding values. So date and time will be this variable off date and time and then we will have for name Variable will be name E mail Over variable will be e mail and then we'll have field off moment and then here Comment variable. So I'm just mentioning these video both here. So we'll prepare our a skill. We will bind our values and we will execute over. Ask you. And then we will show a message that comment submitted successfully and we will return Woody Paige off same one. And in the other message, something went wrong and we will stay on the same page so if I save this one And first, let's refresh our page. So adding some name here, e mail toe this one and comment toe testing summit. Something went wrong. Try again. So what's the other sore? Comment is not I did regard this editor message. So in the browse tab off my comment stable, there is still nothing. So we have toe debug over chord. So this is belonged to this one. This else belonged to this one, and this one belonged toe this else. So I'm gonna comment all off this three direction and var dump my execute. So if I refresh my page and give some name submit so it stays invalid. Parameter number, Number of bone variables. Just not match number off tokens on 9 30 So we have to find our theater. So how many values we have binding? Here we are binding. 123 and four. And here we have one toe, three and four. So this one God calling Colon Colon and I have missed my calling here. So saving this one because at the time and you are defining your named perimeter, your name perimeter should match with this named perimeter. That you put in the values. So I missed this colon. That's why it was giving me at her. So if I save this one and refresh this page, adding the common now summit bull is equal to true. So if I click browse, you can see we successfully added over comment in our table. So now let's come in this war dump an uncommon all of discord, saving this one refreshing my page, adding the comment again. Summit, Goldmark, Symmetric success, money. And here is our comment. So the idea is we will get the comment from a random user by this form, and then we will send that comment toe aware admin panel. And in case if the admin approve over comment, we will show the comment on this page off. Full poor start PHP according to this idee. Otherwise, if Hedman don't approved a comment, the comment will not appear on this page. Off football start PHP and also admin can delete the comment any time he like and the time off taking some comment from the user. We have to make that comment status off by default, and then later, when the admin will approved a comment We will add the comment on this page off Full post or PHP. So they're all the comment. Don't appear on this page of Full Post or PHP without the admin approval. So we have to change something in our table off comments. So I will add two columns for no here in this table. So adding two columns and these column will be after my comment column. So clicking Go. The 1st 1 will be approved by and in this column. We will save the name off over Edmund, who's gonna approve over comment, and the next one will be status so approved by will have a bar chart time. Its length will be 50. It will have the name off Redmond later, and staters will have a type off water as well, and its length will be three. So clicking this, say, Burton, browsing this one. Now we have two more column here, so by default we will send some values toe these columns. So right after this comment, mentioning this new column off, approved by and for its value, I will add this string off bending, and then we will have another column with the name off status, and this one will have the string off off as a default value. So if I show you this, these are the two columns that we just wrote. So as we are passing these columns values by ourselves. So there is no chance off SQL injection here. So we don't have toe bind these values like the other ones, because we are taking these values from the user. That's why I bind the values. There is no chance off a school here. So if I save this one and refresh my page, adding the new comment Summit go make submitted successfully. If I brought it again, you can see approved by pending and status is off. So the idea is this comment will goto the admin. And when the admin will approve this comment, the status will be on. But that is a later thing. Toe dough. First off, all we have to connect dis comment with disposed off ideas equal to 14 because this comment is randomly adding in our table off comments, it does not have any link with this. I d off 14. So we have to create a connection between disposed and the respective comment adding in our table for this post and we will do that by using foreign key. So in the next lecture, we will learn about foreign keep where we will establish our connection off posed with over respective comment. 35. 34 Creating Relation Between Tables: our post, and our comment is living too far. We have to create a bridge between these two lovebirds so that they can live happily and divers. Let's create a foreign key between our table off post and comments so that every single comment will have a connection with over Post. So in order to create a relation off foreign key First off, all we need one more column in this table off comments. So clicking on the structure. No clicking. Add one column after my last column off status. Click go! Adding its name Toby Boast underscore I D style will be in so it will have a value from the table off posts so its length will be then and you have to add one thing here, and that is. Click on this index column and take on this index. This time, you cannot select primary key because you can have only one prime bikin your table, and you can have other give. It can represent your table as an index key. You can think of index key as an second top key in your table, so every select index you can give it some name. Off index or you can leave it empty. Go. So click on the save button. No, I added this column. If I bro's, if I collect structure here, you can see the Post I d. And you can see this lighter key on this column. And if I hold here, you can see the index and this prime Mickey has ah colored G. So this one is primary and this one is Index. So after doing that, you have to be in the same tab off structure. Click on this button relation view toe. Create your foreign key. No, here click on this column and choose the one which you just made. Index. So clicking on this post I. D. And then I have to specify the name off database, which I want to connect with this table off comments So our database will be the same Seamus for print to print one. So we will make the connection off this comment Stable column Post I d. With our table off posts, so selecting my post stable and then I have to click on the primary key off my post stable . If I click here, you will only see the primary column here and that is I d. So here selecting the index column off my comments table here is my database. Here is my other table off posts and here is the post primary key that is idee so on. Delete, Select cascade on update Select Cascade, click Save. You can see whenever you see it's some error like this. It means that there is a problem while executing your command. So the other is we have toe delete the existing entries from over table off comments so that every single column will have ah, foreign key. So I will delete all off these existing ones from here. No, I don't have any column here. So clicking on structure again, Selecting relation view going toe my column. So selecting my column off post underscore idea, which is index column selecting my daughter be a Seamus 4.2 point one, selecting my table off posts and the idea by default. Then on the lead cascade on Update Cascade, you can give it some constraint name here, so I will give it name of foreign. Or you can leave it to your PSP. My ironman, which will give it some name by itself. So I will give it name of foreign relation. So click on the save button. I see. No, we have the green message, which means that we have successfully created a connection with our table off posts. And you can also see here that it showing us the command, the Curie which it run in orderto dough all off this foreign king operation. So now click on this. Browse there said for creating your foreign key. So back to my editor, I'm on this page off full post or PHP. And this was our insert Curia toe are the comments. Now we have to add one more column here that we just created Post underscore i d. And we have to pass the post I d. So this column. So here I will add one. Name the perimeter with the name off Bost i d from you l and no binding devalue. So for getting the i d from your l, we have toe get our search query perimeter. You can see we already have the surgery perimeter, so I'm gonna copy it from here and based it right here. Okay. So doctored for adding the post idea in your table off comments. So if I save this one and refresh this page if I had one new comment Summit Comex emitted successfully. No browsing this table of comments you can see in regard. Josip. Email comment approved by pending status is off. And here in this post underscore idea column, you can see this blue eyed E 14. So if I click on this 14 No, you will see I'm on my post stable and I opened that post which has the i d off 14. Let me show you again. So in my commerce stable if I click on this link 14 now I'm on my post stable and selected that I d. Let's do it one more time. So instead I will open some other post like the dining days. Read more, adding my comment here. Summit comments, emitters successfully. Now I will open my comments table head Is this new comment that I added? So if I click on its i d 12 now, I'm on my post stable and this is deposed associated with that comment, and here you can also confirm that disposed has the idea off the world. So this is how our relation is gonna work. So whenever we will delete our complete post, it will also going toe lead Our comments from our table off comments. So for a quick demonstration, if I delete this column off well, this column off I did well, I did after this one. So if I go to my commerce table now, you will not see the comment associated with that. I d cool, right? So if I delete this comment from here from my calmer, stable click OK, I can do that. So let's do it one more time. So clicking on this post testing new one, adding one comment. Summit head in my comment. Stab, I have this comment. If I click on 14 I'm on my table off posts. And here is this 14 record. So this foreign cable going to help us later inside the scores when we're going toe delete over post by our CMS admin panel, it will also going to release all the comments related to that post 36. 35 Fetching Comments: hello in this movie we will fetch our comments according to every single post on our football star Ph before. So I have already added a couple of comments in reference toe somebody's I have four Commerce for post I D 14. Two comments for I D 13 and one common for I D 11. This is my commerce stable. Now here on this blogger dot PHP page. If I goto this post read more, this is my full post with The idea is equal to four thing. No, here I have added a couple of comments toe this poor. So let's fetch over comments on this page off i d 40. So back to my editor? No, here in this file, let's court over common section So online, 1 88 you can see over common part is ending. And it's starting from line 1 54 So ride in this common part right after the ending off our fetching post. We have this common part of the start with D comment, so we'll fetch our existing comment here in this block. So first off, all grabbing my connection and I have to put everything in a PHP school so we will have one Eskil. So we ask you will be select all the columns from my table off Gomez. And we have to fetch our comments according to the idea off over post. So in the very close, I have to mention this column off my post. I d so mentioning it right here. Select all the columns from a table of commerce where the post underscore i d column is equal to our search Curie perimeter. I only defined this surgery perimeter variable at the top off the speech. Let me show you a beer you can see online for we have this variable search key parameter that is getting the i d off post this i d from the u L bar. So select all the columns from comments. Were the post ideas equal do our surgery perimeter. And then on the next line, we will have another variable with the name off S T empty. That will fetch our comments by using our dead obvious connection. And we'll call the Q T method on it and passing the ESC, you'll hear. Then we will have our while loop and we will have one variable with the name off data Rose Decked will use this object off ste empty and call the method off. Fetch on it. So out off, over common stable. We will fetch the date and time off over moment. The name of the commenter and the comment. We don't have toe fetch this column off email approved by our staters. The columns like there. So we'll fact only three columns, date and time Name off the person and also the common because it's a public page and we will not show the commenter email on this page. So I will have this variable within him off comment dead that will use our data rose and get our column off dead time. Then we will have another valuable with the name off commenter name that will fetch our Gholam off name. Then we will have another variable with the name off comment content that will fetch our variable off comment. Then we have toe show all off over comment in the STM in section. So I will use bootstrap media objects. So I will have this deal. We will start this David the span off glass off field info and I will put Commerz as our text here. Then we will have one do with the bootstrap glass off media. And inside this Dave, we will have another deal. The D Bootstrap class off media body. Let's add some margin, poet. So margin left would be two. And then we'll have one at six. Doug, in which I will use bootstrap class off lead and 40 content. I will put commenter name here. So it go this variable off commenter name, then we will have one p tag with the bootstrap glass off small, and we will echo all our date off the comment. So comment did will be here in a PSP scope. Then last year, we will have another Pitak in which we will ago the comment content here. They're still move these spaces from here. So we're using media objects off port strap so that we don't have to add the custom style on our comment block. So if I saved this one and the fresh this page off full post with the early 14 you can see I'm getting this one government. Although we have four comments for I d 14 it's just because off, not I creating every single calmer. So I have to cut this ending off. Why, Lou from line 1 64 and I will put it right after this deal. Enough BHP school. So if I saved this one and refresh my binge, you can see we are fetching all the commerce and we are having this comments span at every single comment, which is not good. So I can remove this ban from here from nine months 66 and let's put it before other PHP. So I would put it right here in Brookside. Couple of PR tag so that we can have spaces. So now if I saved this one hand, refresh my beach, you can see we have just one comments heading. And then we have the commenter name did it in time and the comment content. So in my styles Dorsey assess, I added this class off common block in which I just added this background color toe common PLA class. So now I can use this comment block class on my day off media. So I will add it right on 1960 years. So if I save this one and refresh my page for a three background you can see we are having this background, but it's not separating over every single commerce. So I can add the at chart bag after every single day of so adding it here. So, you know, refreshing your page. You can see it looks better. So these are the comments associated with I D 14 and only four comments are showing on this post. Same as what we have according toe the commerce stable. No. One more thing I want to show you here, and that is in my Seamus for point to 0.0.1 folder. I have this folder of images Image. I added this image off comment dart BNG. So by default, I will add this image to every single comment. So inside my Dave off media bright before the body, I will add this image bag image My images inside my images folder and its name is go meant dart being n G. Now, on this image bag, I will apply the media class, so display it in a block moored and for making it responsive. Applying the claws off I am G dash fluid. So if I saved this one and refresh my page, you can see, we have our image on every single comment. You can also make this image to show in the end, all in the start or in the middle. By applying bootstrap class, for example, you can apply the bootstrap class off a line dash self dash. And so if I save this one now, you can see that I were images showing at the end off this whole day. If you want to make it in a center, you can make this class toe a line self dash center so it will appear in the middle like this in case of the common content is a bit more. But I will go aligning self to start. So saving this one and refreshing my beach. See, now we have over common. Then we have the name off the commenter. Didn't time and the comment content? So that's it for extracting the comment. If I open some other post, for example, if I open disposed off life off insect, it has, the idea is equal to 13 and in my commerce stable. I have only two comments associated with this idea, so you can see we're fetching only those two comments on this post off every 13 and here I have a more comment on this post off lemon. So if I go to this 11th post, it's right here. I'd is equal to a lemon. You can see we are fetching only one comment. According to this, I d. Lemon, that's how we will fetch our comets. But as I said before, this whole comments part will not be Dax straight forward. These all comments will goto over Edmund and by Edmund approval we will approve or delete over comets. And in the table off comments, we will add the name of the person the name of the Erdman who is going toe approve over comments. Right now you can see the status off over commerce is off, which means they're not approved yet. So on this page or football start PHP in. Start off showing the commerce body four. I will make this were clause to show us comments only when this status column has an entry off on, Not off. So here in my SQL, I have to modify this. Ask your so select all the column from my table off comments. They're deposed. Underscore ideas. He called, Oh, sir. Scary perimeter. And then I have to add another. But I meter here, and that is adding the end operator. So this will be our one condition. Their desert kitty parameter is equal toe or post I d and the status column. Easy call toe on. So if I saved this one and just refreshed this speech with the idea lemon, you will not see any common because every single comment has the status off off. So if a goto disposed off, I is equal to 14. You can see not a single comment is showing on this page. So if I just cheat a bit and make this comment by Lucifer toe on, enter one were affected. So if I just refreshed this page, you will only see the government off Lucifer see like this. So we'll make this whole process automated in start off putting the direct value in our table. So in the next couple of movies were design our registration system. By that, we can add the Edmund. We will. Are the Logan function everything on our CMS admin panel. And after that, we will track the Edmund who is logged in and doing all the operation, and by that will add the Edmund name, toe every single operation. Inform off a log in our table off comments here in this column off approved by. So let's work on our registration system off this course. 37. 36 Designing Admin Registration Page: so for designing over commerce stable, I will use the file off categories dot PHP. So we'll have couple of fears by that file so that we don't have toe. Can I get a call from scratch? So this file off categories dot ph wheeler to save this file as edmunds dot PHP So in this file we will have our admin registrations. So first changing its title toe admin page Every single thing will be same. Changing its title toe manage add ones and the glass will be effort Dash, use a for foreign. Awesome. Bringing this page in our browser Now we will change this whole form. Here you can see online 115 We have this form. So first, let's change action Attribute from categories to edmunds dot PHP Method will be posed for hurting. It will be. I knew Edmund. We already have this field off category title, so let's make it Oh, use a name. Let's copy this whole form group and based it after two times. So the first field will be for user name and it's type will be text. Its name will be user name. Then for the next field, it will be for password. Its name will be password with the capital P. It's type will be bus word. Let's delete trips placeholder as well. The next field will be gun from password for confirm password type will be password. Name will be Gun Foam, Boss Word and deleting It's Placeholder. Let's also change the I D. So 1st 1 well before use the name. 2nd 1 will be for password. 3rd 1 will before confirm password seem as this four attribute. Let's also add one more field here, and this field will be for name. Stipe will be text, and it name would be named Alexa Air the placeholder hair insert off. Adding Lee Place Hohler, it's better to add the small tag here with the bootstrap class off text dash morning. And for the content, I will add optional here and also that supplied the poor strip class off text dash. You did on it for this optional Next. Then we will have over password feared than confirm password feared. Then we will have over two buttons. 1st 1 will be four redirecting to the dashboard or PHP, and the 2nd 1 will be for publish. So if I save this one and let's refresh this page. You can see this whole form here and it guard the optional here. Let's air hysteric with this optional so text warning is not working. So if I add text ash danger, it's still not working. Why? Because I think we have added text dash light class on our whole card. That's why this glass off text dash danger is not working. So let's to move this one. So if I see you this one and refresh this page, you can see we have this form. By that we will add our admin to the database. 38. 37 Adding New Admin in Db: So in order to add admin, we need another table in our database. So opening my PS three my ironman here you can see I have selected my database CMS for print to print one. And let's create another table So you can click here on this new button or you can click here on this name fear. So I will click here So this stable name will be Edmunds. It's column will be six for now. So click on Go! We created this table. Know the first column will be id'ing. The 2nd 1 will be dead time. The third column will be for user name. Next colon will be boss Word. The next column will be admin name. So I will add this one as on a name. And then we will have another calamity name off and did by so in. This column will add the name of the person who is adding this admin so the type will be in a different time. Will be watcher, user name, watcher, password will be vulture. A name will be vulture as well. Also added by length will be 10 15. He was a name will be 15 password will be 60. Admin name will be 30. Added by will be 30. So the idea will be auto implemented and also the primary key on it. And click on the save button to save the structure off this table browsing this table. So we have 123456 columns for now. So back to my editor, no going toe the PSP part. So the first will click on over Submit button in which we will have a couple off variables . So the first variable will be user name that will get the field off our use a name. Then we will have another variable with the name off Boss Word that will get the field off our boss word. So it will have capital P. Then we will have another variability. Name off. Confirm password that will get our feel off gun from password Richfield. This field right here that has the name off confirmed password. I'm just putting these names here. So the 1st 1 will be for over user name that has the name off user name. Then we will have this field. We missed this. Feel excited this one Next, then password and confirm password. So going up. So right after this field off user name, we will have another field with the name off name that will get us feel off name. Let's invent of accord. So then we will have another variable with the name off Edmund the person who is adding this admin by this registration form, then creating date and time for this m pretty condition this validation. I will make it if my use the name is empty or my feared off boss for December T although my fear it off Confirm pause for December t show error message. All fears must be furloughed and I'm not making this name fear, Toby Necessity one. I'm making it optional, so they're the person can add the full name off him later after being created by the existing admin. So we will show this error message and we will redirect Oh, edmunds dot PHP. Then on the next line, I will have this relation there. If my password length is less than, let's say full then say that boss word should be greater than three characters and real director Edmunds. Then we will have another valuation If my field off password and confirm password is not equal means. If they're not seem, then you should say that password and gun from password should match and re Director Edmund start PHP and else if nothing wrong with developed nation. Good. Ito, insert our new Edwin in Di VI and everything is fine. So saving this one, let's first check these relation So refreshing this page to bring the new PHP. So if I click on this publish button, you can see I'm getting this message. And if I a port, some user name like Joseph name Toby Empty one because this one is optional and password toe Want to 12 publish. I'm getting this error message posture bigger than three characters. So if I give it some name off Joseph named Toby Jones. Backroom pass for Toby. 1234 in the confirm password. 12345 Publish. Something went wrong. Cry again. So this validation is not working when password and confirm password is so In order to make this relationship work, I have to add the north symbol here. So if password does not match with my confirm password, show this error message so no if I refresh this page Prep school toe this admin start pH me so my user name would be Jaws. Ive name would be Charles. A back room password will be 1234 and 40. Confirm password. 123456 Publish. You can see pastor and confirm password should match. So the relation of working quite fine. I'm adding very simple validation on these ones. These fears you should add the proper validation on this registration system so that the new Edmund who's being created by this process have strong bus words. You can check out my course off regular expressions if you want toe, make your strong passwords. So no, everything is working quite fine. So let's air this hold our time, our table off, Edmonds. So back to my editor. So you re will be for inserting new element in our DVD and everything is fine. First, we will get our connecting db variable. Then on the next line, insert into my table off Hedman's and mentioning the column here. So the first column will be for their time. The 2nd 1 will be for user name. The 3rd 1 will be for over. Name has password, not name. So mentioning the 3rd 1 password here. And then you can see we have this feel off a name admin name. So adding a name, then we will have another field off and did. But that will see the person who is adding this new admin. So after that, we have to define the named perimeter. So the 1st 1 will be for date time. 2nd 1 will be for user name. Next one will be for password. Then we will have in name. And at last we will have Edmund name the person who is gonna add this new admin. No binding the values. So other start with date and time. So putting it act off so that everything should be in the order. Then we will have binding values for our column off user name. So you with the small one and and should be capitalized. And for the variable, it should have variable off user name. And then we will have another field. So binding it for password with the capital, the smaller p. And for the video able, it should have a password. We don't have to add the confirm password field because we'll do this validation on the form. We don't have to create another column for this confirm password field. So then we will have another field with the name off in name, so it will have a name, head. And for the variable, we'll have this variable off name which we got by super global post. And at last we will have this Edmund name that will save the admin variable. After that will prepare over a school will execute our curie. And if everything works fine, we will air this message that new admitted successfully we'll redirect with the same page off Edmunds Dark PSP, In case if something goes wrong, will redirect the same paid off Edmunds Dart, BSP. So if I save this one and lots of the fresh our page to bring this new PHP So our relations were working completely fine. So let's best this So the user name will be Josip. The name will be just a crumb. The password will be 1234 1234 Publish new admin, Eric successfully. So if a collect bro stab off this table, you can see we successfully added this new argument. So one thing to clarify here you can see I'm adding the password in a straight text. I'm not applying any type off password hashing or encryption on this password field. It's a long process, but it's a easy one. I already covered this whole topic off password encryption and hashing algorithm in my other course off BSB school organ and registration System, plus email activation, where you will also learn the strong validation techniques along with encryptions and hashing algorithm. So must tackle this course off ph preschool organ and registration system, plus email activation in order to learn the password encryption and hashing algorithm. And in this course you will also learn the strong validation technique so that you can make your admin page more strong. You can see I'm just applying the basic validation techniques here. For example, I'm implying this technique off. Checking weather patterns, confirm password feel match or does not match. These are very basic technique. So in this course off PSP school organ and registration system, we will bear the whole registration system from a scratch. You will learn all about registration system, so must check our discourse No, before ending this lecture. Let's add one more admin. So I will add this new admin with the name off dome and for the name. Let's make it empty for the past, for it will be 1234 Little 34 Publish added this new admin so you can see this one does not have any name. So let's Jane decision toe something different. For example, I can make it toe new admin the dean name off. And here I can echo this variable off name and I can put it in the caliber assists or I can simply can coordinate it. So if I save this one and they're tired when new urban so use the name will be John name would be for John D. Parts were 1234 new Edwin with the name off John D. Edwards successfully. And here you can see this new bagman so our user name will be completely unique so that one cannot have a similar user name as two other. So in the next movie, I will add this validation by which our user name will be unique. 39. 38 Check Username Existance: in this movie will air very simple validation. By that, our this destruction form would not be ableto ad our duplicate user name in our table. So the idea is we will have only one user name assigned toe one Edmund only so back to my Evita, right in this relations school. So if all off my feel off user name, password and confirm password is empty, show this all feel must be furloughed better if passport is less than four. Show dissenter password should bigger than three characters. If password feel is not equal to confirm password, Show this error message password and confirm password should batch. So right here I will add one other else it block so in. This s if blawg we will have dysfunction with the name off Jack using name exists or not, and in this function will pass our user name as an argument. And in the other message, we will show this error message that user name exists. Cry another one. Solar's defined this jack user name exist or not. So, in order defined dysfunction, I will define this whole function in this file or functions or PHP because we have only one function. So in order to make this final or to feed em pretty, let's define their function here. So defining this function that will have the name off Jack user name exists or not. And I have to cut the dollar sign because there's a function nor d variable. So as I have toe hurt this dollars, I'm from here. So our user name will goto this function off, Jack, use the name exist or not. And then we will come to this file here, and we will receive that user name in this variable off same user name. And here we will run our Jack. So we'll go toward database and specifically this table off Airman's in the column off. He was a name in case. If they're using them exist in this column, will show the other message. So in this file of functions or PSP, we're not including the db dot PHP file. So I have toe add the db dot PHP file at the top off my functions start peace. Be fine in orderto work with that obvious. So then in this file, I can have this variable because we include this file of baby dot PHP. So I will define it in a global school so that in case you're working with a lower PHP origin, you can still work with this course. So the next line will have this esque UAL in which we will have this curing. So Arcuri will say, Select all the columns or we can select just the one column. So it's better to select one column if we have no intention to work with rest of the column . So select my column off user name from my table off Hedman's there. User name column is equal toe one named perimeter. So I will add this named perimeter user name here and then on the next line we have toe first, prepare a rescue so we'll have this variable ste empty that will use our connecting baby and call the method off. Prepare in orderto prepare this that skill. And then on the next line, we have to bind our values on the object off testing empty. So calling the bind value method. And here we have toe passauer named Perimeter that is user name this one, and for its value, it would be the user name variable, which were the seeming. So we're standing this user name from line 24 from here. So this function off Jack, use the name exist or not, and then it will come here online salmon. Then it will go here. So then on the next line will execute our statement. So STM t calling the method off execute And then on the next line, I will have this variable with the name off result that will use the PDO function off row count. Oh, count number off rules which just holding disc ut. So I will call the method off a little gone off video. So on the next line, I will have this if condition in which I will say if this role can function which is equal toe this result. So if this reserved variable is equal, equal toe one return true otherwise in the else block, they're done false. So it's a very simple veneration which we will use later. Then we'll get a year, the logon page. So I'm saying here, first off, all take this user name by this function. Call online 24 and then I'm saying here, run this. Ask your image. Select the user name column off my table off Edmunds. There. The user name column is equal toe this name the perimeter, and I'm defining this name. Perimeter online. Lemon, I'm executing my ask your online 12 and then online 13. I'm using one off video function, which is row count, and I'm saving it in result. So I'm counting number off Rose which are holding this curie. So in case if the number off rose is equal to one, we will have the return True, otherwise falls. So in the return, true will have the other message off user name exist try and the one and we will redirect. Oh, edmunds dot PHP peas. In case if the return is false, we will insert our new segment. So if I say this one and first, let's refresh this page to bring the new PHP. And also we have to say this functions or PHP file. So if I can show you real quick, I already have the user name of Josip here in the stable off hardman start PHP. So if I just add, use the name of Does it begin named Toby John Pastor Toby 1234 12345 Wrong password in both field publish. I'm getting December possible and confirm. Password should match. So if I give it, use the name of Joseph, which already exists in my table and named Toby John. Passer Toby. Correct. 11234 1234 Publish. See, I'm getting this error using him exist dry another one. So if I give it one more, use the name which already exist. For example, If I give it Tom, So use the name would be Tom Name would be this one. Mohammad Imran Boss. What would be 1234 1234 Publish Still there at her here using him exist trying to the one. And here you will not see any new entry. So if I add some user name like Jaws Ib 321 named Toby John and password publish. You can see new admin with the name off. John added successfully and head. You can see this new admin with the name off Josip. 321 So this name field is empty. If I give it some user name, but not the name And just the password 1234 1234 Let's make this user name Crew Josip 89 publish. You can see new admin with the name off address successfully. And here is this new admin. So by using this simple valuation off jack user name exists or not, we have made over system nor to add the duplication off user name in our table off Edmunds in case if some using him already exist. 40. 39 Designing Login Page: In the last movie, we created our registration system. So in this movie will create our log in page. So first we have to design our log in page. So back to my editor, I will use my file off basic daughters Demon and I will save this file ass log in dart bsb . Nor first, let's bring this file in our editor, But before next changes title toe Logan clicking on log in north PSP So this is our Logan dot PHP file. Now, in this file, we will not have any type off list in the menu ba. So I removed all off these links from here because the basic purpose off this Logan pays toe give a little over the admin can logon. And it also recommended that there should not be any link off this log in page on your public domain. Let's remove first off all these list items. So right in this here, you can see I have this. You will list items, so I will remove all off my list items. So we're moving this one saving it and let's refresh our page. So I just have this jobs become dot com No, Let's also remove this header. So right in my head area I will remove this whole attack for 40. Awesome! And also let's move this basic from here. So if I save this one and refresh this bitch, you can see we have this header. These and why you are seeing this black harder here is because off this spreading wired ash tree on our header. And also I have this etch one. I m pretty tag here. So if I remove this each one, you will see a little bit off degrees end up hurting, See like this. But still, we have this burning just because off building by X is three. So after this header we will have just our foot on here. I will start with the comment here, so starting this mean area with one section and they're section will have a bootstrap cloths off container. And let's give it some reading on the y axis. So adding the petting And let's also give it some margin bottom or four. And inside this section we will have another deal with the bootstrapped loss off role. And then inside this develop floor, we will have another day with the bootstrap class off goal dash sm Dash six. Let's aired some style so that you can see the structure off this tale. So I've allowed the minimum height off 400 pixel, and for background, I will go badly. Rep. So if I saved this one and refresh this page, you can see we have this red deal right here. So I will tired All sir close to make this div in the center of the page. So adding offset First three column on my smaller screen. So as Sam Dash three I see No, it's in the center of the page. No, inside this, Dave, I will add ah, card in which we will add other form. So for adding card, we need another dev with the bootstrap glass off guard And let's give it some bag. Nordoff BGE, dash Skin dri and its text would be text dash light and then 40 card header. We'll have another deal in which I will have this edge four heading. Then we will have another deal with the bootstrap class off God dash boarding and it will have a background off BG dash dark. So saving this one and refreshing my page so you can see it right here. This is our body and this is our card header. No, let's remove this red color from here. So removing the regular from the background and no inside this Dev off Heather will not have anything else. So after that I will have this form and for its action attribute, will have this team beards off Logan Dart, BHP and the mattered off. This one will be posed. No. Inside this form, let's add couple off field. So adding one death, the deport, strapped loss or form dash group and then adding a label here. So the label will be for user name and then we will have on span tag that will have our custom class off field in full. So adding the text hair user name. Then right after our label, we will have another div for adding the input group all phone awesome. So it will have bootstrapped loss off in Port Dash group and it will have some margin toe the bottom. Then inside this year, we will have another day with the bootstrap class off in port dash grope, dash three bend, and then inside it will have span. Tag the D Bootstrap class off input Nash Group Dash. Next, it's text would be text dash white. And for the span tack, we'll have our phones. Awesome. With the claws Off affairs s C dash. Use it then. After this day will have our input field the D type off next and adding the bootstrap class off form dash control. Its name will be user name with the capital. You and its I d will be same as the label. So if I saved this one on refresh this page, you can see regard this import field with this foreign awesome prepared. Let's also change the color off this one so I can apply the bootstrap class on this pan tack so the class will BBg dash in four. I see no regard this guy blue color of the background now seem like this field. I can copy this whole form group and I can change it for my password field. So it will be for Boss Word and the phone. Awesome would be f a dash lock. And for the field, it would be name, bus word. I d will be possible with the Lord be and it's tied. Would be bus word as well. So saving this one refreshing my page. So after that we will have our Logan button. So right after this form group, I will add one in port tack. Your style would be submit its name would be submit as well and 40 class. It would be beating end beauty and dash info and Bt in dash block. So saying this one refreshing my page. You can see the guard, this person right here. So let's air the text on this button. I can already taxed in the value I keep your so log in 40 text. So if I refresh this page, you can see this log in Britain. So this is it for designing. You can see that this blackout is not occupying this Welcome back. So we must have placed it after the card harder there So you can see that this div is starting from here and it's not wrapping up our welcome back. So I have to cut it from 9 45 and I can put it online 44. So if I refresh my personal, you can see No, we have the background over whole body off black. You can have this car sticking here at this position, or you can make it a bit down so that your foot or should be placed right at the end of your brother So I can do that by adding couple off br tag around this card. So right before this card, I will add the BR attack. So if I save this one and refresh my beach, you can see we still need couple of BR tag. And in start, if I go with the minimum hired, so let's make it 500. So if I remove one off the BR attack No, it's perfect. Now in the next movie will are the PSP toe this Logan dot PHP page. 41. 40 Logging in: select air DPS people this Logan dot PHP pitch. So first of all, we need the basic includes here, and that is adding our database file, session, file and function for so right after Dad will have another PHP school in which I will start with one if condition. So if my button is set and my button has the name off submit. So if my Burton off some Matus said, then you should do all off this court. So first of all, we will take our user name. So I will have this variable off user name that will use the Super Global off, paused and get our field off user name with the capital you. Then we will have another variability. Name off, boss Word that will you dissed Oprah Global off post and get our feeding off password. So I'm just mentioning these names from the input field name. Attribute these ones Then after taking that will have on simple validation. So if my field off use the name is empathy by using the empathy function or if my field off password is empty, Dan, you should show error message that all feels must be filled out and redirect to the paid off. Same Logan dot PHP. And if that's not the case, you should have on else Lock in which we will write a record for checking Use animal pastor for database. So first, let's see this renovation. So saving this one refreshing the space to bring the new PSP click. Logan, we are not getting the other message. Why is that? It's because off not calling the session message function here in this file off Logan dot PHP. So I can copy does from my file off categories or PSP. So right here regard these fun can call so coping from here closing this categories dot PHP file. Now we have to paste it now, right after these br tag right before the card, basting it here, saving this one. So if I just refreshed this page, you can see a guard. This error message all fields must be furloughed. So then we'll ride Dick. You agree to check the user name and password. So, first off, all grabbing my connection off connecting DB and making it global. In case if you are using the lower region off ph me then will have this ask your That will be Select all the columns from my table off Edmunds There. User name column. The lower end should be equal. Toe this name perimeter off. Use the name that we will defy in a moment and password column should be equal to this named Ben Ami trough password. Let's make these w capital and also this end capital here. So the reason why I'm using an innovator because we have to check both user name and password and I will add one more clause here and that is limit one so that it will only give us success message when we have on leave on record according to the user name and password. Then on the next line, we have to prepare a rescue. So as TMT will be a variable by using the variable off connecting baby, it will use the method off, prepare and passing over SQL here. Then we have to bind our variable on ste empty object by using the bind value function off video. So for the named perimeter mentioning these ones and for its value it will be I want to use the name variable so seem like this We will have another binding for our password field. Then we will execute this whole one. So estate empty execute method and then we'll have the same scenario. What we did at the time when we did you start over, user, remember at the time when we registered over user, we have this function off Jack User name exist or not, in which we took the user name and we used the function off row count. And we said If this reserve is equal is equal to one return mitral advise fall so we will do the same thing here. So I will have this variable reserved that will be equal toe our sgmd object and will call the method off the role count off video. So in the next line I can have this. If if this reserved variable equal equal to one, then ico good otherwise in the else block eco bag. So if I saved this one and refresh this page giving wrong user name and password, click Logan. You can see a guard, their own line 18 and the hair is bad. So what's theater here? I don't bind the value off this password correctly because I have toe air The equal sign here on my curie. So if I save this one now and refresh this page giving wrong user name and password see bad and if I give it correct, use the name Joseph and Joseph spots, What is 1234 So passing the correct password here. See? Good. So it means that our Logan is working completely fine. So insert off. Having these message off good or bad will fetch the account off the person who is logging in. So all off this court that I wrote here, I will put it in form off a function. Got all of this gored from here and in my functions dot PHP file. I really fine. One function with the name off Logan. Underscore attempt. And inside this function, we will take you argument off user name and password variable and putting all off that gored here. So then we will check our user name and password. And if the row count is equals equals toe one will fetch our account. So I will have this variable off found underscored account that will fetch our dark record were dart user name and password horde. So using the function off Fetch and we will return. This. Found a coat and in the s lock with Elarton. No. So now I have to call this function off. Logan, attempt so copping dysfunction from here. And we will call this function in the else block. So right here I will have this variable off phoned account that will be equal to the logging attempt, user name and password function. So as we are returning something out off this function so we can equally returning value to some variable. That's why I put the phone account here. You can use another variable. What? Ever stick with the same one found account. Then on the next line, I will have this condition. If this variable off phoned account is true means if it's returning something then you should have a session message. You directo the page off dashboard dart, BHP and we have toe add the else block here as well. In case if this phone convertible does not phone, then we will have our error message that will say incorrect user name buzzword. Don't tell which one is incorrect and we will redirect to the same paid off log in dart BSP as we don't have this paid off dashboard toward peace before now. So let's make this one Toby Logan as well. So if I save this one and refresh my page so giving are wrong user name and password. See? Incorrect. Use an impasse word if I give it correct, Use the name Jazz, even Pastor Toby. 1234 Logan. See? Welcome, Edmund. So it's enough just seeing this message. We fetch our data. According to this user name and password here in this functions dark pH before at line 29. And we are returning this fast data out of this function off Logan attempt so we can use every single column off this fetch which is saved inside this layoff found account. So right here in this success block, I will add session variable. So adding session variable off, user underscore I d. And this variable will get the i. D. Column off the Edmund from here. So I have to put this smaller I d name here, so I can put it here and then seem like this. I will have another session variable devaughn, which I'm defining right now, and it will be user name that will use this a day off, phoned account and fast This column off user name. So you're putting this fast data in our session so that we can use this data from the session toe, Do all the operation off Edmund and put the name off Edmund wherever we need. So adding user name head all should be in the lower. Then seem like this will fetch another column. And that will be the name off Dykeman. So it will be admin name. Let's make it capital and admin with the capital and end capital and user with capital I. So then, for the name, we have to finish this column off a name so I can put the name here in the smaller one. So instead, off. Welcome, Edmund. I can make this message. Toby. Welcome. Edmond Naim. Session variable. That is stretching the name column. So if I saved this one on the refresh this page giving it wrong user name and password guard this message, so if I give it correct, use the name Josip. Possible to be incorrect? One Logan. Better if I give it correct user name and password to be correct. 11234 Logan, you can see we fast the column off. Welcome, Josh. A back room. You can also put the i d. But I'd evil not going to make any sense. Instead, you can put the user name off your Edmund here. So I did very simple thing here. I created this function off Logan attempt that is defined in this function fire. So we will select all the columns from my airman's table where the user name is equal to this user name, which we are getting, and the password is equal toe this named perimeter. Here I prepare the SQL. I defined the user name named Perimeter and also the password. I executed my SQL online 26. And by using the dough can function, I count the number off rose, which is holding this. Ask your so if the holding sq away rose are equal toe, one will fetch our account and save it enough found account variable and will return it. Otherwise it will be no. So we're returning this phone account variable from here, informer for day. So here I have the simple if block and I said if you have something in your phone, recalled variable, then fetched these three columns and put it in a session. And here I used that Edmund name and show it to the logon page in follow for welcome. Admin name. Then in case off error, we will have this. So that's how we create our Logan form. 42. 41 Tracking Admin Activities: So we faced our urban user name and its i d by using the logging attempt function. So it's time we can use the Edmund name in all the operation. Very need. As I told you before this session that I saved inside your browser till you open your browser and decision that I will be deleted from your browser venue. Close it. So now we have these Edmund I d. Name and use the name inside session so we can use it dynamically, though. So the first thing I will do here on the success I will redirect to the page off dash board dot PHP And for the other message will stay on the same page off Logan Dart PSP. So if I save this one and first, let's to the fresh about Paige. So giving it Use the name off Joseph and possible off 1234 Seen only on the page off Dashboard art being me. So now we can use this admin name at every single place, so I will copy this session admin name from here. And first off, all opening my categories dot PHP. You can see online seven. We have the default. Admin Josip. So now we will make it dynamically by adding their session variable here. So if I save this one and first of all, let's log in from over a dread win. So you can see we have this. Use the name of Tom with the password off. 1234 So I will go to the page off Logan Dart. PH me. So we will give it using him off dawn password off. 1234 So now we logged in from the count off, Tom. So if I save this file of categories dot PHP. So the current session off admin name will be equal toe this variable off, Edmund. So it's completely up to you whether you want to put this admin name here, or you can put the user name here, but I will go with the user name because this admin name field waas optional at that time when we created our registration. Bitch, let me show you where. So inside this speech off edmunds dot pH me. We made this name. Field will be optional one, and here you can see that we have nothing in the field off admin name for this user. Name off, Tom. So at the time when you will not have the admin name, it will show you just the welcome message or for welcome. Otherwise, it will show you this Edmund name as, uh, session variable. Let me show you again. So if I go to Logan dot PHP file If I log in from the count off Josip Logan, I'm on dashboard dot PHP, which we don't have created right now. So if I just goto this Hedman's bitch, you can see regard the message. Welcome Josip a crumb and hear jazz. It has the name of Charles. I become. So if I goto log in page again and use the account off Tom and password here. See, we are on the page off dashboard art pH. Me. And if I go to the Edmund speech for the section message, you can see we are just getting the welcome here. So developed a message will have the admin name, but for all of the operation off person with creating categories, adding new pose reading arrangement will stick toe the user name off our Edmund. So in this category dot PHP page our Edmund variable will be equal to recession. Variable off user name. So if I see if this one and go to this page off categories dot PHP and add new Got to get it off science publish. Got to get your successfully. Let's bro's this category page you can see No, we have this author off. Tom are the place off category where the title is sons So seem like this If I log in from the account off Joseph So if I give it category title off blundered ICS publish Got to get your successfully. And here in my doctor obvious You can see this politics category added by the author off Jazz it so cool, right? So I can do the same thing in my posts page. So opening air, New post you can see we have the default admin so we will make it dynamically by putting the session user name here and will equal our admin variable. So this one. So now if I add new post publish well studied successfully. So in my post page, you can see we have this new post and the admin name is equal to Josip. So we do have a more place toe are the session user name and that is in my edmunds dot PHP file. At that time, when we are adding the admin, we will add the admin name. So I will Are the session variable here off user name saving this one. So if I go to my page off edmunds dot PHP and their new admin off Xerox Oneto one publish. So if I goto this Edward Page, you can see this new admin which is added by Josip if I, Logan from the other account off this newly created Edmund Xerox Oneto one supporting that , using him here and putting the password here. 1234 Logan, you can see we are on the dashboard RPs beef. If I defect this admin page, you can see regard the new session message here zero. So if I add one new admin here within him off using him to be Zoe Boss Word 1234 Publish new Edmund with the name of silly bond address successfully. And here you can see that the use animals are you triple tree added and the Edmund name with the name off Zyban and added by this Xerox Oneto one. So wherever you want. Oh, add the name of the person for different operation. Make this variable off. Dollar admin, tow session, user name. So that's how we will track every single activity off our admin on this Seamus block. 43. 42 Logout Page: in the previous movies, we created our Logan pitch, and everything is working quite fine. We are able to track every single activity off our Edmund. So in this movie, I will design the log out page. So first off own logo page will be very simple. One. We don't have to show that page anywhere. So I will create another file with the name off. Log out dark being to be so in this file, we need our basic function file and session file. So I will require those fires in my logo dot PHP page. And inside this file, we'll take our sessions and destroy every single session. Because in this file of sessions Dart BHP if I can show you real quick, we are starting over session at line two. So we're starting over session and line toe, and then we are putting some data in our session. Inform off error message, success message and on Logan dot PHP paid, we're putting user name and Edmund name and user. I d inside our session variable. So in order to log out, we have to destroy our session. So we started our session from Sessions Door PHP. So on, Log out page. We'll destroy our session. I will use dysfunction off session underscored destroy to destroy our session. And also, we have toe equal these variables. User I d user name and admin name equal toe. No. So that these variables these data from the database from the table off Edmonds should not be present in ever. Broza. So I will copy all of these variables which we are fetching. And in my log out door PSV paid just before destroying my session, I will make all of these variable equal toe no. So making my user i d equals No, no. Making my user name equal to know making the Edmond Naim equal toe. No. So now we made all of these variables equal to none. Then on the seventh line, we will destroy our session, and then we will redirect the person toe the page off log in dot PHP. So if I save this one and go to first log in Dar Ph me, Logan from my count off Josip seeing I'm on dashboard RPS ppd. So if I go to the paid off posts nor ph me, you can see we already added this logo button that has the link off logo dot PHP. So if I click on this logo dot PHP see normal Logan dot PHP pitch. So it means that our sessions has been destroyed. So that's how we designed over logoed dot PHP page. So if I log in from my count off, Joseph, I'm on this post dark PSP paid and you can see the name off has become So if I echo the name off my Erdman who just logged in on this page off post dot PHP So right here online for if I go the session message off. User, I d. Here, save this one. See? Regard the session I d off one. And here you can see Joseph has the i d. Off one. If I go the user name off the person you can see, we are echoing the session message off American D does it here. So if I browse my page off logoed that is making all off our variables off. I d name and adman named to know and destroying the session. So if I go to this longer dot PHP page, I'm on my log in dark victory page and if I try to access this variable off this variable off session, use a name on this page off post door pH. People just refresh this page. See, I'm getting the other, which means that over user name is not set anymore. So if I log in again from the account off someone else like Tom And if I just refresh this page or forced door PHP, you can see No, I'm getting the message. So it means that our low guard pages working completely fine it making all the session to be destroyed and the associated session variables to be know as well. So that was very simple. To design this logo dot PHP page, we don't have to add anything in the speech, but still, we have toe make our admin page to require a password and those pages which lies in the public domain such as blogger dot PHP in full post or PHP as a public page without Logan required. So in my functions dart PHP file. I've redefined when function here with the name off conform Logan so defining dysfunction here and inside dysfunction. I will have this if condition. So I will check whether my session. He was ready. Set or not. So I will put decision here that if this session off use an I d is set then and it done me true otherwise. And this enter message that Logan required. And the director the page off Logan Dart BHP. So I'm saying here basically, if this session user I d set returned true otherwise make my page to be password protected and redirected the Logan dot PHP. So I will add this confirmed log in on every single page, which I want to be password protected. So starting this page with this paid off post start PHP. So removing this echo from here and instead we will have one B h B school in which I can call this function off. Confirm Logan. So if I save this one and first of all, go to this page off boast, you can see a guard their own line 39 on my file off functions dot PHP. So where's theater here? The damn semicolon. So saving this file refreshing. My page. See, I access this paid off both start PHP. So if I click on logo button now, all off my session has been destroyed. So now if I try to go into the file off posts dot PHP, you can see Logan required. So if I try to access my page off categories door PH me, I can access it. So if you want to make this page Toby password protected, just call dysfunction off. Confirmed Logan on your category speech. So right online for I will call this function off confirmed log in. So if I acquire to refresh this page, you see, I guard the message logging required so I cannot access this page off categories dot be it me boasts dark, be it me. But I can still access non password protected pages like at Mons Dark PSP. So it's timeto add it first in the air New post page. So calling dad function here conform Logan. Then in the file off admin start BHP then we have categories, then calling it inside this delete post beach. Then edit bulls dot PHP page here. We don't have to call dysfunction inside full post because full post PHP page will be for the public. We don't need it inside. Log in page also low garbage. And we already added it inside this post RPs people. So, no, If I click on boasts page, you can see Logan required. If I give it logging off, Joseph, I can go to any paid off post start ph. Me categories dot PHP Admin start being me. I can never get toe any page I like, but I can go toe any pH I like, but if I close my browser from here and opened my browser again So I told you that when you close your brother, all of your sessions get deleted automatically. So no, If I try Togo topo start PHP page. See message. If I tried to go in tow edmunds dot PHP Logan Dark bsb Logan required. So giving it to use the name off. Tom. See, I'm on my dashboard dot PHP page and I can access any pitch I like. So whenever you close the browser, your session will be destroyed. And in the case, if you want to add our remember me feature on your paid off Logan dot PHP, you can check out my course off BHP school organ and registration system, plus email activation. Very will also learn how you can add the remember me feature in your registration system. So to summarize all off this lecture, I made this logo out page image. I destroyed all off my session and made all of these variables to know and most place dissection destroyer After making your variables to know and then inside my page off functions dart ph. B, I could get to dysfunction in which I said, If this user I d said then return true. Otherwise, give this error message and I call this function in every single file wherever I want to make that file. Boss Word protector a corner in our new post category dot PHP edmunds dot fears were delete poor start ESPN at it postdoc PSP. 44. 43 Tracking URL: in this movie. I will make this log in process more efficient. Let me show you what we are gonna do in this lecture. So, for example, if I give it some user name off Josip and password. But before that, for example, I come to this speech off boasts dart, be it be. But it redirected me to the page off log and dot PHP just because off this confirmed log and function, so know if I give it my user name and password. It sent me to the paid off dashboard or PSP, which I was not wanted at the first place because I wanted to be on the page off posts dot PHP Then I did the first Logan attempt. Let me show you again. Click log out. So now if I go to my paid off, get the goodies door to Ph me. See, I'm on Logan dot PHP. So my intention is to go inside my category speed. So if I give it my user name and password, See, I'm on dashboard or PSP page, not on the category speech, which was my intention. So in this movie will build this system toe track every single page and send the admin toe the page there. He wants. So back to my leader. So right on this. Paid off posts right Online four. Let's make this confirm. Logan Online six and online five. I will define another session. Variable with the name off directing you are l. And this variable will be equal to the super global off server that can help us get the existing page name. And in this paid off post door PH. B, it would be posts, Lord PHP so we can get the name off this page by using server PHP self so ph b underscore self here. So out off the server, super global. I'm selecting the PHP sof that will take this post dark pH be here now, if I can show you real quick but echoed this session tracking your own on the next line. And for a moment. Let's go, man. This confirm Logan. So if I save this one and go to this page off posts Lord ph. Me, I see. No, we decode the directory, Seamus. 4.2 point one, and then posts dot PHP. If I uncommon my conform Logan and put the same thing in another piece, for example, in categories dot PHP and bro's this page off categories I see no, we have categories dot PHP in this variable off session tracking euro, which is using the silver so per global off BSB self. So let's comment this eco statement and we have to modify our log in page so that it could send us to the page where we want. So right in this Logan dot PHP pitch in the phone account success block. I will add one if condition here. And I will see if this variable off session tracking your URL is said so putting it here. So if this variable is set, then redirect so that page off Session UL so I can put it here and then I can wrap up the dashboard redirection in the else block. So what I'm saying here in post not ph, be equal the server toe. This tracking your on It means that we are creating this session off tracking Ural Variable and on the six line Let's common this eco. We don't need it anymore. So in my Logan dot PHP in the success block, I'm saying if this tracking you're a variable is said. So when we'll try toe goingto post or PHP, it will execute discord and online. Five. It will clear this session off tracking euro and then, by this function of confirmed organ, it will redirect us to the log in page and then in the log in page will do all of this good . And if we found account And if our tracking you analysts said, we will redirect our Edmundo that tracking Ural Variable Page or otherwise the default page will be dashboard dot PHP. So if I save this file and first off all, let's log out now if I try to go into my paid off posts dot PHP, I guard this message Logan required. So no, if I give it to use the name of John as a pastor to be 1234 See now I am on my post dark PSP page, not on dashboard or PSP page anymore. So if I want o share the same functionality on every single page, I have to put this one line in every single pitch, so I will put it in my categories dot PHP Page and I will put it then in my air new post page. Then I will put it in my Edmunds Beach and for delete posts and other post. I don't have to do anything with them. So that's it. So if I close my browser now and open my browser gain? No, If I try to go into my page off, everyone start being me. I got this error message Logan required. So giving user name and password token. See? No, I'm on my Edmund speech, not on dashboard page anymore. So if I click on this logo button giving you the name of Josip and Posture to be a crime giving you the name off Josip and possible Toby 1234 See, I'm on my dashboard or PSP pitch. So that's how we can track you are by using the Super Global off server 45. 44 Restricting Login Page: in this movie will add very simple check on this log in dot PHP page. So let me show you what we are gonna do. So if I give it my user name off jasmine possible Toby. 1234 You can see him on dashboard dot PHP page so it means I can go to any peace I want. I can goto post page category speech, management speech And I can also go to the same paid off logging dot PHP Although I'm still logged in So this is not good at the time when you are already logged in this spade off log and dart BHP should not be accessible so I can make this log in dot PHP page nor to be visible. Then the admin is already logged in. So back to my leader right in this file off Logan dot PHP Right online five. I will add one if condition here. So I will say that if my variable off session, which is dollar underscores session off user I d IHS said Then you should de detect my admin toe dashboard dart BHP. So I'm saying here, if this user i d variable is already certain. Then send the Edmund do the dashboard dot PHP. So the dressed off the cord will not be accessible, so we will not have all of this s t m o will have just any direction. So if I save this one and first off all let's goto over paid off, log out So we looked out successfully. If I try to go into my paid off posts guard this error message So giving my user name and password So I'm on my post speed Now if I try to go into my page off log and dart pH b c I'm being redirected to the paid off dashboard art PHP Let's do it one more time. So Logan dark Ph me? No, I'm not able to access my log in page anymore until I log out. For example, if I go to my local page, I'm on Logan Dark PSB. I can give it some user name and password. CMR dashboard dot PHP If I go to my advance page, I can do that. But I will not be able Togo into my log and page because I'm already in the state off. Logged in 46. 45 Comments Page: we completed our registration process along with Logan and Low Goat in the previous movie. Now we'll move back to the place where we left, and that was giving Erdman authority to approve or disapprove comments. For example, if I click on the street more Burton, you can see that we are fetching one comment here. Administrators off on. So really design one page with the name off comments start PHP on which the Edmund will be ableto approve or delete comment. So I'm gonna open my file off basic dart sdm Oh, and I will save this file as Goldman start PHP Jane younger startle and now going inside its header so it will be manage comments and for photo summit will be f a dash comments. Let's go to the speech So this will be over paid off, managing comments. So let's air the content here. So going toe the place with our head is ending. So instead, off this BR tag, I have a starred with one section that will have the bull strapped loss off container. Let's give her some bedding at the Via axes with margin bottom or four and inside here we will have one death with the bootstrapped loss off roll. Let's give it some minimum height off. Let's say 30 p X, then inside of a room will have another day The D bootstrapped loss off coal dash L Jean Dash blow. And for high it, it will be 400 pixel. Let's air the comment at the beginning and ending. So inside this deal, we will have as to tag unapproved comments. And then we need to fetch our comments from our table. So adding PHP school. So first off, all clapping over connection. So, in orderto work with the database, we have to include the basic and Klores. So I'm gonna copy all of them from here, including the Conform Logan. 12345 line hoping it and pay Stick it inside this commerce file right at the top. No, I can work with murder. Debbie's here So global connecting Devi and then writing the sq oh, for fetching all the comments. So select all the columns from my table off comments. They're the status column, physical toe off and order by I d de es si. Then on the next line, we will have this variable execute that will use our database and used it mattered off Q t passing a skill here. And then we will have one variable within him off S r and oh, that will be equal to zero. So that we can I trade every single column, inform off a sequence then we will have on while loop docked will use this variable off that are those. And by using this execute, it will call the method off video that is fetch. Then here we will have couple off variable, so first variable will be go meant I d and that will use over variable off data rose and the column off i d Then we will have another variable with the name off date time off comment that will fetch the data in Time column. Then we will have another variable with the name off commenter name that will fetch the column off our name. So going inside my calm and stable will fetch this column off the person name from here. So I will put it right here. Then we will have our comment content variable. That will fetch the column off this comment. So I didn't get here and then we will have another variable with the name off. Go meant boast I d that will fetch this column off post underscore idea in case if that men want to see the life review off that post. So mentioning. Boast underscored i d here. So this will be the PSP to fetch all the records where the comments status is off. We can show all of this data informer for table, so I will add one table. So right in this, Dave, I will have one table that will use the bootstrap class off table Gabler, dash stripped and table dash whore. Then we will have de head that will use the bootstrap class off. He had dashed dark. And then we will have on d r tag in which we will have over the Etch deg. So the first column will, before the serial number. The 2nd 1 will be for name of the person. 3rd 1 will be for date and time, then the actual comment. Then we will have action. Then Dean deals. So this will be the head off over comment. Let's move this as two heading from here and put it right before the table and let's remove this table ending from here. No menu toe. Add the body off our table. So right here I will add Jagoff Peabody. And after that, we will have over ending off table. So here we will have our TR tag in which we need couple off de de Dag. So in the first duty will echo the S R number and we need to in agreement here so that we can have that's on and no in a sequence. So for the 1st 1 I will add one PSP scope in which I will echo. This s are in the 2nd 1 I will echo commenter name. Then we will have aware date and time variable. So it called this one. Then we will have over comment content here. Then we will have bottoms off action and that will be approved button and delete button here. And at last we will have anchor tag