google analytics showing real time user 79 but actually not in real why

The “cid” in your http call is the client id, where client refers to the device or program that makes the request. It is usually stored in a cookie (on the web) or generated by an SDK (in an app) and is used to unify subsequent requests from the same device into sessions. Since it is set by the client it differs from device to device (and browser to browser), so it can not be used to identify a person across multiple devices.

After it became the rule that any given person might have two or more devices Google came up with the uid, the user id (which by their own TOS might not identify the user, so this is a bit of a misnomer; think “cross device tracking id” and the concept becomes clearer). The uid is set by serverside code, i.e. after the user logs in. Not only this allows to unify visits from multiple devices into distinct users, it also alleviates privacy concerns (since it is supposed to be only created after a users action; there are separate TOS which you have to accept if you create a user id view in the GA interface, and they stipulate that you have to secure the users agreement to use to user id feature).

So if you set the same user id in your code the sessions will be attributed to the same user, even when the cid differs; this is by design and is indeed the point of the uid.

how to copy data from godaddy to aws instance

How to migrate Files from Godaddy to AWS

Pretend Domain is laughingadda.com on Godaddy.

  • Login to your GoDaddy account and access cpanel, go to File Manager.
  • Compress your website files (all your files in public_html folder). Now, your filename is example.com.zip
  • Connect to your AWS SSH via Putty or any command terminal. Go to the folder of your website using the following command cd /var/www/
  • wget http://example.com/laughingadda.com.zip command is to get that zip file to your AWS /var/www/ folder.
  • unzip laughingadda.com.zip to unzip all your website files into /var/www/ folder.

To transfer your hosting, you have to do it manually:
1) Set up the EC2 instance with the same environment that is on GoDaddy
2) If you have databases in Godaddy, you need to install the same database type on an RDS instance
and make sure that your VPC is properly setup to allow the EC2 instance to securely talk to the RDS instance.
3) Make sure that you have an elastic IP mapped to your EC2 so that you can access your webpage from internet
3) Export your website files and databases (if any)
4) Import the website files to EC2 using an FTP client
5) Import your database tables using a client like MySQL workbench
6) Test your website from a browser (using the elastic IP)
7) Use Route 53 to transfer your domain and map it to the elastic IP in the DNS settings
8) Test your website from a browser (using your domain)

Upgrade PHP version 7.2 to 7.3 on Ubuntu

As a part of increasing the security, it is advised to keep your PHP version up to date. Here we have provided the steps to upgrade the current PHP 7.2 version to 7.3 on Ubuntu 14/16/18 versions without removing the old one. So that we can revert to the older versions if something incompatible with the new one after switching.

Login to the server via SSH as root.

Check your current PHP version. 

# php -v
PHP 7.2.36

In order to install PHP 7.3, we need to add the repository first:

# add-apt-repository ppa:ondrej/php

Then run an update:

# apt-get update

After completing the update, we need to install the PHP 7.3.

 Then install the required PHP packages based on your current installation:

# apt install php7.3-common php7.3-cli php7.3-bz2 php7.3-curl php7.3-gd php7.3-intl php7.3-json php7.3-readline php7.3-xml php7.3-zip php7.3-fpm php7.3-bcmath php7.3-mbstring

After a successful installation, we can disable the old 7.2 and then enable 7.3:

# a2dismod php7.2
# a2enmod php7.3

Then restart Apache:

# service apache2 restart

The new PHP version should be active now. You can verify it from the command line:

# php -v
PHP 7.3.28

NOTE: for ordinary user use sudo command.

How To List and Delete Iptables Firewall Rules

Introduction

Iptables is a firewall that plays an essential role in network security for most Linux systems. While many iptables tutorials will teach you how to create firewall rules to secure your server, this one will focus on a different aspect of firewall management: listing and deleting rules.

In this tutorial, we will cover how to do the following iptables tasks:

  • List rules
  • Clear Packet and Byte Counters
  • Delete rules
  • Flush chains (delete all rules in a chain)
  • Flush all chains and tables, delete all chains, and accept all traffic

List Rules by Specification

