How to tell if its a leap year with PHP

This article will guide you on how to work with PHP date() function to work out if the current year, or a specific year, is a leap year or not. 

JavaScript is the client side scripting language and PHP is the server side scripting language. In #PHP, HTML is used as a string in the code. In order to render it to the browser, we produce JavaScript code as a string in the PHP code.

PHP #program to check if a year is leap year or not:

php #function year_check($my_year) { if ($my_year % 400 == 0) print("It is a leap year"); if ($my_year % 4 == 0) print("It is a leap year"); else if ($my_year % 100 == 0) print("It is not a leap year"); else print("It is not a leap year"); } $my_year = 2024; year_check($my_year); ?>

Read More




Vim Show Line Numbers in Linux

This article will guide you on how to show line numbers in #Vim. You can ask #nano to temporarily turn on line numbers by pressing Alt-C (meaning “Hold down the Alt key and the C key simultaneously”). This will show line and column numbers near the bottom of nano's window.

To Turn on absolute line numbering by default in vim:

1. Open vim configuration file ~/.vimrc.

2. Append set number.

3. Press the Esc key.

4. To save the config file, type :w and hit Enter key.

5. You can temporarily disable the absolute line numbers within vim session, type:/> :set nonumber.


Use the “:set number” command if you want to enable absolute line numbers; or “:set relativenumber” for relative Vi numbers.

If you want to turn off the line numbering, remember the command “set nonumber.”

When you have both absolute and, hybrid numbers enabled, you’ll have access to the hybrid mode!

Read More




Add User To Group in Linux

This article will guide you on how to add a #user to a #group in #Linux. The group permissions apply only to the group that has been assigned to the file or directory, they will not effect the actions of other users. The others permissions apply to all other users on the system, this is the permission group that you want to watch the most.

Groups can be thought of as levels of #privilege. A person who is part of a group can view or modify files belonging to that group, depending on the permissions of that file. User belonging to a group has privileges of that group, for example - sudo groups lets you run software as super user.

To view all groups present on the system simply open the /etc/group file. Each line in this file represents information for one group. Another option is to use the getent command which displays entries from #databases configured in /etc/nsswitch.


To Create a New Sudo User:

1. Log in to your server as the root user. #ssh root@server_ip_address.

2. Use the adduser command to add a new user to your system. Be sure to replace username with the user that you want to create.

3. Use the usermod command to add the user to the wheel group.

4. Test sudo access on new user account.


To List Users in Linux:

i. Get a List of All Users using the /etc/passwd File.

ii. Get a List of all Users using the getent Command.

iii. Check whether a user exists in the Linux system.

iv. System and Normal Users.

Read More




How Chmod 777 works

This article will guide you on how to give #Chmod 777 to folders and files in #Linux. We also discussed the risks and more information about file permissions. 

If you are managing a Linux system, it is crucial to know how the Linux #permissions work.

You should never set 777 (rwxrwxrwx) permissions #files and #directories permissions. 777 means that anyone can do anything with those files.

To Give Root Privileges to a User in Linux:

1. Adding to Root Group using usermod. Let see how we can grant normal user root access by adding to root group.

2. Adding to #Root Group using Useradd Command.

3. Editing /etc/passwd file.

4. Setting as Sudo User.

Read More




SMTP error 10051 How to resolve

This article will guide you on the causes and different methods to solve SMTP #error #10051 which occurs due to improper #SMTP authentication, ISP #firewall issues, #Antivirus on #PC, and so on. You can generally find your SMTP server address in the account or settings section of your mail client.) When you send an email, the SMTP server processes your email, decides which server to send the message to, and relays the message to that server.

To fix email not connecting to server:

1. Check your internet connection.

2. Check your SMTP server details.

3. Verify all usernames and passwords.

4. Check your SMTP server connection.

5. Change your SMTP port.

6. Control your antivirus or firewall settings.

Read More




VestaCP mail not working How to fix

This article will guide you on different methods to resolve #Vestacp #mail #problems which generally occurs mainly due to #Exim problem, firewall issues, and so on. This tips will resolve the #email problems in VestaCP.

To fix email not working:

1. Verify your internet connection is working. If it's not, there are four things you can do to fix it.

2. Make sure you're using the correct email server settings.

3. Confirm your password is working.

4. Confirm you don't have a security conflict caused by your firewall or antivirus #software.

Read More





Focus on your business, not your servers.

Click Here to Learn More




Recent Post