Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/04/2012, 04:17
Avatar de ahaugas
ahaugas
 
Fecha de Ingreso: agosto-2011
Ubicación: Madrid
Mensajes: 249
Antigüedad: 12 años, 8 meses
Puntos: 21
Pregunta opinion, es correcto este codigo?

Porfavor ser sinceros, necesito saber si es correcto este codigo, me refiero a que no tiene errores o sobra o falte algo, esque estoy provando una tecnica nueva y aun soy novato jejejeje pero bueno.

Código PHP:
<?php 

    
//Here request user actions in the web
    //And process to clean information
    
class UserInfo {
        var 
$Counternotice;
        var 
$Counterip;                 
        var 
$Counterremoteport;        
        var 
$Counterlocation;        
        var 
$Counterbrowser;          
        var 
$Counterfrom_page;        
        var 
$CounterDate;    
        var 
$CounterUser;        
        var 
$CounterTempUser;        
    
        function 
UserInfo() {
        
//Get username name if user has logged in
        
global $loggedInUser;
        if(!
isUserLoggedIn()) { $this->CounterTempUser "Guest"
        } else { 
$this->CounterTempUser $loggedInUser->display_username;
        }
        
        
$this->Counternotice         "User action info cleaned correctly";                
        
$this->Counterip             htmlentities($_SERVER['REMOTE_ADDR']);         //get visitor ip
        
$this->Counterremoteport    htmlentities($_SERVER['REMOTE_PORT']);         //get visitor Port
        
$this->Counterlocation        htmlentities($_SERVER['PHP_SELF']);             //get server file path
        
$this->Counterbrowser        htmlentities($_SERVER['HTTP_USER_AGENT']);     //get the browser name
        
$this->Counterfrom_page        htmlentities($_SERVER['REQUEST_URI']);        //page from which visitor
        
$this->CounterDate            htmlentities(date('Y-m-d'));                    //get actual date
        
$this->CounterUser            htmlentities($this->CounterTempUser);            //get name of user
        
}
        function 
show() {echo "$this->Counternotice"; echo "<br />";}
    }
    
    
    
//Extends for a next construction for UserInfo
    //Combine data cleaned and process to save
    
class RemoteUserInfo extends UserInfo {
        var 
$notice;
        var 
$theatre;
        var 
$notiveview;
        var 
$views;
        var 
$ip;                 
        var 
$port;        
        var 
$location;        
        var 
$browser;          
        var 
$from_page;        
        var 
$Datez;    
        var 
$User;
        
        function 
RemoteUserInfo() {
                global 
$db,$db_table_prefix;
                
$theatre = new UserInfo();
                
$this->notice        "Sucefull saved data";                 //get message
                
$this->ip             $theatre->Counterip;                     //get visitor ip
                
$this->port           $theatre->Counterremoteport;             //get visitor Port
                
$this->location        $theatre->Counterlocation;             //get server file path
                
$this->browser        $theatre->Counterbrowser;             //get the browser name
                
$this->from_page    $theatre->Counterfrom_page;            //page from which visitor
                
$this->Datez        $theatre->CounterDate;                //get actual date    
                
$this->User            $theatre->CounterUser;                //get name of user    
            
            //create log in database table
            
$sql "INSERT INTO ".$db_table_prefix."StatTracker    
                    (Browser,IP,Port,Date_Visited,Page,From_Page,User_Acces)
                        VALUES(    '$this->browser',
                                '$this->ip',
                                '$this->port',
                                '$this->Datez',
                                '$this->location',
                                '$this->from_page',
                                '$this->User')"
;
            return 
$db->sql_query($sql);
        }
        
        function 
showRemoteUserInfo() {
            global 
$db,$db_table_prefix;        
            
$this->noticeview        "Sucefull saved data";                   //get notice message
            //retrive page results an show
            
$sql "Select Count(*) from ".$db_table_prefix."StatTracker 
                    WHERE Page = '$this->location'"
;
                    
$result mysql_query($sql);
                    
$this->views mysql_result($result,0,'count(*)');
                    echo 
$this->views;
        }
        
        function 
modify_bust() { 
            echo 
$this->Counternotice     "10UC";                                 //get notice message code
            
echo "<br />";
            echo 
$this->notice             "20UC";                                //get second notice message code
            
echo "<br />";
            echo 
$this->noticeview         "30UC";                                //get third notice message code
            
echo "<br />";
            echo 
$this->User;
            }
    }
?>
Gracias, por vuestro tiempo y espero comentarios.