Hello, I am Deepak Jain, I am working as an RA under Phatexer, I am also an M Tech student just now finished my second year, so I am going to give a talk on PHP, PHP is a server side scripting language, the server side scripting language is the scripts are executed on the server and it is the HTML is outputted to your system, it is what it is different from, how it is different from javascript is that javascript every operations happen on your client system, so whatever logics are sent to the client and on the client scripts are happening, if you are clicking a button and it is doing some operation it is happening on the client, but for PHP those scripts if say every PHP scripts end with an extension PHP, so if you open a PHP file that is executed on the server and the HTML are outputted to your client system, so the syntax are mostly borrowed from C language in case of classes in PHP it is borrowed from Java and some of per languages, so if you know C it is not at all easy to understand PHP and it has several inbuilt functions like floor seal which you might have used in C, so it won't be difficult at all, so I will just cover little bit on installation, if you have to install PHP the Apache server and MySQL in case if you want to connect to a MySQL, so it is the combined package is called the LAM server it is called Linux, Apache, MySQL and PHP, you can install the LAM server combined it is so much easier than installing one by one, but you can install like this also, so do I have to get install Apache 2, it will install Apache and PHP can be installed separately like this, once you install restarted any changes you make to PHP configuration file you have to restart Apache so that the configuration will take some effect, now I will come to the syntax of PHP, every PHP statements start with this PHP and your statements and question mark and closing this one brackets, so you can actually avoid this PHP here also, but it is not advised to use it, it might work on some systems, but it might not work on every system, so this PHP is the must for a ensuring that it works on every system, so the comments which you write on PHP has the same as C language comments, it has for a single line comment you can use double slash and for multi line comments you can use same as C everything this is same as C and every statement sends with a semicolon same as C, if you miss a semicolon what happens is you will get something called as wide screen of death some people call it, so you miss something you will write some 10 statements and you miss out a semicolon in one, it won't display any errors, this is because by default PHP is set for development server, so on the development server errors are normally turned off, so if you want for example you write a C program you make some syntax mistake it displays errors, but in PHP by default it is a developer server settings, so you won't get an errors and you simply get a wide screen, it is called wide screen of death or whatever, so you have to turn on the errors first of all to check on PHP errors that I will show you later, normally this errors many people doesn't use beginners, but if you use errors it will be very helpful for when you are working with a big file, like big website file, when you start a big website, when you start running then it might give any kind of errors and you won't solve it unless you have this error, you can turn it on errors and solve that, I will cover that later, so once Apache is installed you can check like this, if Apache server is run on your system then you can type local host and it shows this it works, this page is fetched from this link, this location, if you go to the root directory of your Linux system, if you go to your bar folder and www.folder there is an index.html, this page is fetched and that page is shown here, so you can edit it whatever you want, this page is I have to open in write mode actually this is a permission is denied for this page, this is the page which is fetched when you first install a PHP file and it fetches from this location, so any PHP you want to test or any HTML file you want to test, just put on this put your files on this location and you can start testing, from now on I am going to test my files from this location PHP, so what all files I put I will access through local host and PHP and I will access from here, so this is how you test, we will test a demo program first.php, you can just echo anything, this echo is a very good command, you will be using mostly this command, if you are not using that error detecting methods you probably test your codes for error basically using this method only, you just simply echo it and you will see where it stops execution, so either you can, so echo is a very, you will be using this a lot, what it does is it just simply prints whatever you write, that is it, so I open the file and PHP file it executes this, so you want to check your versions, version number of your PHP you can use this function, PHP info this is a function which instead of echo I am putting this function, it displays which version PHP 5, your system detail, some server variables, this variables you will be using in your program frequently, your server address for example right now mine is a local host, so local host either it is local host or <IP_ADDRESS>, so in many situations you need to check your IP of your system, then you will use these variables, I am running this PHP on my system, so this is my local host address, if you are running this PHP on a remote system, these variables will be changed to the IP of your remote system, you can access the remote system IP address through this variables, I will tell you how to access these variables later and variable initialization, so in C you will be declaring variables, here you do not need to specify int or float or any specifiers for that, you just if you want an integer variable use it like this var 5, var 5.3, variable 1 that is variable 1, variable 2, you can use it, when you write for example 5 plus var 1 plus var 2, variable 1 plus variable 2, the program determines whether it is int or float and it takes care of it, so you do not have to specify it is float or int, so this is similar to C, C style all operations integer float, every variable starts with this dollar symbol, so if you want to assign some value to it, you put a dollar then the variable name, variable name has the same syntax as C syntax, so start with underscore or variable name say for example apple whatever, and I can if I want to assign a string to it, I can put like this, I do not have to specify either it is string or like that, I can put numbers into orange is equal to 6, so I simply can put like this, so one if I want to concatenate these two, some frequent operations which you use are concatenation, I will show how concatenation can be done, I will put a third variable and concatenate both, I will not, first I will make this as string, so you want to find it if you want to, sorry there is an error here, sorry I have not closed the semicolon, so I have turned on errors, that is why I can get errors, so it shows at line 10, I have not specified dot, so if you have to combine, I missed out the dot, apple is a fruit and orange is a fruit, this is a combined string, I will probably set, next most frequent, not most frequent you will be using string to lower, string upper, these all are mostly similar to see a function, if you want to convert a string you pass it to a function, in build function, string str to lower is a function, string str to upper is a function, you input the string you will get this, so if statement is similar, if a condition, statements, else this C type syntax, I will, in the end I will make a real world some small application where I test all this if, else, while and everything, so arrays in PHP, arrays you can like normal C style arrays you can use, one of the specialty here is, you can in C only indexed, arrays are indexed only by numbers, you can use names as the index, for example this is C type C style, array of 0, so 0th index as PHP and first index as Java, this is the second type, this is the type which PHP has one extra, you can index an array using a string, so for example I have indexed the array, this is my array name and this is not a normal integer index, it is a string index, on this, so normally in normal integer index 0 and integers are the key, here the strings are the key, so in this key PHP I have stored some numbers, so if I have to access, I can access similarly array of 0, it will have the value of PHP, in case this string, in this array of string I can have, so this is the one advantage of PHP arrays, this is normal C type of array declaration and using the values, there is one more type you can use in PHP supports, like this, so this is the array variable and this is like you have to read like form an array and at this location store this, and form an array and this is also the similar to this type, so two types of array methods you can use, so this is also the same, form an array of with PHP as a key and has the value 5, Java as the key has the value 1.6, next I will talk about forms, forms are one of the most important, widely used things which you do in normal PHP, I will create this, you might have used forms HTML forms, so what I am going to do is that, so what I am going to do is that, I am going to create an input form, it will have values to enter, for example name, this age, your age or whatever, these are all text boxes, button and when you, there is a button called submit, so when you press this submit, it is sent back to that PHP engine and it process this and it feedback say you a new page, so this is an example, so this form, so there are two files, first there is a form, it can be either HTML or PHP that does not matter, the processing form here it is going to be a PHP only, I am going to post this data to this form and this form process whatever datas you have entered and it displays a new page and this page displays you a welcome, say for example you have entered dpk and this page returns you welcome dpk like that, so I will start with this, a form, small form creation and I will slowly move on to sessions and cookies because if, what is that, okay I will talk about sessions later, first I will do this, so this is my form.html, I am going to create two files, one is a form.html, it can be PHP also, since I am telling about PHP I will create that PHP and a receive.php, this form.php has the HTML elements which will post datas to this receive, this receive.php and this processes it and gets back the data to the user required, so this form.php, one specialty with PHP is you can embed HTML, PHP in between, in between itself like you have, you can embed PHP inside HTML, HTML inside PHP, so I will, this is one style, for example there is a HTML, say HTML, I should have explained this earlier, HTML and there is something for D, this is normal syntax for HTML, so this HTML will work on PHP because this same with PHP code does not work with HTML extension but every HTML as you type, as a normal HTML it work with a PHP extension, so this I will execute, there is only one header, form.php forms example, so if I want to put an in between PHP script inside this HTML, all I have to simply do is start a PHP syntax, every time close it, so you will have this, then echo which you print to the screen, so you can insert some, say HTML element inside this itself, input type is equal to, before that I will just echo a small thing, so this will come here, this is PHP inside HTML, sorry it is outside inside, so this is one type, so inside this PHP I can put HTML also, for example this is a PHP code and I am going to put HTML elements in this, say an input box, you normally create input box by, I will create this here, so that you will first have a look at this, input, this is how you will create a HTML element, input type is equal to text, some name if you want, because if you want to submit some data there should be a name to access it, this is how you create input text box in HTML, so you can input the same code from a PHP also, so what is the problem here, there are the problem with codes, I have started with the code and there is one more code inside, so one way to solve this problem is you can escape the codes which needed like this, I will tell the other way later, so now the input box is inside the PHP code and I am opening the page again, this is your text box, so one more way to solve that coding problem is, code problem is, you can keep this as such and use single code for this, sorry this is not single code, so in this format you do not need to escape this, I will say probably put one more name, so you have two text boxes, so this is PHP inside HTML, HTML again inside PHP, so let us, I am going to remove this, if I want we will use this, so I am going to create an input box name called name, so there is only one box called name and I am going to create a submit button, so this submit, right now I am going to refine, restrict only with one data, I am going to just submit the data of this one to some other form, so I am going to create a submit button, so if I enter something here, if I click it, it will submit, but where to submit, actually we have not created a form, so you have to enclose these data to a form, so that you can submit that, so you have the buttons, but where to submit this, for that you have to create constructs, so these are the two elements, enclose them with a form, now it can be submitted, but where to submit we still have not specified, that is specified by this action, I am saying receive, submit to this page, which is specified by this action, receive.php, submit this two elements and which methods to use, there are two methods, you can use get or post and the method difference I will tell later, right now I am just using method is equal to get, okay, now the data are there, so what happened here, so sorry, I have entered the data, I have clicked it, see right now it is form.php, I have clicked it, it went to receive.php with a question mark, tv name is equal to dp, so this is that action, this is the submit, it has submitted, but there is no, this receive.php is there, but it does not know what to do with the data, because we are not coded it, so right now it is a blank page, now we have to code that receive.php to accept this data, dp and process and give back new data, so the method difference between get, for example if I use this post here, these are the two difference, post here, if I submit it, you will not see that data, so the exact difference why you are not getting this I will again tell later, now we will ready the receive.php to accept this data posted, again this should be a php code to process, so this name is the important thing, so I am going to access in receive.php this input text by this name, tv name, so I have to access that variable, to access post variables or get variables you have to use this get of tv name, tv name was the name of that text box, you get data from that tv name and store it into some variable my name or username, get from that data get and store it into that variable, so this is called associative array, so you will be using this, you will be seeing similar kind of syntax more often, instead of get there will be post, instead of this, just this variable, just this will be replaced by session cookie, everything uses the same syntax, so server this, so just changing this name, just look at this syntax, this will be used very often, so instead of get there you can use post here or server variables, all are access using the similar kind of syntax, now I have store that variable, now I am going to display it again back, so I have got that variable and I am just storing it and using that to print hello username welcome, so this is the page, one more thing, I have used get method, I have changed it to post, I should use get only, if I have to use get here, if I use post here then I should use post here, I have used get, so I have changed it, now I have posted, I have typed it and I am posting this data, so you got this, tv name is equal to jn, so this is obtained here and this is posted here, you can post anything, you can, so I am posting this, hello welcome, this is a string from php this page, so in php if you want to have a, what to say, a new line then you have to input the break, line break along with the string because it just keeps on putting strings to the server, then what you get is the html here, so in html what happens if you do not put a break, unless you put a break, whatever strings are there it is just simply displayed, so you have to put a break if you want a new line, you have this, so this is normal forms, I hope everyone understood forms, any doubts and forms, how they are, which one, html, received on php I have an echo, there are two files, which source, so actually I am not following that html, you have to follow standard, when you are displaying you have to put html and all, so actually suppose your browser normally renders it, but it should not, you should always use html and headers and all for a normal html, right now it is just nothing, your browser displays it, if you see the source code it is just yellow break, even if you are writing a normal html and without that html syntax body it will work, your browser may, some browser might work, some browser does not work, so now it is implied that you have posted the name Karthik, so you do not have the, for get method this is the thing, you do not even need the form, you just simply can give like this and hello Karthik it takes, so what happens is that get method is anything follows this question mark and anything follows this or it is implied that it is a get method, so if I use post method I cannot do this, if I use post method here, post then I have to receive here through post, there are no URL parameters, this is the difference between get and post, so the logic of using get and post you have to, sometimes for testing you, for testing forms you normally use get method, so you can test what all you are passing, but for you do not want to see, sometimes you do not want to see what all parameters the user has posted to the form to the user himself, so at that time you use post, so you want the user to look say what all parameters he has passed then use the get method, but normally security forms you just do not want, you just simply use post method only, you do not want the user to himself to see what he has posted, so for example I am using instead of tb name I am creating a name, for example new variable, new variable is equal to, so I am using this, so what will happen, any guesses, there is no variable say I will execute this, undefined index tb name, so it is the receive.php is expecting a variable called tb name from the get method or post method, sorry I have to use get here, it is expecting a get variable, but your get variable of name tb name, but what you have passed is new variable, so what you can do is if I change to new var then probably this url will work, you do not need a form, hello Prithik welcome, so it process this, so this new var is this new var, so for post method this would not work because you cannot use a url, you cannot get through url, you have to use some other JavaScript method, but it will be covered, it will not be covered in this session, next before sessions I will tell about include and what is the next one, require two functions, so what it does is in a php I will say there is a small site, for example this is my, this is company site, just some demo data, just do not care about, so there is a small page, hello world welcome to our website, we provide services, so there is a index page of this company server and it has two links, so what will be a small demo company page will look like it will have an index page and it will refer to some links, so that is how it is a simple page, it is a starting page and it has links to say about page, contact page, so for that I have two pages about page and we have established in the year 1995 and there is a page about page and there is a contact page, so two pages this is the main page, so I am opening the index page, so hello world welcome to our website, this is the company's main page or demo company's main page, so there are two links about us, contact us, so if I click about us, that about us page has this data we have established, so it is displaying, you all know, I think you all know about HRF, it is just a link, HRF, AHRF about our PHP about us and contact us, so I have this contact us page and in this place you can contact company ABC number etc, so what is the advantage, I am going to talk about require and include, so normally in company website or any website in general you see a header, a common theme for all pages which you are displaying and a small footer which is a common theme for all pages, so what does include, include what it does is if you have you can write a PHP, if I write include, include is a function and it includes a PHP file, include, say I will create a file called header, so this header is going to be my theme of my theme or right now I am not going to show about CSS or JavaScript, this header.php will be repeating on all pages, so this is say a company called selling bicycles or whatever, H1 called A1 bicycles, so this A1 bicycles I want this page to be repeated on all pages, so what I can simply do is include that header or PHP at the start of my index page, so when I have one thing I have not put index.php here, even if I put index.php or anything just what it does is when you fetch a page from a folder it first looks, the server looks for index.html or index.php and it fetches, so for any page if you want to start the index.php or index.html you do not need to specify index.php, that is why my site it open as such, I do not have to specify index.php, it is in like that it is index.php, so this A1 bicycles it is fetched from this header.php to index.php, I want the same thing to about us pages also, about us page right now does not have anything, so what I will simply do I will it is called header.php, I have included to about the same thing I will copy to contact.php, so from index I have not updated, so if I access about it has A1.cycles, if I access contact us it also has A1 bicycles, now I do not have to copy that same header file again and again to all pages, so whatever new page I create I just simply copy the header and put on all pages, else what should I do is every time I create a new page I should copy this text and put, so what is the problem here, this is a small text here, but in complex website are some big sites it is a collection of so much files, so you do not want to repeat it, writing the entire thing on your every page and make it obscured, so this is the on method, so I am going to write one more string here, so now I want to update my header, I just simply what I do, I just edit in my header page itself, so this is the header page, I updated just the header page and since I have not done any changes to index page, just updated the header page and all about us page or contact us page as this, so even this also I can put on header itself, this about us, contact us, even this links I have to, I can add to the header itself, so for example if you go to about us that link is gone, so where is that, so this also even you can put in header, so it will repeat on every page, those two links are this, I will create one more link called home, home and the link to that is index.php and I copy this three to the header, so now I update home about us, contact us, now all the pages as this three, it is a small menu, so you can apply styles and you can start creating your own website, small website, I will change the menu type, it is like a menu bar, small menu and every pages this is the header, so it repeats at every page. The same header can be done for footer also, instead of this header file you create one more php file called footer or what you can keep any name, so once you ended here you have to include that, for example I have include a header file, you have to include the footer file also, then your main page will have header, constant header, constant footer everywhere, but for footer what is the problem is the alignment and html white spaces will not be replaced as such white space, if you have any syntax here and you display some new element this white space are ignored, so if you want to display a footer right at the end you have to do some CSS works, so CSS styling you have to do that I am not going to cover, next I will be talking about sessions, so you have small website where you can, where you have data about the company, now you have to give your information to the company website, for example you have logged in to this page and you want to log in, basically you want to log in to the, think this as a gmail, you have opened this and you want to log in to this page and login users can get more details, for example I am getting only home about us contact us, if you logged in maybe you want you can see more details, so I have to basically provide a mechanism to log in and differentiate between normal user and logged in user and I will show more data for logged in user, so for that we can use either sessions or cookies, the difference between sessions and cookies is sessions when you open a browser, if I open a browser and in the PHP file if I started a session, then I can store variables on the website until I close this window, once I close this window that session is gone, so there are something called persistent sessions, the persisting sessions I will not talk about that, but just think of like this, sessions are like if you close this session variables will be gone, for example shopping cart, flip cart or online shopping mechanisms, so you click the first product and first product for example you have clicked some book Harry Potter book or whatever, so that book I can store into the session variable and I can continue purchasing more, I can continue selecting, add more items to the cart, so I can store those values I chose to a session variable and store them till I finish my shopping, so I can use either sessions or cookies, so cookies is the next mechanism, cookies is the difference is that cookies is visible, you can go to your cookies also, it is also storing I can for the same shopping cart, I can store the variable to the cookie, so I can once store it will be on your browser for some expiry time, you have to tell when the cookie should expire, that you can specify and if you go to your, if it is firebox and you can go and clear, sorry you can go and check the cookies of various websites, say Google has stored a cookie and called NID and it expires at something, so it is expired already, so what is this Thursday, it expires as Thursday, November something 9.25 am, it has already expired, so Google would not be needing this cookie anymore, maybe it will say one more cookie, so what I am going to do is, I am going to show two methods, one is session, I will make page to login and store your logged in information as a session or a cookie, first I will show a session, maybe I should show as a cookie, cookie is more easier than session, I will make a small backup, my website with say, I will call it as my website with cookie, now I am going to add form elements, because this form is only, through this form only I am going to post data, time is 9, through form only I am going to post data to the server and I am going to login, probably I should copy, okay, action, so what to do with the page, before going to this, any doubt with include, one more thing, include the next one is called require, both does the same thing, if I use, instead of include, if I use require, it also tries to fetch this page, the difference is that if I turn on the errors and if I use include and if the header.php does not exist, it just reports a warning, if you, then it continues executing the next thing, but if use require, it will report an error and it will fail at that moment, so this is the difference between include and require, so this is the form, my form is ready for this page, this new site is my site cookies, this site is my form, I will write say enter your name, login details, login details, entire your name, so now I have to prepare the receive file, I am not specified method, I am getting that variable get, so I have received the, read it the receive page also, right now I will remove this something, it is looking so much ugly, I will remove some header files, it is looking too much, I have removed the header also, okay, index page and this is your login page and then if I enter, I have not done mechanisms for cookie, I am just showing whatever I have done so far, submit, sorry I am not specified, okay, okay, so I am submitting, it just displays logged in, but I have not actually, I am not storing it anywhere, so I want to store this data, so how to store, this is the method set cookie and it has two, three parameters, first is the name, value to store, you saw that Google it has stored a cookie with the name NID and this is going to be the name and I am going to store a cookie with the user name you entered, user entered and this value can be anything, say I am going to say some special value, this will mean little bit later, so right now let it be special itself and the time to expire, when this cookie should expire, this time is the current time, current time plus you have to give the seconds when to expire, I will say for example if I give 60 then it will expire in 1 minute, if I give 60 into 5 it will expire in 5 minutes, I am going to expire, make this cookie expire in 1 minute, 60 that is 60 seconds, I just can give just 60 or just 60 into 1, it will expire in 1 minute, so I am sure I am clearing all the cookies just to show that there is no cookies, there is no cookies here, cookies I am submitting this, now a cookie is created, see the cookie is created for the local host, if I am executing this I am showing the values then the cookie name is Jn and that content is special, this content is the content which web uses use for storing some information, so this content can be anything, right now I just entered special, cookie is content and it expires at 9th May, 9th May, 1226 right now, it is going to expire in 1226, 41, so we will wait 30 seconds till that I will explain, okay, there is a cookie and I am using that cookie using set, username and the special variable and the expiration time, it will expire in say some seconds, few seconds, so how to use that cookie variable and show that in the main page, that I will tell now, waiting for the expiration, okay it is it should be expired by now, expired means the time has passed, I cannot use this, I mean it will be there but it is expired, you cannot use it like that, okay, now how to use this cookie to in the main page and display that you have logged in so and so, so this is your main page, so I am checking this, before starting the main page I am checking that whether a cookie exist or not, so like that time previously I said you this syntax will be used mostly, so the same syntax is will be used, I am just copying so that you will get more understanding of how that variable is not at all changed, so cookie, so instead of get it is the cookie here, the cookie name I have stored using, oh sorry, I should actually have, I should have stored the user name to be uname so that I can access there, so I have stored user name and the special variable should be your name, so that I can fetch that and store, so the user name will be the content of the cookie and the cookie name will be uname, so that now the cookie will be stored with the name uname, so that I can access the uname here and display if it is present or not, one function is used, check is if set, is set, is set of this cookie, if this is set, if is set of this echo logged in and your name, so what it does, it finds whether this cookie is present or not and then displays the value present on that, so the value present on that is the your user name, so this is my cookie site and I have entered your logged in and I am refreshing the page, it shows that logged in Deepak, so if I change the name here, so if I refresh this, it shows logged in, so how to make this log out, so I am creating a button called log out, so in case of cookies you, for making that expire is so simple, you just set the time, expiry time to a reverse time before, say time minus some few seconds and it will be expired, so I am creating a log out button, sorry, I have made the constraints for log out, if I click this I should make this cookie expire, so I will make a page called log out and in this page what I do is I copy the same thing what I did, I am going to use the same set cookie, only thing I am going to do is I am going to set some reverse time, so sometimes earlier than current time, so minus say 1 minute, so this in log out, log out this name does not matter because you are going to expire the cookie, so you do not have to say anything, you just say anything, nothing, so I am setting this cookie, so it is already expired what I am setting is, so nothing should happen, it is already an expired cookie, so I have made the provisions, if I go to main page, and if I press log out, the log out is done, I have to go to main page, headers and features, now one thing instead of going back, I want to make the user to go back to the main page automatically, so what I can do is you can use header and you can specify a location where to go, so what happens is when I go log out, it goes to the log out and it displays nothing, you have to come back, so you want to automatically redirect, then you can give this, it is as simple as that, just header this, so I will put the same thing there also, sorry in receive.php after setting that, I am going to redirect to the main page, sorry it is not redirecting, yeah it is redirected, so it went to receive page and it set that name to the cookie and it redirected to the main page, index page, so when I log out also, it went to log out.php, it set the cookie with some reverse timing and it redirected to the main page, so this is cookie, so any doubts in cookies, next will be sessions, so for session I am going to copy the same thing, the changes are very little, the difference between for sessions are there are no visible, you cannot see the sessions as such, so the changes I am going to make are, this are all same, same thing, receive.php is there, logout.php is there, I am going to just make the procedure different on that receive page and logout page, so what is difference between in sessions is instead of set cookie, I am going to there is a constraint, you have to start a session for that, so for sessions this is the thing, you have to start the session, so in index.page itself I am starting a session, you start a session through this, session start, which means that something session is started and you can store as many variables to this session as possible and whenever you set the variable you can access till you close the browser, you can access those variables, so session is started, you have to use the session start here also, else if you try to set some variable here, variable will be set but if you try to unset early problem, so you have to use session start here also, now I am going to set a session variable and in that session variable I am going to store your user name, the user name I have entered, so like I said that time this is the same syntax, instead of this get method for sessions it is session, so I am going to for sessions, yeah for sessions I will use the start, I will create a session variable like this, session or the variable will be username and what is stored in this, the name you entered, the username entered will be, I will put a name way different so that you will, so the name is the input name and I am going to make a session variable called user name and going to store that thing, so that session variable is set, you do not need this one cookie, this also you do not need and this header page will redirect to the index page like the previous one, so on index page instead of this what you have to do you have to change to session and instead of cookie session and at logout page you have to unset here that is the difference, unset and unset that session variable, so this is all the changes, now I will go to the session page, so this is now fetching this page now sets the session, session variable and it redirects to the main page and for the main page it is when it starts again it checks session is on then it logged in that session name, so for logout same thing, it is not happening as there is some mistake, so I am logging out, so as I said the session start is needed on every pages, so that is all for sessions cookies and any doubts in sessions cookies, so on thing of when to use sessions and when to use cookies is some application demands that some user does not want cookies to be stored on his browser, so sessions will be ideal at that time, so it is an implementation method which one to choose, so just knowing this include session, header then what else, if for loop you can almost do any pages, so for each for if you want to know about any syntaxes you can use this php just search this there is a website and this php.9 manual is sufficient enough to for once you know what you can do with the php and this you can use this manual to do you can do anything, so you can do many things with session cookies, headers, include forms, so you can almost it is you can develop many pages, so other explanations are not needed I think forms everything are sufficient, one more thing is files but it is easier you can cover files, this is small thing a function to check whether the directory I am not going to implement this it is already 230 is directory and open directory and read those files and display it, so you can use anything, so I am going to end this session any doubts, now one problem with this cookie is I am setting this cookie in the cookie page I am setting cookie from the server, one particular problem we faced is that if server times are different this when you set the cookie from the server right now my server is my system, so when I said the time here, the time here time to expire, it takes the server time like for example 1240 at the server it was 1240, 1240 plus 41 it is set at the server but when it comes to your client that is client this time may not be client at the time may be different, so it may be already expired, so this is one problem we faced in quiz module we said the time at from the server and when developing all were in same system, so times were not different but when we deployed it server time and everything was different, so when we start a quiz that there is a time difference and it just expires after some last 2, 3 minutes there is a time difference and there was a bug, so at that time what we did is instead of this we send some script to the, so we can send scripts to the client through JavaScript through you can actually put send scripts, so in the script we set the cookie from the client, so that problem was solved, so many problems like this come you can solve it you have to look when to use cookie whether you will set variables from the server or client, so combine JavaScript and PHP you can solve the problem but where to use either set at client say JavaScript or this will be a problem which you have to by trial and error method you will, so Java and JavaScript will be taken care later, so I am ending the session.