To list out all of the active iptables rules by specification, run the iptables command with the -S option:

sudo iptables -S
Example: Rule Specification Listing-P INPUT DROP
-P FORWARD DROP
-P OUTPUT ACCEPT
-N ICMP
-N TCP
-N UDP
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate INVALID -j DROP
-A INPUT -p udp -m conntrack --ctstate NEW -j UDP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j TCP
-A INPUT -p icmp -m conntrack --ctstate NEW -j ICMP
-A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
-A INPUT -p tcp -j REJECT --reject-with tcp-reset
-A INPUT -j REJECT --reject-with icmp-proto-unreachable
-A TCP -p tcp -m tcp --dport 22 -j ACCEPT

As you can see, the output looks just like the commands that were used to create them, without the preceding iptables command. This will also look similar to the iptables rules configuration files, if you’ve ever used iptables-persistent or iptables save.

List Specific Chain

If you want to limit the output to a specific chain (INPUTOUTPUTTCP, etc.), you can specify the chain name directly after the -S option. For example, to show all of the rule specifications in the TCP chain, you would run this command:

sudo iptables -S TCP
Example: TCP Chain Rule Specification Listing-N TCP
-A TCP -p tcp -m tcp --dport 22 -j ACCEPT

Let’s take a look at the alternative way to view the active iptables rules, as a table of rules.

List Rules as Tables

Listing the iptables rules in the table view can be useful for comparing different rules against each other,

To output all of the active iptables rules in a table, run the iptables command with the -L option:

sudo iptables -L

This will output all of current rules sorted by chain.

If you want to limit the output to a specific chain (INPUTOUTPUTTCP, etc.), you can specify the chain name directly after the -L option.

Let’s take a look at an example INPUT chain:

sudo iptables -L INPUT
Example: Input Chain Rule Table ListingChain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere             ctstate INVALID
UDP        udp  --  anywhere             anywhere             ctstate NEW
TCP        tcp  --  anywhere             anywhere             tcp flags:FIN,SYN,RST,ACK/SYN ctstate NEW
ICMP       icmp --  anywhere             anywhere             ctstate NEW
REJECT     udp  --  anywhere             anywhere             reject-with icmp-port-unreachable
REJECT     tcp  --  anywhere             anywhere             reject-with tcp-reset
REJECT     all  --  anywhere             anywhere             reject-with icmp-proto-unreachable

The first line of output indicates the chain name (INPUT, in this case), followed by its default policy (DROP). The next line consists of the headers of each column in the table, and is followed by the chain’s rules. Let’s go over what each header indicates:

  • target: If a packet matches the rule, the target specifies what should be done with it. For example, a packet can be accepted, dropped, logged, or sent to another chain to be compared against more rules
  • prot: The protocol, such as tcpudpicmp, or all
  • opt: Rarely used, this column indicates IP options
  • source: The source IP address or subnet of the traffic, or anywhere
  • destination: The destination IP address or subnet of the traffic, or anywhere

The last column, which is not labeled, indicates the options of a rule. That is, any part of the rule that isn’t indicated by the previous columns. This could be anything from source and destination ports, to the connection state of the packet.

Show Packet Counts and Aggregate Size

When listing iptables rules, it is also possible to show the number of packets, and the aggregate size of the packets in bytes, that matched each particular rule. This is often useful when trying to get a rough idea of which rules are matching against packets. To do so, simply use the -L and -v option together.

For example, let’s look at the INPUT chain again, with the -v option:

sudo iptables -L INPUT -v
Example: Verbose ListingChain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
 284K   42M ACCEPT     all  --  any    any     anywhere             anywhere             ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere
    0     0 DROP       all  --  any    any     anywhere             anywhere             ctstate INVALID
  396 63275 UDP        udp  --  any    any     anywhere             anywhere             ctstate NEW
17067 1005K TCP        tcp  --  any    any     anywhere             anywhere             tcp flags:FIN,SYN,RST,ACK/SYN ctstate NEW
 2410  154K ICMP       icmp --  any    any     anywhere             anywhere             ctstate NEW
  396 63275 REJECT     udp  --  any    any     anywhere             anywhere             reject-with icmp-port-unreachable
 2916  179K REJECT     all  --  any    any     anywhere             anywhere             reject-with icmp-proto-unreachable
    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpt:ssh ctstate NEW,ESTABLISHED

