$_server in php

$_SERVER is a PHP super global variable which holds information about headers, paths, and script locations.

Example

<?php
echo $_SERVER['PHP_SELF'];
echo "<br>";
echo $_SERVER['SERVER_NAME'];
echo "<br>";
echo $_SERVER['HTTP_HOST'];
echo "<br>";
echo $_SERVER['HTTP_REFERER'];
echo "<br>";
echo $_SERVER['HTTP_USER_AGENT'];
echo "<br>";
echo $_SERVER['SCRIPT_NAME'];
?>

The following table lists the most important elements that can go inside $_SERVER:

Element/CodeDescription
$_SERVER[‘PHP_SELF’]Returns the filename of the currently executing script
$_SERVER[‘GATEWAY_INTERFACE’]Returns the version of the Common Gateway Interface (CGI) the server is using
$_SERVER[‘SERVER_ADDR’]Returns the IP address of the host server
$_SERVER[‘SERVER_NAME’]Returns the name of the host server (such as www.w3schools.com)
$_SERVER[‘SERVER_SOFTWARE’]Returns the server identification string (such as Apache/2.2.24)
$_SERVER[‘SERVER_PROTOCOL’]Returns the name and revision of the information protocol (such as HTTP/1.1)
$_SERVER[‘REQUEST_METHOD’]Returns the request method used to access the page (such as POST)
$_SERVER[‘REQUEST_TIME’]Returns the timestamp of the start of the request (such as 1377687496)
$_SERVER[‘QUERY_STRING’]Returns the query string if the page is accessed via a query string
$_SERVER[‘HTTP_ACCEPT’]Returns the Accept header from the current request
$_SERVER[‘HTTP_ACCEPT_CHARSET’]Returns the Accept_Charset header from the current request (such as utf-8,ISO-8859-1)
$_SERVER[‘HTTP_HOST’]Returns the Host header from the current request
$_SERVER[‘HTTP_REFERER’]Returns the complete URL of the current page (not reliable because not all user-agents support it)
$_SERVER[‘HTTPS’]Is the script queried through a secure HTTP protocol
$_SERVER[‘REMOTE_ADDR’]Returns the IP address from where the user is viewing the current page
$_SERVER[‘REMOTE_HOST’]Returns the Host name from where the user is viewing the current page
$_SERVER[‘REMOTE_PORT’]Returns the port being used on the user’s machine to communicate with the web server
$_SERVER[‘SCRIPT_FILENAME’]Returns the absolute pathname of the currently executing script
$_SERVER[‘SERVER_ADMIN’]Returns the value given to the SERVER_ADMIN directive in the web server configuration file (if your script runs on a virtual host, it will be the value defined for that virtual host) (such as someone@w3schools.com)
$_SERVER[‘SERVER_PORT’]Returns the port on the server machine being used by the web server for communication (such as 80)
$_SERVER[‘SERVER_SIGNATURE’]Returns the server version and virtual host name which are added to server-generated pages
$_SERVER[‘PATH_TRANSLATED’]Returns the file system based path to the current script
$_SERVER[‘SCRIPT_NAME’]Returns the path of the current script
$_SERVER[‘SCRIPT_URI’]Returns the URI of the current page

www to non www htaccess

You can redirect all of the requests for www.laughingadda.com domain to laughingadda.com by modifying your website’s .htaccess file. You have to add the following lines in the beginning of the file so that the redirection is properly set up:

RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

You can edit the .htaccess file using the File Manager in cPanel or via FTP.

From now on, when someone access http://www.laughingadda.com that visitor will be redirected to http://laughingadda.com.

https to http redirect htaccess

Redirect from HTTPS to HTTP

There are some specific situations when you want to redirect particular website to be opened through HTTP instead of HTTPS. To do so you can add the following directives in your website’s .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

This will redirect your “https://laughingadda.com” to “http://laughingadda.com“.

Change page URLs with 301 redirects

If you need to change the URL of a page as it is shown in search engine results, we recommend that you use a server-side 301 redirect. This is the best way to ensure that users and search engines are directed to the correct page. The 301 status code means that a page has permanently moved to a new location.

301 redirects are particularly useful in the following circumstances:

  • You’ve moved your site to a new domain, and you want to make the transition as seamless as possible.
  • People access your site through several different URLs. If, for example, your home page can be reached in multiple ways – for instance, http://example.com/home, http://home.example.com, or http://www.example.com – it’s a good idea to pick one of those URLs as your preferred (canonical) destination, and use 301 redirects to send traffic from the other URLs to your preferred URL.
  • You’re merging two websites and want to make sure that links to outdated URLs are redirected to the correct pages.

