PHP - Facial Detection
Hi I want to do facial detection (http://corpocrat.com/2009/08/18/automatic-face-detection-with-php-in-linux/), any ways to do it without installing extra stuff (directly, going to try the php.ini add from a php.index) into PHP, as my web host does not allow that.
Similar TutorialsI use this script to detect a browser IP, however it doesn't work with IPv6. http://phptutorial.info/iptocountry/the_script.html Any ideas what is required to make it work with both IPv4 & IPv6?
Thanks I have done some searching and digging, but it seems everyone has their own ways of doing things, some more effective than others. I have a web design portfolio website, which uses a "coinslider" flash slideshow. It looks awesome in FF, but IE6/etc users cant view it properly. How can I create a PHP if/then to detect if they are using a sub-par browser, and display a more simple slideshow? That way it will work for all users, and those with Firefox and similar browsers can view the more interesting slideshow. Thanks. Hi, I would like to be able to receive and emain on what pages users are getting 404 errors (or any other for that fact). I have the directive in my .htaccess to redirect missing pages to my custom 404.php page. However, despite trying a number of tutorial on how to get it to email me the url they tried to access, I can not get it to work. My code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Please Wait</title> <meta http-equiv="refresh" content="0; url=http://www.mysite.co.uk" /> </head> <body> <?PHP $ip = getenv ("REMOTE_ADDR"); $requri = getenv ("REQUEST_URI"); $servname = getenv ("SERVER_NAME"); $combine = $ip . " tried to load " ; $url = $servname . $requri ; $httpref = getenv ("HTTP_REFERER"); $httpagent = getenv ("HTTP_USER_AGENT"); $today = date("D M j Y g:i:s a T"); $message2 = "On $today, $combine:\n http://www.$url\n User Agent = $httpagent \n $httpref "; $to = "my.email@domain.com"; $subject = "404 Error Report"; $from = "From:no-reply@domain.com\r\n"; mail($to, $subject, $message2, $from); ?> </body> </html> I just get: On Mon Jan 16 2012 9:55:57 am UTC, 82.153.239.221 tried to load : http://www.www.mysite.co.uk/404.php User Agent = Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; .NET CLR 2.0.50727; .NET CLR 3.5.30729) Hello Is there any way to find out what is type of proxy? I mean Anonymous, Transparent etc. Anyone know of a fairly reliable image nudity detection script? That is open source (PHP or JS)? Hi guys, I am creating a script as I am using this to detection the proxy server levels. <?php //proxy levels //Level 3 Elite Proxy, connection looks like a regular client //Level 2 Anonymous Proxy, no ip is forworded but target site could still tell it's a proxy //Level 1 Transparent Proxy, ip is forworded and target site would be able to tell it's a proxy if(!$_SERVER['HTTP_X_FORWARDED_FOR'] && !$_SERVER['HTTP_VIA'] && !$_SERVER['HTTP_PROXY_CONNECTION']){ echo '3'; } elseif(!$_SERVER['HTTP_X_FORWARDED_FOR']){ echo '2'; } else echo '1'; ?> I want the script to check the ip that if the proxy server is a Codeen/PlanetLab and BotNet proxy servers, then place on level one and if they are safe/unsafe to use. I cannot find the code to do the methods. Please help me! Thanks in advance. SOLVED Here is my simple script for user browser and OS detection: $agent = $_SERVER['HTTP_USER_AGENT']; if (strstr($agent,"Windows")) {$os = "Windows";} if (strstr($agent,"Windows NT 6")) {$os = "Windows 7";} if (strstr($agent,"Linux")) {$os = "Linux";} if (strstr($agent,"Intel Mac OS X")) {$os = "OS X";} if (strstr($agent,"OpenBSD")) {$os = "BSD";} if (strstr($agent,"FreeBSD")) {$os = "FreeBSD";} if (strstr($agent,"Firefox/3")) {$br = "Firefox 3";} if (strstr($agent,"Firefox/2")) {$br = "Firefox 2";} if (strstr($agent,"Firefox/1")) {$br = "Firefox 1";} if (strstr($agent,"Phoenix/")) {$br = "Phoenix (Mozilla lite)";} if (strstr($agent,"MSIE 6")) {$br = "IE 6";} if (strstr($agent,"MSIE 7")) {$br = "IE 7";} if (strstr($agent,"MSIE 8")) {$br = "IE 8";} if (strstr($agent,"Netscape6/6")) {$br = "Netscape 6";} if (strstr($agent,"Opera")) {$br = "Opera";} if (strstr($agent,"Opera") and strstr($agent,"Version/10")) {$br = "Opera 10";} if (strstr($agent,"Opera") and strstr($agent,"Version/9")) {$br = "Opera 9";} if (strstr($agent,"Chrome") and strstr($agent,"Chrome/5")) {$br = "Chrome 5";} if (strstr($agent,"Safari/")) {$br = "Safari";} if (strstr($agent,"Safari/") and strstr($agent,"Version/5")) {$br = "Safari 5";} if (strstr($agent,"Safari/") and strstr($agent,"Version/4")) {$br = "Safari 4";} if (strstr($agent,"Safari/") and strstr($agent,"Version/3")) {$br = "Safari 3";} if (strstr($agent,"SeaMonkey/") and strstr($agent,"Gecko")) {$br = "SeaMonkey";} echo "Browser: <b>$br</b>, OS: <b>$os</b>"; I found some information from he http://www.zytrax.com/tech/web/browser_ids.htm Is there any better solution for this, or script above is accurate? Hello, I will tell you whant I want to do first and what I've done so far and hopefuly someone will be able to help. What I hope for is to have one unique index.php that will work everywhere. I don't mind if I have to modify each and add path where it is located since this won't happen often. It needs to take car of preferred language and if someone land in a directory, I want it to load the index.php there. I also look to not expose hidden URL in the browser URL box. See *note 1 below. My directory structure is as follow: /index.php /about/index.php /blahblah/index.php The current index.php I'm trying to build looks like this: <?php if (preg_match('/^www.(.+)$/i', $_SERVER['HTTP_HOST'], $matches)) { header("Status: 301 Move permanently", false, 301); header('Location: http://'.$matches[1].$_SERVER['REQUEST_URI']); exit; } session_start(); $Lang = $_SESSION['lang']; if (!isset($Lang)) { if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $Lang = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); $Lang = strtolower(substr(chop($Lang[0]),0,2)); if ($Lang !== 'fr' && $Lang !== 'en') { $Lang = "en"; } } else { $Lang = "en"; } $_SESSION['lang'] = $Lang; } include $_SERVER["DOCUMENT_ROOT"] . ("/index_" . $_SESSION['lang'] . ".php"); ?> First I remove "www." in the address when applies. Not a must but I like that. Then I check if Language is already set, if not I detect and set it for next pages. I finally load the proper page according to language with an "include" so index_en.php remain secret (sort of). *note 1: all my index_xx.php pages in every directory have this: Code: [Select] <script language="javascript" type="text/javascript"> if (self == top) top.location.href="directory/index.php"; </script> When in the root, it seems to work and I get the proper page but if I place this in /about/ then when I tried to load /about/index.php it doesn't work. I think the include on the last line could be the problem. I'm either close or far from it, I don't know. Thank you. I was on a proxy and it didnt detect it, idk why. if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']) || !empty($_SERVER['HTTP_X_FORWARDED']) || !empty($_SERVER['HTTP_FORWARDED_FOR']) || empty($_SERVER['HTTP_CONNECTION']) || $hostaddr == "." || stripos($hostaddr, "tor-exit") || !empty($_SERVER['HTTP_VIA']) || empty($_SERVER['HTTP_ACCEPT_ENCODING']) || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554)) ) { die('on Proxy'); Hello Has anyone managed to create a php script that will detect and list the AddOns in a browser such as Firefox or Chrome? I need to know if a user has a particular extension loaded and if it is disabled or enabled. Paul Hi guys, Before I am going to create php script to make a proxy detection, I want to ask that if it possible to create a method that checking whether if the proxy server is a located governments or fbi. Is it possible? If so, what method I would use? Thanks, Mark Guys: I'm implementing a form for user submission. At the end of the form, there is an image that displays some randomly generated code. The user will be required to enter the code shown on this image before he clicks the submit button. This is done to protect the form from spamming, automatic submission. After the submit button is clicked, I need to do this: if ($_POST['the code the user enters'] == the code on the image) { // proceed(); } Any idea on how to get the code displayed on the image ? Thanks. Hi, I came across this code that detects a user's browser and I don't understand parts of it. Here is the code below. Code: [Select] $agent = $_SERVER['HTTP_USER_AGENT']; if ( strpos(strtoupper($agent), 'MSIE')) { print "Internet Explorer"; } else if (strpos(strtoupper($agent), 'FIREFOX')) { print "Firefox"; } else if (strpos(strtoupper($agent), 'KONQUEROR')) { print "Konqueror"; } else if (strpos(strtoupper($agent), "LYNX")) { print "Lynx"; } else { print $agent; } and here is the part I don't understand. Code: [Select] if ( strpos(strtoupper($agent), 'MSIE')) I know that strtoupper makes all letters uppercase, and that strpos returns the position of the string within the larger string, but I don't know why they are in an if statement. Any help or explanation is greatly appreciated. Thanks. Derek Hi Everyone: Can anyone show me or direct me to a PHP PHP Mobile Device Detection & Redirection Script. I use to use this when doing ASP: Code: [Select] <% Dim user_agent, mobile_browser, Regex, match, mobile_agents, mobile_ua, i, size user_agent = Request.ServerVariables("HTTP_USER_AGENT") mobile_browser = 0 Set Regex = New RegExp With Regex .Pattern = "(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm)" .IgnoreCase = True .Global = True End With match = Regex.Test(user_agent) If match Then mobile_browser = mobile_browser+1 If InStr(Request.ServerVariables("HTTP_ACCEPT"), "application/vnd.wap.xhtml+xml") Or Not IsEmpty(Request.ServerVariables("HTTP_X_PROFILE")) Or Not IsEmpty(Request.ServerVariables("HTTP_PROFILE")) Then mobile_browser = mobile_browser+1 end If mobile_agents = Array("w3c ", "acs-", "alav", "alca", "amoi", "audi", "avan", "benq", "bird", "blac", "blaz", "brew", "cell", "cldc", "cmd-", "dang", "doco", "eric", "hipt", "inno", "ipaq", "java", "jigs", "kddi", "keji", "leno", "lg-c", "lg-d", "lg-g", "lge-", "maui", "maxo", "midp", "mits", "mmef", "mobi", "mot-", "moto", "mwbp", "nec-", "newt", "noki", "oper", "palm", "pana", "pant", "phil", "play", "port", "prox", "qwap", "sage", "sams", "sany", "sch-", "sec-", "send", "seri", "sgh-", "shar", "sie-", "siem", "smal", "smar", "sony", "sph-", "symb", "t-mo", "teli", "tim-", "tosh", "tsm-", "upg1", "upsi", "vk-v", "voda", "wap-", "wapa", "wapi", "wapp", "wapr", "webc", "winw", "winw", "xda", "xda-") size = Ubound(mobile_agents) mobile_ua = LCase(Left(user_agent, 4)) For i=0 To size If mobile_agents(i) = mobile_ua Then mobile_browser = mobile_browser+1 Exit For End If Next If mobile_browser>0 Then Response.Redirect("http://www.sp.com/SPMOBI/MOBI.asp") End If %> Is there a PHP equivalent of this? As always, I appreciate to wisdom of the board. Thanks! Can I rely on the $_SERVER variable of HTTP_ACCEPT_LANGUAGE to get the language of the browser? I know that some browsers don't send things the same way, and even some servers may not use all variables. Is this the most common way to determine the user's language? Is there another or more preferred way?
Thank you.
|