PHP - Visitor Has Same Ip
Hey,
Well when they view my website from home. We get the same (public)ip. Is there a way to tell that these people are not the same person, not using the same ip, because i am saving data from the ip(visitors). The others will get the same date too, because of the same ip. Or is there any other way to get a unique id(number) from visitors? Hope you understand. Cheers. Similar TutorialsIs there a good how to out there on how to create a code that will tell me where a page visitor is from? Similiar to google analytics, I'd like to find out where a visitor is from but I need this information before the page loads. I've tried googling but all I come up with are sites that offer the service if I sign up with them. Also, I have a list of zip codes / cities in an excel spreadsheet .. I'd like to get this into a db table but don't want to type each one out for the next month. How could I do this? My host is godaddy on a linux box with mysql 5.X if that helps. Thank you Hey gues, My question is: how is the easy'est way to redirect i mobile visitor to: mobile.domain.com, when visiting: domain.com? Thanks:). I want to to check if a person who comes to my site is either new or recurring and allow a download ONLY if they are new to the site. I would like to do something like check the IP adress of the person and see if it is in the database. I have never programmed in php before so it is entirely new to me, so i would like you to help me by writing an example script that does this that i can modify. Thank You
For debug purposes, I want to see all (each and every possible) variables from a website visitor, e.g. I know how to save the info in a database, I might even have the info emailed to myself, I just can't remember the "one-liner" I used to use to capture this info. Thank you in advance!
I have lists of links in different pages. I want to add an option for the visitors to add favorite ones to a list (like add to cart in shopping sites), and finally see the links selected in a page. This is based on the visitor's browser cookies. What is the simple way to do this (without database). Actually I need a function to save the items in the browser cookies and then retrieve them. not sure what to think of this. my code is: $time = date("H:i:s", strtotime("+19 hours")); mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $conn = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName); $stmt = $conn->prepare("INSERT INTO tblTraffic (ip, host, page, date, time) VALUES (?, ?, ?, ?, ?)"); $stmt->bind_param("sssss", $ip, $host, $page, $date, $time); what I get is in the attached image. as you can see, it returns correct and incorrect values for the same ISP/IP address, but it returns correct values for a google bot. In the past I was using: date("H:i:s"); ....and I was seeing the same results. e.g. - some IP addresses were producing both correct returns and incorrect returns. this correct/incorrect mix was also happening with various google bot /yandex / msn domains as well. what is up with this guys? Edited November 24, 2019 by ajetrumpet Hi, didnt know how to add this to the repository so can an admin move this please. this updated version will tell you still when you recieve a visitor but to identify who i have included so that it tracks the ip and tells you when its you!!! <?php // Script to email you when Google refers traffic to your site. $name=""; // add your name here $email_address=""; // add your email address here $keywords=""; $referrer=$_SERVER['HTTP_REFERER']; $known_ips = array( '01.01.01.01' => 'from the computer your are at now!', // etc. ); $ip = $_SERVER['REMOTE_ADDR']; if (array_key_exists($ip, $known_ips)) { $ip = $known_ips[$ip]; // you may want to use a different var name here now? } if( (stristr($referrer, "google")) && (stristr($referrer, "search")) ) { parse_str($referrer, $output); $keywords=$output['q']; $email_message="A visitor just arrived to the website after searching for '$keywords', Their IP address is '$ip'. ($referrer)"; mail ("$email_address","Google referred a visitor","$email_message"); } ?> hope it all works... give it a try and let me know. I want to show different content to different users from different states. So, if a visitor is visiting the website from California, I want to show California content. Likewise, if a user is visiting from any other State (say NY, Chicago, or anywhere), I want to show content relating to that State. Any suggestions? Thanks. Friends, I want to extract the Search Keyword from the URL, a visitor came from. I am using a PHP CMS and want to show the Keyword on my Blog. So if they search "abcd" from google, i want to extract "abcd" and echo on my blog. Here is the coding i could got hold of, but its not working, not echoing anything <?php function pk_stt2_function_get_delimiter($ref) { $search_engines = array('google.com' => 'q', 'go.google.com' => 'q', 'images.google.com' => 'q', 'video.google.com' => 'q', 'news.google.com' => 'q', 'blogsearch.google.com' => 'q', 'maps.google.com' => 'q', 'local.google.com' => 'q', 'search.yahoo.com' => 'p', 'search.msn.com' => 'q', 'bing.com' => 'q', 'msxml.excite.com' => 'qkw', 'search.lycos.com' => 'query', 'alltheweb.com' => 'q', 'search.aol.com' => 'query', 'search.iwon.com' => 'searchfor', 'ask.com' => 'q', 'ask.co.uk' => 'ask', 'search.cometsystems.com' => 'qry', 'hotbot.com' => 'query', 'overture.com' => 'Keywords', 'metacrawler.com' => 'qkw', 'search.netscape.com' => 'query', 'looksmart.com' => 'key', 'dpxml.webcrawler.com' => 'qkw', 'search.earthlink.net' => 'q', 'search.viewpoint.com' => 'k', 'mamma.com' => 'query'); $delim = false; if (isset($search_engines[$ref])) { $delim = $search_engines[$ref]; } else { if (strpos('ref:'.$ref,'google')) $delim = "q"; elseif (strpos('ref:'.$ref,'search.atomz.')) $delim = "sp-q"; elseif (strpos('ref:'.$ref,'search.msn.')) $delim = "q"; elseif (strpos('ref:'.$ref,'search.yahoo.')) $delim = "p"; elseif (preg_match('/home\.bellsouth\.net\/s\/s\.dll/i', $ref)) $delim = "bellsouth"; } return $delim; } /** * retrieve the search terms from search engine query * */ function pk_stt2_function_get_terms($d) { $terms = null; $query_array = array(); $query_terms = null; $query = explode($d.'=', $_SERVER['HTTP_REFERER']); $query = explode('&', $query[1]); $query = urldecode($query[0]); $query = str_replace("'", '', $query); $query = str_replace('"', '', $query); $query_array = preg_split('/[\s,\+\.]+/',$query); $query_terms = implode(' ', $query_array); $terms = htmlspecialchars(urldecode(trim($query_terms))); return $terms; } /** * get the referer * */ function pk_stt2_function_get_referer() { if (!isset($_SERVER['HTTP_REFERER']) || ($_SERVER['HTTP_REFERER'] == '')) return false; $referer_info = parse_url($_SERVER['HTTP_REFERER']); $referer = $referer_info['host']; if(substr($referer, 0, 4) == 'www.') $referer = substr($referer, 4); return $referer; } $referer = pk_stt2_function_get_referer(); if (!$referer) return false; $delimiter = pk_stt2_function_get_delimiter($referer); if( $delimiter ){ $term = pk_stt2_function_get_terms($delimiter); } echo $term; ?> May someone help? Natasha T |