Posts marked with "Posts" in posts

Log In With Username / E-Mail in PHP Login System

If your login system have both username and email parameter, then you can allow your users to log in with username or email. This is very easy for users, because if they forget their username, then they can log in with their email address. I will tell you an easy to way to set up log in with both username and email. It’s very easy.

A change in your SQL query can make this possible. Here’s how to do this.

... [READ MORE]

How To Download & Extract Zip Archives in PHP

If you used WordPress before, you know that when you do plugin installation action, WordPress automatically downloads and extract the plugin zip file. If you’re app needs something like this, you will find this post useful.

PHP has the Zip Archive Extension. You can see the php manual for installing ZipArchive Extension. The usage of ZipArchive extension is very easy.

Download

For downloading, we will use cURL. First we create a blank zip file, download the zip file from server and put it’s contents to the blank zip file we created.

... [READ MORE]

Get Absolute Directory Path of Current File in PHP

If your code is including other files, you will encounter problems like “The file is not found”. This is because, PHP doesn’t know the absolute path of file. So, if you are including files on another file, you should mention the absolute path of file.

But, If you’re PHP application is being used by other people, then the absolute path which you mentioned in your system won’t be the one of the others’ systems. So, you have to dynamically mention the absolute path that will work on any systems.

... [READ MORE]

Check If A String Is JSON in PHP

In my previous post, I gave the isHTML function that returns if a string is HTML or not. In this post, I will give you a simple function of different ways that helps in the detection of valid JSON string in PHP. The function I’m giving are fast, easy and doesn’t take up too much CPU memory.

Method 1

JSON (JavaScript Object Notation) can be made in to a PHP object using json_decode. If the return is not an object, the string we gave is not JSON. This is the principal of Method 1 function.

... [READ MORE]

Check If A String Is HTML In PHP

HTML detection can be hard, because HTML is complicated and there aren’t any good 100% parsers for HTML. RegEx won’t help you in detection, so you need something else. The trick to identify HTML which I’m gonna show you is very easy. It’s fast, short and doesn’t use RegEx. You can simply use an if statement to check if a string is HTML or not.

PHP’s strip_tags function when given a string, it returns a string that doesn’t have any HTML / PHP characters (according to the manual). So, if we give a HTML string to strip_tags(), it strips out the HTML code from it and return a normal string.

... [READ MORE]

Disable Cache For Web Development In Chrome

If you’re developing a web page in Chrome and some changes you applied to code doesn’t take effect on the page, you will be angry. You will look and look into the code for errors. But it’s not the problem with your code. It’s the problem with the browser.

The resources loaded on the page are cached. Hence the changes made to the code won’t be applied. So, you need some way to disable the cache.  If you look around the Chrome Settings page, you will see an option – it’s Clear Browsing Data. If you do this, you will clear the entire cache. Even the website which you want the cache (like Facebook, Google +).

... [READ MORE]

9th Grade Is Over :-(

Today marks the end of 9th grade in my school life. It’s been a wonderful journey with a lot of laughs and seriousness. Got nice grades in the exams and all ends well & happy. Today, my classmates went wild. We celebrated and celebrated until the window was broken. The student who didn’t break the window with consciousness got beat up by the principal. It was painful to watch and hear his screaming.

... [READ MORE]

Disable jQuery Migrate Loading In WordPress Blog

If you run a WordPress blog with all the new stuff (functions) and still WordPress loads the jQuery Migrate on your blog, you will be angry (I know hot it feels). The jQuery Migrate file’s minified version is about 7 KB and the unminified version is about 17 KB. That’s a file you don’t need if your blog’s jQuery functions aren’t deprecated.

What’s jQuery Migrate ?

jQuery Migrate is a JavaScript file that adds the jQuery deprecated functions to the page which makes us to use the deprecated functions of jQuery.

... [READ MORE]

Posting Code Blocks On WordPress

If you’re a web developer or a programmer and have a programming blog set up in WordPress, you will find it difficult to include codes in the posts. There is no tool in the Visual Editor toolbar menu to automatically wrap a piece of code into a code block.

So you have to manually go to the Text version of the post and add the code in HTML <pre> or <code> tag or inside <pre><code></code></pre>. As you can see there are different ways to embed codes in your post. So, why not add a tool that satisfies this. I’m very happily introducing the Code Blocks Plugin, an easy plugin that adds a Code Block tool in the toolbox of Visual editor and Text editor.

... [READ MORE]

WhatsApp Acquired By Facebook For $19 Billion

The giant mobile messaging service WhatsApp has been acquired by social network giant Facebook for 19 billion US dollars. This is the biggest acquisition by Facebook in their 10 years. Facebook is making it’s way to enter the mobile communication world.

0104

The acquisition will make the WhatsApp CEO a billionare. This acquisition will make benefit to both WhatsApp and Facebook. Both companies’ CEO has been in discussions for 2 years. And the time has come for WhatsApp to sell to Facebook.

... [READ MORE]

Follow/Subscribe

Telegram 

Mastodon  Twitter

GitHub GitLab

Subdomains

Demos  Lab

Past

This blog was once on WordPress. Now a static site. See source code on

GitLab