Category: PHP
-
PHP Sessions
What is a Session Although you can store data using cookies but it has some security issues. Since cookies are stored on user’s computer it is possible for an attacker to easily modify a cookie content to insert potentially harmful data in your application that might break your application. Also every time the browser requests…
-
PHP Cookies
What is a Cookie A cookie is a small text file that lets you store a small amount of data (nearly 4KB) on the user’s computer. They are typically used to keeping track of information such as username that the site can retrieve to personalize the page when user visit the website next time. Tip: Each…
-
PHP File Download
Downloading Files with PHP Normally, you don’t necessarily need to use any server side scripting language like PHP to download images, zip files, pdf documents, exe files, etc. If such kind of file is stored in a public accessible folder, you can just create a hyperlink pointing to that file, and whenever a user click…
-
PHP File Upload
Uploading Files with PHP In this tutorial we will learn how to upload files on remote server using a Simple HTML form and PHP. You can upload any kind of file like images, videos, ZIP files, Microsoft Office documents, PDFs, as well as executables files and a wide range of other file types. Step 1:…
-
PHP Parsing Directories
Working with Directories in PHP In the previous chapter you’ve learned how to work with files in PHP. Similarly, PHP also allows you to work with directories on the file system, for example, you can open a directory and read its contents, create or delete a directory, list all files in the directory, and so…
-
PHP File System
Working with Files in PHP Since PHP is a server side programming language, it allows you to work with files and directories stored on the web server. In this tutorial you will learn how to create, access, and manipulate files on your web server using the PHP file system functions. Opening a File with PHP fopen() Function…
-
PHP Include and Require Files
Including a PHP File into Another PHP File The include() and require() statement allow you to include the code contained in a PHP file within another PHP file. Including a file produces the same result as copying the script from the file specified and pasted into the location where it is called. You can save a lot of time…
-
PHP Date and Time
The PHP Date() Function The PHP date() function convert a timestamp to a more readable date and time. The computer stores dates and times in a format called UNIX Timestamp, which measures time as a number of seconds since the beginning of the Unix epoch (midnight Greenwich Mean Time on January 1, 1970 i.e. January 1, 1970 00:00:00 GMT…
-
PHP GET and POST
Methods of Sending Information to Server A web browser communicates with the server typically using one of the two HTTP (Hypertext Transfer Protocol) methods — GET and POST. Both methods pass the information differently and have different advantages and disadvantages, as described below. The GET Method In GET method the data is sent as URL…
-
PHP Math Operations
Performing Math Operations PHP has several built-in functions that help you perform anything from simple additions or subtraction to advanced calculations. You’ve already seen how to perform basic mathematical operations in PHP operators chapter. Let’s check out one more example: Example Every math operation has a certain precedence level; generally multiplication and division are performed before addition…