Note that the listing now has two additional columns, pkts and bytes.

Now that you know how to list the active firewall rules in a variety of ways, let’s look at how you can reset the packet and byte counters.

Reset Packet Counts and Aggregate Size

If you want to clear, or zero, the packet and byte counters for your rules, use the -Z option. They also reset if a reboot occurs. This is useful if you want to see if your server is receiving new traffic that matches your existing rules.

To clear the counters for all chains and rules, use the -Z option by itself:

sudo iptables -Z

To clear the counters for all rules in a specific chain, use the -Z option and specify the chain. For example, to clear the INPUT chain counters run this command:

sudo iptables -Z INPUT

If you want to clear the counters for a specific rule, specify the chain name and the rule number. For example, to zero the counters for the 1st rule in the INPUT chain, run this:

sudo iptables -Z INPUT 1

Now that you know how to reset the iptables packet and byte counters, let’s look at the two methods that can be used to delete them.

Delete Rule by Specification

One of the ways to delete iptables rules is by rule specification. To do so, you can run the iptables command with the -D option followed by the rule specification. If you want to delete rules using this method, you can use the output of the rules list, iptables -S, for some help.

For example, if you want to delete the rule that drops invalid incoming packets (-A INPUT -m conntrack --ctstate INVALID -j DROP), you could run this command:

sudo iptables -D INPUT -m conntrack --ctstate INVALID -j DROP

Note that the -A option, which is used to indicate the rule position at creation time, should be excluded here.

Delete Rule by Chain and Number

The other way to delete iptables rules is by its chain and line number. To determine a rule’s line number, list the rules in the table format and add the --line-numbers option:

sudo iptables -L --line-numbers
[secondary_output Example Output: Rules with Line Numbers]
Chain INPUT (policy DROP)
num  target     prot opt source               destination
1    ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
2    ACCEPT     all  --  anywhere             anywhere
3    DROP       all  --  anywhere             anywhere             ctstate INVALID
4    UDP        udp  --  anywhere             anywhere             ctstate NEW
5    TCP        tcp  --  anywhere             anywhere             tcp flags:FIN,SYN,RST,ACK/SYN ctstate NEW
6    ICMP       icmp --  anywhere             anywhere             ctstate NEW
7    REJECT     udp  --  anywhere             anywhere             reject-with icmp-port-unreachable
8    REJECT     tcp  --  anywhere             anywhere             reject-with tcp-reset
9    REJECT     all  --  anywhere             anywhere             reject-with icmp-proto-unreachable
10   ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh ctstate NEW,ESTABLISHED
...

This adds the line number to each rule row, indicated by the num header.

Once you know which rule you want to delete, note the chain and line number of the rule. Then run the iptables -D command followed by the chain and rule number.

For example, if we want to delete the input rule that drops invalid packets, we can see that it’s rule 3 of the INPUT chain. So we should run this command:

sudo iptables -D INPUT 3

Now that you know how to delete individual firewall rules, let’s go over how you can flush chains of rules.

Flush Chains

Iptables offers a way to delete all rules in a chain, or flush a chain. This section will cover the variety of ways to do this.

Note: Be careful to not lock yourself out of your server, via SSH, by flushing a chain with a default policy of drop or deny. If you do, you may need to connect to it via the console to fix your access.

Flush a Single Chain

To flush a specific chain, which will delete all of the rules in the chain, you may use the -F, or the equivalent --flush, option and the name of the chain to flush.

For example, to delete all of the rules in the INPUT chain, run this command:

sudo iptables -F INPUT

Flush All Chains

To flush all chains, which will delete all of the firewall rules, you may use the -F, or the equivalent --flush, option by itself:

sudo iptables -F

Flush All Rules, Delete All Chains, and Accept All

This section will show you how to flush all of your firewall rules, tables, and chains, and allow all network traffic.