To implement a 301 redirect for websites that are hosted on servers running Apache, you’ll need access to your server’s .htaccess file. (If you’re not sure about your access or your server software, check with your webhoster.) For more information, consult the Apache .htaccess Tutorial and the Apache URL Rewriting Guide. If your site is hosted on a server running other software, check with your hoster for more details.

source

How to prevent opening url ending with / using htaccess

Right below the RewriteEngine On line, add:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R] # <- for test, for prod use [L,R=301]

to enforce a no-trailing-slash policy.

To enforce a trailing-slash policy:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ /$1/ [L,R] # <- for test, for prod use [L,R=301]

EDIT: commented the R=301 parts because, as explained in a comment:

Be careful with that R=301! Having it there makes many browsers cache the .htaccess-file indefinitely: It somehow becomes irreversible if you can’t clear the browser-cache on all machines that opened it. When testing, better go with simple R or R=302

ITR form and Description

ITR 1
For Individuals being a Resident (other than Not Ordinarily Resident) having Total Income upto Rs.50 lakhs, having Income from Salaries, One House Property, Other Sources (Interest etc.), and Agricultural Income upto Rs.5 thousand(Not for an Individual who is either Director in a company or has invested in Unlisted Equity Shares)
ITR 2
For Individuals and HUFs not having income from profits and gains of business or profession
ITR 3
For individuals and HUFs having income from profits and gains of business or profession
ITR 4
For Individuals, HUFs and Firms (other than LLP) being a Resident having Total Income upto Rs.50 lakhs and having income from Business and Profession which is computed under sections 44AD, 44ADA or 44AE
(Not for an Individual who is either Director in a company or has invested in Unlisted Equity Shares)
ITR 5
For persons other than:-
(i) Individual,
(ii) HUF,
(iii) Company and
(iv) Person filing Form ITR-7
ITR 6
For Companies other than companies claiming exemption under section 11
ITR 7
For persons including companies required to furnish return under sections 139(4A) or 139(4B) or 139(4C) or 139(4D)

Soa Technology

AAROGYA SETU IS NOW OPEN-SOURCE FOR DEVELOPERS

Aarogya Setu app has finally become open source for developers as the government looks to quell the privacy and surveillance concerns. The Ministry of Electronics and Information Technology on Monday issued a notice, stating the code for the Arogya Setu Android app has been uploaded on GitHub and will be available for tinkering by developers starting Tuesday, May 26. Meanwhile, the iOS counterpart of the government’s covid-19 tracking app will be open-sourced within two weeks. The National Informatics Centre (a part of MeitY) has also announced the bug bounty programme for developers who can find vulnerabilities in the app.

The open-source code of the Aarogya Setu app comes after nearly two months since the release of the app, during which over 114 million users have registered themselves for the government’s programme. Although the app has been deemed resourceful by its users, privacy advocates have so far decried the lack of transparency in the app’s code, especially after the French hacker discovered one too many security loopholes in the app. The government then responded to the hacker’s concerns but the apprehension on using Aarogya Setu app among the users grew by the day, forcing the government to come forward and release the code-set of the app on GitHub.

Post the announcement, French security researcher who goes by Elliot Alderson alias on Twitter said, “This is a very positive news and I’m very happy that the Indian government took this direction. Now, we would like to see what is happening on the server side.”

Source

how to check dns settings for domain

DNS Lookup

DNS Lookup tool finds all DNS records of a given domain name. The records include but not limited to A, AAAA, CNAME, MX, NS, PTR, SRV, SOA, TXT, CAA.

https://dnschecker.org/all-dns-records-of-domain.php

A
TypeDomain NameAddressTTL
Asoatechnology.net35.173.197.10910799
AAAA
Sorry no record found!
CNAME
Sorry no record found!
MX
TypePrefDomain NameHostnameTTL
MX10soatechnology.netaspmx.l.google.com299
MX50soatechnology.netaspmx3.googlemail.com299
MX40soatechnology.netaspmx2.googlemail.com299
MX30soatechnology.netalt2.aspmx.l.google.com299
MX20soatechnology.netalt1.aspmx.l.google.com299
NS
TypeDomain NameNSTTL
NSsoatechnology.netns57.domaincontrol.com3599
NSsoatechnology.netns58.domaincontrol.com3599
PTR
Sorry no record found!
SRV
Sorry no record found!
SOA
TypeDomain NamePrimary NSResponsible EmailTTL
SOAsoatechnology.netns57.domaincontrol.comdns.jomax.net599
TXT
TypeDomain NameRecordTTL
TXTmissindia-world.comv=spf1 +a +mx +ip4:67.227.252.228 ~all299
CAA
Sorry no record found!

