Posts

Showing posts from April, 2018

Why PHP Array Functions are so important?

I was building an API for Android. I used Lumen  as its blazing fast and based on PHP. And ready to go framework. Everything was easy and fun. But, at one moment I got stuck. I got stuck to return a specific data. As my database was designed by the client and also result was also fixed by the client. The result was odd, in one JSON  object the clients so many values with same key or name. But that's not possible. So, What do I do? without changing the database structure. I got an idea to put a key [ex. 1,  2, 3 so on] with each key name so the name will be unique for the JSON object. In that time, I faced so many difficulties. As I had to return some data from the database and store them in an array. And the most pathetic part was that, the database return data with some values, from those values I had to use some data one times and some data several times. It got me mad, then I tried to DISTINCT   the data, but  DISTINCT   caused another error of escaping all of the necessary

Mouse Right Button Click, CTRL +U disabling in HTML to protect content from Copying and Viewing source by visitor

In some rare cases, we need to protect our source code form visitors. Sometimes, for security reasons, to safeguard source code from hackers . Disabling is easy. It can be done in three steps: Add the attribute to any HTML Tags Add JavaScript code to disable some KEYS with the onkeydown event Add JQuery to prevent a combined key event. <html lang="en" oncontextmenu="return false" ondragstart="return false" onselectstart="return false"> Warning: If add these attributes in body tag then, right click will work where the body tag is finished [in such case, where the page body doesn't feel full display of the browser] JavaScript Code <script> document.onkeydown = function(e) { if (e.ctrlKey && (e.keyCode === 67 || e.keyCode === 86 || e.keyCode === 85 || e.keyCode === 117)) { alert('You are not allowed to perform this action.'

Create WordPress Admin from cPanel or MySQL or phpMyAdmin

Image
Sometimes  we need to create admin user from hosting or cPanel. In that case, simply adding any user in wp_users won't work even if we put proper password " Salted Hash ". It will surely log you in but you won't be able to see the Dashboard, To activate this superpower you will have to edit wp_capabilities from " wp_usermeta " and the value will be " a:1:{s:13:"administrator";b:1;} ".