Note: This will effectively disable your firewall. You should only follow this section if you want to start over the configuration of your firewall.

First, set the default policies for each of the built-in chains to ACCEPT. The main reason to do this is to ensure that you won’t be locked out from your server via SSH:

sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT

Then flush the nat and mangle tables, flush all chains (-F), and delete all non-default chains (-X):

sudo iptables -t nat -F
sudo iptables -t mangle -F
sudo iptables -F
sudo iptables -X

Your firewall will now allow all network traffic. If you list your rules now, you will will see there are none, and only the three default chains (INPUT, FORWARD, and OUTPUT) remain.

source:digitalocean

Soa Technology

Next OnePlus flagship could switch to superfast 65W charging

Recent OnePlus phones have been all about speed — from snappy performance to speedy charging tech. The company is so absorbed by this notion that it waited a long while before introducing wireless charging to make sure its implementation lived up to its high standards. The company’s Warp Charge, previously Dash Charge, has been among the industry’s fastest charging solutions, but OnePlus doesn’t want to settle there and seems to be kicking things a notch higher with an even faster charging speed.

According to MySmartPrice, TÜV Rheinland’s Japanese arm has issued a certificate for a OnePlus charging brick that can push up to 65 watts of power (6.5A at 10V). By comparison, the company’s current Warp Charge 30T spec is rated for 30 watts of maximum output, which OnePlus has further optimized with software tweaks for shorter charging time. A 65W charger isn’t particularly far-fetched since OnePlus sister company Oppo showcased a similar charger a few months back, and the recent Realme X50 Pro ships with an adapter based on that tech.

If OnePlus’s solution ends up being anything like Realme’s, you can expect a 4,000mAh battery to top up completely in 30 minutes flat. When or if OnePlus will bundle its phones with a 65W charger is still a bit of a mystery; it’s entirely possible that the 8T (or whatever OnePlus decides to call it) could include the wild new charger, or the company may choose to wait for another generation to iron out any remaining issues. A 60W charger could also be offered as a separate purchase at a later date.

Source: MySmartPrice

Soa Technology

Microsoft Teams Adds Custom Background Effects During Video Call, Other New Features

Microsoft Teams, the video conferencing service by Microsoft, is getting a host of new updates, including the ability to use custom photos as background images during video calls. The feature is available to users of the platform’s free version and Indian customers of Teams can use it as well. Users of Microsoft Teams free version can also now schedule meetings and share links via Outlook or Google calendar. The Redmond company in a blog post has stated that Teams customers in the US can turn on live captions during their calls and meetings as well.

With the latest upgrades added to the platform, Microsoft is hoping to give tough competition to competitors such as Zoom and Google Meet. In a blog post, corporate vice president for Microsoft 365, Jared Spataro announced that the recent updates are a result of Teams’ growing userbase amid the global pandemic.

Custom background on Microsoft Teams

Starting with the new custom background effects on Microsoft Teams, the company notes that users can customise the background by uploading own images or choosing one of the collections of backgrounds available online. The platform already allows users to choose special backgrounds during a video call, in addition to the option to blur background.

Microsoft is also adding event-specific background collections for its users. Starting June 16, users can download special LGBTQI+ background photos to celebrate pride month. To upload a custom photo during a Team video call, users need to select More actions (represented by three horizontal dots) on the screen > Show background effects > Click on Add new.

Other new features on Microsoft Teams

Microsoft is also adding new features to the free version of its video conferencing platform. The company says with the new updates, Teams free version customers can work and connect from home “effectively.”

Free version users are now able to schedule meetings and send out invitations in advance. This capability builds upon the existing ability to “Meet Now.” Meeting schedulers have the option of either copying the meeting link to send directly to other participants or sending an invite via Outlook or Google calendar.

Microsoft in the post says that the much-requested schedule feature is being rolled out to current users, while users who are just signing up now will be able to “experience it soon.” Additionally, Teams customers in the US will soon be able to use live captions during a Teams call.

Meanwhile, the company last month announced that the Teams platform is looking to increase its group call participants limit to 250. The current limit on the video conferencing platform is 100.

source:ndtv

$_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