Author Archives: Silver Moon

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].

Php get zip error message from error number

By | November 24, 2011

Php functions like zip_open return an error number if they fail. To get the corresponding error message from the error number , use the following function. function zip_error_message($errno) { // using constant name as a string to make this function PHP4 compatible $zipFileFunctionsErrors = array( 'ZIPARCHIVE::ER_MULTIDISK' => 'Multi-disk zip archives not supported.', 'ZIPARCHIVE::ER_RENAME' => 'Renaming… Read More »

Get http request headers in php

By | November 22, 2011

When a browser makes a request to a php script, the browser sends some http headers which can look like this : Host: localhost Connection: keep-alive User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: UTF-8,*;q=0.5 Cookie: username=admin; password=21232ffc3; PHPSESSID=o5m4e2td1m66c4pkjdag9vs0u2 The php script under request ,… Read More »

PHP get adsense earnings and reports

By | November 9, 2011

In this article we are going to login into Google Adsense and retrieve earnings. Google Adsense now has a new interface and so needs a different kind of coding. In this example we shall fetch “yesterday’s” earnings sitewise. Create a Report to be fetched : First open the sitewise report in the Performance Tab in… Read More »

How to Install Suphp with Apache on Ubuntu / Linux

By | August 8, 2020

Suphp Suphp php handler is an apache module (mod_suphp) that runs php scripts with ownership and permission of a specific user. This is seen as a security enhancement since the system can keep track of which user’s php script is running (and causing problems if any). In shared hosting environments suphp is very popular since… Read More »

Quick Tip: Installing Ruby Gems in the user’s Home Directory

By | April 19, 2016

Note: The Operating System in use is Ubuntu Linux (11.04) My Gem Environment – $ gem env RubyGems Environment: – RUBYGEMS VERSION: 1.8.11 – RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [x86_64-linux] – INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.9.1 – RUBY EXECUTABLE: /usr/local/bin/ruby – EXECUTABLE DIRECTORY: /usr/local/bin – RUBYGEMS PLATFORMS: – ruby – x86_64-linux – GEM PATHS: – /usr/local/lib/ruby/gems/1.9.1… Read More »

Install vnc server and client on Ubuntu

By | November 1, 2011

VNC stands for Virtual Network Computing or in simple terms its ‘Remote Desktop’. It allows a system to access the desktop of another system. Now lets see how vnc can be done on ubuntu. Install Packages $ sudo apt-get install vnc4server xvnc4viewer 1. vnc4server – This is the vnc server application. It is run on… Read More »

Write a simple PHP Hit Counter Script

By | October 29, 2011

In this tutorial, I am going to show you a simple way to write a Hit Counter script in PHP to save and display the number of visits to your website. We will basically store and increment the hits in a file, that can be used to display the total hit count as well. The… Read More »

How to Code a TCP Connect Port Scanner in PHP

By | August 11, 2020

A port scanner is a program designed to probe a server or host for open ports. Looking at open ports, one can tell what services might be running on the remote server. We earlier made a TCP Connect port scanner in C here – https://www.binarytides.com/tcp-connect-port-scanner-code-c-winsock/ and here – https://www.binarytides.com/tcp-connect-port-scanner-c-code-linux-sockets/ Now we shall try making the… Read More »

Top Port Scanners on Ubuntu Linux

By | May 9, 2020

Here is a list of port scanners that work on Ubuntu/Linux. 1. Angry IP Scanner Download and Install from http://www.angryip.org/ Fast and easy to use network scanner and port scanner. To scan ports got to Tools > Preferences > Ports > Port Selection Enter the ports you want to scan Start the scan. 4. Nmap… Read More »

PHP best way to check if file is an image

By | October 23, 2011

The getimagesize function of php provides lot of information about an image file , including its type. The type can be used to check if the file is a valid image file or not. To check if a file is an image or not, use the function function is_image($path) { $a = getimagesize($path); $image_type =… Read More »