Today we're talking about poop. Besides being a very taboo concept, a taboo aspect of society and something that my patients have a lot of discomfort around sharing, it's very important from a Chinese medicine perspective and I thought I would use this video to explain some fundamental Chinese medicine concepts that can help you understand what's going on with your body as well as just understand it in a general sense. So your natural tendency towards certain bowel movements reflects certain things about your genetic or constitutional makeup as well as diet and lifestyle. So let's talk about this more. Hey guys, Dr. Alex Hein, Doctor of Chinese Medicine and author of the health book Master of the Day. So before we jump in, I have two very important links below this video. The first is for a free download which is four daily rituals that can help you add years to your life with traditional Chinese medicine. The second is if you'd like to become a patient of mine locally in my private practice or virtually via telemedicine, the info from my clinic is right below this video. So let's revisit the fundamental question here. Is this person on the more yin or yang side of the spectrum? Now remember these are not just Taoists, people doing Tai Chi, monks with their top knots. This is also a clinically very useful concept. Understanding if this person is their natural body type more on the cold side of the spectrum, the warm side of the spectrum. So that also applies to a person's bowels. So do they run more cold? Most of my patients that run more cold are generally prone towards more sluggish bowel movements. And if they have constipation, the stools are not ordinarily very dry and pellet like. Some are like that, but most are on the colder, weak digestive function side that have more of like an anemic look, pale face. These types are often prone to softer or wetter stools. Alright, now on the other side of the spectrum, you have people that often have good color on their face, probably even redness in their face or their chest, sometimes more prone to acne. In general, these people can sometimes tend towards manifesting harder or drier stools, but lifestyle plays a big role in that as well. So what do these mean? Alright, if you are manifesting more wetter stools or incomplete bowel movements, but if you experience constipation, the stools are still on the wetter side, they're stickier, they're not hard and dry and cracked. Often this means if it's wet that there is too much moisture and not enough warmth from a Chinese medicine perspective. Alright, now on the other side, if stools are hard and dry, there's too much dryness, too much heat, and not enough moisture. But these can each show up in many different ways. You know, some people, you take two people, they eat a huge pizza the night before. One person gets explosive diarrhea the next day, the other is constipated for three days. So those differences are also very telling as to how the body manifests a response to let's just say discomfort, something unbalances it, something that is problematic. So in the same way, a person who's ordinarily prone to wet stools, confusingly enough, can also manifest dry stools. Let's say you're ordinarily that person who has a little bit of digestive problems, specifically with bowel movements, the stools are usually on the softer side. And then you eat a huge footlong sub, it's a ton of bread, you don't ordinarily have that much bread. And now you don't have a bowel movement for maybe two or three days. And now the stool comes out in the beginning is actually hard, because it's been sitting in there for too long of a period of time. But after that, the stool is more soft. So sometimes these mixed kind of manifestations can happen as well. Sometimes it's because the person has experienced constipation, so the stool is drying out itself, it's been in there too long. Sometimes it's because there's a specific dietary factor, like having overeating, for example. So let's talk about a few simple dietary suggestions that can help. If stools are more on the dry side, this kind of person, if that is your general tendency, you have more redness in the face, more moderate or bigger body type. Typically these people do better on a more temperature neutral diet, meaning things like rice, things like more sauteed vegetables, this person could even do some salads, avoiding things like coffee and alcohol and a lot of heavy spicy food, avoiding heavy food, things like that. So more temperature neutral diet, where vegetables, green tea, a lot of fruits are more on the cool side and things like meat, coffee, alcohol, many of the things we associate with being like heavy or rich things, but not all, but most of those can be on the warming side. So if you're experiencing more wetter or softer stools, moving more towards a more warming diet, more temperature warm, temperature warm meaning animal proteins, meaning more spices like using more ginger, using more cinnamon like cinnamon in your oatmeal, as well as this person, you know, coffee actually may help them, really depends on the person and their constitution and what's showing up, but in general, the more warm side, the more drier stools, the more cool side, the wetter stools. And so understanding this diet needs more temperature neutral, this one needs more temperature warm. So the problem is a lot of the people that I see who have these wetter or softer stools are often tending towards diets like vegetarianism or veganism or raw veganism, even worse, or they're doing the medical mediums, celery cleanse drink. That's one of the most cold substances you could consume from a Chinese medicine perspective. And so people will experience very often an exacerbation of their symptoms on specifically raw vegetables or some of the coldest things that are the hardest, if you already have weak digestive function. So on the cold wet side, no raw vegetables, cooked vegetables, add more meat back in there. That's very important because I often see that this constitutional type is prone towards, for some reason, wanting to eat raw vegetables and salads and things like that, which can be problematic. So that is what these two things, these two symptoms mean in a very, very general sense, not taking into account your diet or your lifestyle or what you ate yesterday, or if you drink one cup of coffee or six cups of coffee a day, but in a general sense, that's what these imply about your body. All right, so that's what I have today for you guys. Again, two very important links below this video. One is a free download for four daily rituals that can add years to your life with Chinese medicine. The other is if you'd like to become a patient of mine in my private practice, there's a link below to contact my clinic, as well as a full number there for you. All right, before you go, I have two related videos right here as well.