Tips & Tutorials – PHP

Sessions In PHP (Very Simple Guide & Examples)

Welcome to a tutorial on how to use sessions in PHP. So you have heard of this session thing, and trying to figure out how it works? Call session_start() to start the session. We can then use the $_SESSION superglobal like a “regular variable” to store and retrieve data. For example: $_SESSION[“color”] = “Red”; echo $_SESSION[“color”]; …

Sessions In PHP (Very Simple Guide & Examples) Read More »

How To Implement CSRF Token in PHP – Really Simple Example

tWelcome to a quick tutorial on how to implement CSRF token protection in PHP. Working to further secure your website, or just stumbled on this “CSRF token” thing on the Internet? Well, it stands for “Cross-Site Request Forgery”, and this token thing is nothing more than a random string in the session. The simplified steps …

How To Implement CSRF Token in PHP – Really Simple Example Read More »

6 Ways To Delete Files In PHP – Simple Examples

Welcome to a tutorial on how to delete files in PHP. Need to remove some old, backup, or temporary files in PHP? To delete a file in PHP, use unlink(“TARGET FILE”); To remove an empty folder, use rmdir(“FOLDER”); That covers the super quick basics, but “advanced deleting” entire folders and only certain file types are …

6 Ways To Delete Files In PHP – Simple Examples Read More »

PHP URLencode VS RAWURLencode – What Is The Difference!?

Welcome to a quick tutorial on the difference between urlencode and rawurlencode in PHP. So what are these used for, and why are there two different versions of “encode URL”? Which one is correct and which should we use? A URL string cannot contain white spaces and characters such as @+%. For example, http://site.com/my path/?email=jon@doe.com …

PHP URLencode VS RAWURLencode – What Is The Difference!? Read More »