how to create react native app in windows

set up your development environment on Windows using React Native framework and Android Studio to build Android Apps

the following tools to set up my development environment:

  • Windows
  • Visual Studio Code
  • Android Studio
  • Built-in emulator in Android Studio
  • Node Package Manager (NPM)
  • Node.js (Version 8 or newer)
  • React Native command line interface (React Native CLI)
  • Java Development Kit (JDK 8 or newer)

Step 1: Install Visual Studio Code

Download and install the latest version of Visual Studio Code for Windows from https://code.visualstudio.com/

Step 2: Install Android Studio

  • Download and install the latest version of Android Studio for Windows from https://developer.android.com/studio/
  • Android Studio installs the latest Android SDK by default. React Native requires Android 6.0 (Marshmallow) SDK or higher. I decided to use Android 7.1.1 (Nougat). Feel free to use the latest SDK.
  • Make sure you have the following SDK tools installed:
Soa Technology

Important: You will need the Intel x86 Emulator Accelerator (HAXM installer) to run the emulator on Windows. For more information, please refer to the following link: https://github.com/intel/haxm/wiki/Installation-Instructions-on-Windows

Note: You need to enable Intel Virtualization Technology by changing a BIOS setting. Please look at the following link to see how that is done:

  • Configure the ANDROID_HOME environment variable. Open the System pane under System and Security in the Windows Control Panel, then click on Change settings. Open the Advanced tab and click on Environment Variables. Click on New to create a new ANDROID_HOME user variable that points to the path to your Android SDK:
Figure 3: PATH variable for Android
  • Finally, add Android Debug Bridge (ADB) to the PATH environment variable. This will help you know which devices are connected or which emulators are currently running. Install location of ADB: C:\Users\apatil\AppData\Local\Android\Sdk\platform-tools\adb.exe

Step 3: Install Node

  • Download and install the latest version of Node.js from https://nodejs.org/en/Note: Npm is installed with Node.js.

Note: Make sure you add NPM to the PATH environment variable.

  • Once npm is installed, install React Native CLI by running the following command from the Windows prompt command line or Integrated Terminal in Visual Studio Code. Note: Integrated Terminal can be found under View →Integrated Terminal
npm install -g react-native-cli

Step 4: Using embedded JDK

Android Studio comes with an embedded JDK which is recommended. Make sure you check the following option under File → Other Settings → Default Project Structure in Android Studio:

Soa Technology

Step 5: Creating a new React Native application

Finally, lets create our first React Native application by running the following command in your workspace location

react-native init SampleReactNativeProject

This creates the following project directory structure when you open the project in Visual Studio Code.

Soa Technology

Step 6: Building for Android

  • Before we go ahead and run the app, open up the “android” directory in our project in Android Studio and create an “assets” directory under app/src/main.
Soa Technology

To simplify the build and install process, in package.json, add the following script under “scripts”:

"android-windows": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && react-native run-android"

Now run the following command to install the app and see it running on the emulator. This runs the script above which we set up in package.json.

npm run android-windows

This starts up a Metro Bundler instance in a new command prompt instance and installs the app on the emulator as shown below:

Storing and displaying unicode string (हिन्दी) using PHP and MySQL

Sample Script

<html>
  <head>
    <title>Hindi</title></head>
  <body>
    <?php
      include("connection.php"); //simple connection setting
      $result = mysql_query("SET NAMES utf8"); //the main trick
      $cmd = "select * from hindi";
      $result = mysql_query($cmd);
      while ($myrow = mysql_fetch_row($result))
      {
          echo ($myrow[0]);
      }
    ?>
  </body>
</html>

The dump for my database storing hindi utf strings is

CREATE TABLE `hindi` (
  `data` varchar(1000) character set utf8 collate utf8_bin default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `hindi` VALUES ('सूर्योदय');

charset in the HTML Head section

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

set content type in your php script using 

   header( 'Content-Type: text/html; charset=utf-8' ); 

Mysql Example

CREATE DATABASE hindi_test
CHARACTER SET utf8
COLLATE utf8_unicode_ci;
USE hindi_test;
CREATE TABLE `hindi` (`data` varchar(200) COLLATE utf8_unicode_ci NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `hindi` (`data`) VALUES('कंप्यूटर');