Couting IP unique visitors and sending it to mysql database - php

I'd like to know how can i get information about uniques IP's to my site specify link and store that information in mysql database to particular user.
I need that script count not only http://example.com.com but also ex.: http://example.com/somesub/this/link.
Because i want to develop project in which users get traffic to my system and they get paid.
(Pay to Promote system).
How can i develop this? Any ideas about php code?

First of all use $_SERVER['REMOTE_ADDR'] to find the request IP Address or see How to get client IP address PHP.
then at the start of each page of your site you should get this value (which acts like a primary key) and do query to the database to increase the specific counter.
P.S: you will find problems in case the client is using proxy to get to your site, see the link above for more information.

Related

How can I make Users submit only one vote?

I have to make a Website where users can vote only once. I tried to register them in my db using their IP address with $_SERVER['REMOTE_ADDR'] but i did some research and found out that in some cases multiple users can have the same IP (using the same wifi or the IPS sharing IP's between them). Also, i don't want them to make an account to be able to vote, or log in with facebook, google, etc...
Is there any way to do this with PHP?
Just have a quick glance at https://github.com/samyk/evercookie. Your search will end there.
You can store to DB a fingerprint and then compare it like you did before with an IP address
https://github.com/Valve/fingerprintjs
or u can make your own fingerprint by storing user's device, it width,height,timezone,etc
But it'll fail if someone will vote with other device.
I think it must works like an Antifraud systems, but they're based on the same way I wrote.

Can I import certain tables from a remote database over SSH into the main database for a Wordpress install?

I would like to be able to sync certain tables from a remotely hosted database into a Wordpress database, these tables are not containing any related Wordpress content. These tables contain simple warranty lookup info that returns a simple yes/no if a specific serial number of a product is past the warranty date. I have SSH and privileges set up for this and my IP is whitelisted.
On the management side, the user enters this data into an internal system that pushes the information to their server hosting the database.
My goal is not to disrupt the system they are using and simply use a form on the site to access the lookup feature with the imported data from the external database. I hope this makes sense.
I appreciate any help or guidance in this.

Trying to capture IP addresses in wordpress / php script

I would like to keep track of IP addresses visiting my site, as it helps determine what content I should host.
I a really not a programmer, so i was looking for a pre-built solution.
I found this script:
<?php
$LogFileLocation = "/public_html/cms/iplog.txt";
$fh = fopen($_SERVER['DOCUMENT_ROOT'].$LogFileLocation,'at');
fwrite($fh,date('dMy H:i:s')."\t".$_SERVER['REMOTE_ADDR']."\t".$_SERVER['REQUEST_URI']."\n");
fclose($fh);
?>
however when i created iplog.txt and browse to it, nothing happens.
If you need only statistic of visiting of your site why you don't use Google Analitics (http://www.google.com/analytics/)? It gives full information on how to track visits onto the site. Your method gives you only text file with date, user's ip and page which user visited; but if you aren't a programmer, you will not sort this information and operated this data.
If you still decide to use your method of store information and don't want to use Google Analitics, then save data about user and visited pages in the database in special created table (id, date, ip, uri). This method will permit show date-statistic, statistic for ip and single page.
You can capture IP of the visitor with the following code.
$ip=$_SERVER['REMOTE_ADDR'];
Now you can store it in your database. For that you have to create a column in your database table that stores the ip address. Along with IP address, you can store many other information in the database for keeping track of users like time stamp, duration, page visits etc. There are many tools available like Google Analytic and others which provide you such services free of cost but they don't store the record in your website's database. So choose accordingly.

How to identify each visitors country/location using php?

Hai friends I need user country when they visit my php website. According to his country I have to do some checking when they upload some bulk informations.
How can I find the visitor country using php.
PHP has no built-in method to determine the location of a website visitor.
The best you can do automatically is to look up their IP address in an IP-to-location database.
You can get one for free from MaxMind. They have a PHP API available for using the database.

Call into a website and use php to recognize caller ID

I have this idea where I want to allow someone to call a phone number from their cell phone, and then a website would display their caller ID. I want to do this in php, but I'm really not sure how. I'm pretty good with PHP and I'm assuming you need some kind of GSM modem attached to the web server to accept the incoming phone calls, but that's really as far as I can get. If anyone can point me in the right direction that would be great.
There are a couple of services that launched recently which allow you to accept phone calls using an API:
http://cloudvox.com/
http://www.twilio.com/
These are probably easier than trying to physically receive the phone calls yourself.
If you went for using a modem then you'd obviously need drivers for it and to program against whatever API those drivers exposed.
Either way, you're going to need a way to link the phone call to the session on the website - maybe generating a unique number for each visitor, or by getting them to input a sequence of digits when they call. The workflow would then look something like
User visits website
Website generates session ID, provides user phone number
User rings number
Call-handling software/script/etc executed by cloudvox/twilio API or modem drivers
Call is mapped to a session (by inputted number, phone number, etc)
Caller ID is associated with website session
User refreshes website or website auto-refreshes
Website displays Caller ID to user

Categories