All articles about programming topics on Computer-Masters.net
-
PHP: Encrypt passwords with md5
Passwords are essential for interactive websites. However, passwords should never be stored unencrypted, as this represents a major security risk. In addition to other safeguards, the md5() function integrated in PHP can help here. With this you can easily determine the MD5 hash value of a string. Hashing Strings with md5() Calling md5() is self-explanatory:…
-
PHP: Block access for specific IP addresses
Ever had a Spambot on your site? Cleaning up the database after a spam attack is a tedious task. One way to avoid this is designing your webforms more complicated, so automatic spam bots are not able to fill them out. This works in most cases, but has a negative impact on the usability of…
-
PHP: Get IP address of a domain or URL
With just a single statement it is possible to find out the IP address of a domain or URL. Simply use the gethostbyname() function in PHP to get the IP address. See the example below to find out how to use this function. You find the output of the code below the code. The output of…
-
PHP: Get list of all timezone identifiers
Getting the list of all timezone identifiers in PHP is fairly easy as PHP has the built in function timezone_identifiers_list(). A timezone identifier can be used for example in the PHP function date_default_timezone_set ( string $timezone_identifier ). See in this example how to use that function and see below what the output of this function is. The output of the function…
-
Does my server support PHP?
In order to run PHP scripts your server needs to support PHP. It is very easy to examine if your server is capable of running PHP scripts by just trying it with the phpinfo() that prints out all the information about the installed PHP version. Upload a file to your server containing the above stated…
-
PHP: Print out your users IP Adress
It is fairly easy to find out your clients IP address when using PHP. The PHP script is basically one single line and returns the IP address that can be accessed for example as String. See the PHP code example below to find out how to receive the clients IP address. The code stated above…
-
Java: Exporting data to CSV files
The Comma Separated Value CSV format is a very easy to use and flexible format to save data to files. Many programs like Excel or Calc can import csv files and work with the data. In this article you find a possible implementation for Java for exporting CSV files. You may use this Java class…
-
Java: Reading a file line by line with BufferedReader
When using text files in a programm the most common use case is to read it line by line. The Java library provides the BufferedReader for this use case. Learn by this code example how to use the BufferedReader for reading a text file. Example Code The above code prints out C:\example.txt to the console.…
