Admin المدير العام
وطني : الكويت تاريخ التسجيل : 20/07/2022 عدد المشاركات : 446 السٌّمعَة : 0 الجنس : نقاط : 1105 العمر : 94 المزاج : طبيعي العمل/الترفيه : كل شي
| موضوع: برمجه بدون قاعده بيانات برمجه خفيفة لكشف نوع المتصفح ومصدره php السبت أغسطس 06, 2022 5:50 am | |
| اعمل قالب بـ php وحط اي اسم تحب : المعدل : - اقتباس :
- <?php
function get_browser_name() { $useragent = $_SERVER['HTTP_USER_AGENT']; $browser = 'Unknown'; $version= ""; if(preg_match('/MSIE/i',$useragent) && !preg_match('/Opera/i',$useragent)) { $browser = 'Internet Explorer'; $ub = "MSIE"; } elseif(preg_match('/Firefox/i',$useragent)) { $browser = 'Mozilla Firefox'; $ub = "Firefox"; } elseif(preg_match('/Chrome/i',$useragent)) { $browser = 'Google Chrome'; $ub = "Chrome"; } elseif(preg_match('/Safari/i',$useragent)) { $browser = 'Apple Safari'; $ub = "Safari"; } elseif(preg_match('/Opera/i',$useragent)) { $browser = 'Opera'; $ub = "Opera"; } elseif(preg_match('/Netscape/i',$useragent)) { $browser = 'Netscape'; $ub = "Netscape"; } $known = array('Version', $ub, 'other'); $pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#'; if (!preg_match_all($pattern, $useragent, $matches)) { // we have no matching number just continue } $i = count($matches['browser']); if ($i != 1) { if (strripos($useragent,"Version") < strripos($useragent,$ub)){ $version= $matches['version'][0]; } else { $version= $matches['version'][1]; } } else { $version= $matches['version'][0]; } if ($version==null || $version=="") {$version="?";} return array( 'userAgent' => $useragent, 'name' => $browser, 'version' => $version ); } $ua=get_browser_name(); $yourbrowser= "متصفحك : " . $ua['name'] . " " . $ua['version']; echo "<p align=center><font style='color:green;'><b>$yourbrowser</b></font></p>"; ?> الاصلي : <?php function get_browser_name() { $useragent = $_SERVER['HTTP_USER_AGENT']; $browser = 'Unknown'; $version= ""; if(preg_match('/MSIE/i',$useragent) && !preg_match('/Opera/i',$useragent)) { $browser = 'Internet Explorer'; $ub = "MSIE"; } elseif(preg_match('/Firefox/i',$useragent)) { $browser = 'Mozilla Firefox'; $ub = "Firefox"; } elseif(preg_match('/Chrome/i',$useragent)) { $browser = 'Google Chrome'; $ub = "Chrome"; } elseif(preg_match('/Safari/i',$useragent)) { $browser = 'Apple Safari'; $ub = "Safari"; } elseif(preg_match('/Opera/i',$useragent)) { $browser = 'Opera'; $ub = "Opera"; } elseif(preg_match('/Netscape/i',$useragent)) { $browser = 'Netscape'; $ub = "Netscape"; } $known = array('Version', $ub, 'other'); $pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#'; if (!preg_match_all($pattern, $useragent, $matches)) { // we have no matching number just continue HaYeF 101 KuwaiT } $i = count($matches['browser']); if ($i != 1) { if (strripos($useragent,"Version") < strripos($useragent,$ub)){ $version= $matches['version'][0]; } else { $version= $matches['version'][1]; } } else { $version= $matches['version'][0]; } if ($version==null || $version=="") {$version="?";} return array( 'userAgent' => $useragent, 'name' => $browser, 'version' => $version ); } $ua=get_browser_name(); $yourbrowser= "Your browser: " . $ua['name'] . " " . $ua['version']; echo "<p align=center><font style='color:green;'><b>$yourbrowser</b></font></p>"; ?> وسلامتكم | |
|