Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Funzione problematica

  1. #1

    Funzione problematica

    ciao a tutti
    ho un problemino, mi è stata postata questa funzione, ma piu di qualche volta non mi restituisce nulla, c'è qualche errore o ci sono altri motivi possibili ?
    grazie

    $agent = getenv("HTTP_USER_AGENT");
    function browser_in_use() {
    global $agent;
    $b =& $agent;
    if (eregi("Opera[ \/]([0-9\.]+)",$b)) {
    $type = "Opera";
    } elseif (eregi("netscape[[:alnum:]]*[ \/]([0-9\.]+)",$b)) {
    $type = "Netscape Navigator";
    } elseif (eregi("msie[ \/]([0-9\.]+)",$b)) {
    $type = "Internet Explorer";
    } elseif (eregi("Mozilla[ \/]([0-9\.]+)" ,$b)) {
    if (eregi("firefox",$b)) {
    $type = "Mozilla Firefox";
    } elseif (eregi("konqueror",$b)) {
    $type = "Konqueror";
    } elseif (eregi("galeon",$b)) {
    $type = "Galeon";
    } elseif (eregi("gecko",$b)) {
    $type = "Mozilla";
    } else {
    $type = "NotRec";}
    } elseif (eregi("([[:alnum:]]+)[ \/v]*([0-9\.]+)" ,$b)) {
    $type = $a[1];
    } else { $type = "NotRec";}
    return $type;}

    $browser=browser_in_use();
    echo $browser;
    Kalton
    -------------------
    www.kalton.it - www.kalton.cavarzere.it

  2. #2
    ???
    Kalton
    -------------------
    www.kalton.it - www.kalton.cavarzere.it

  3. #3
    Utente di HTML.it
    Registrato dal
    Nov 2001
    Messaggi
    274
    fai un po` di debugging del code.. stampa $agent e vedi se la variabile contiene qualcosa..

    se poi comunque e` vuota,
    sostituisci a:
    codice:
    $agent = getenv("HTTP_USER_AGENT");
    function browser_in_use() {
    global $agent;
    $b =& $agent;
    questo:
    codice:
    $agent = $_SERVER['HTTP_USER_AGENT'];
    function browser_in_use() {
    global $agent;
    $b = $agent;
    nel caso leggi qui..
    http://it2.php.net/manual/it/function.get-browser.php
    Progeny

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.