Jump to content

can you help me to return a class?


sangoku

Recommended Posts

ok i have a class:

 

class bruteAttackLog extends DatabaseObject

{

    protected static $table_name = 'brute_attack_log';

    protected static $db_fields =

    array('IP_adresa','broj_napada','zakljucana_do','broj_zakljucavanja','trajno_zatvorena','MAC_adresa');

// these are the rows in the database    

    public  $IP_adress;

    public  $attak number;

    public  $locked_untill;

    public  $locked_times;

    public  $perma lock;

    public  $MAC_adresa;

    function makeLog()

   {  

       

     

        $log = self::find_by_IP(); //this thing finds the ip if it exists in the brut lock table and returns it in a  form of a object of this object

 

       

        if (!$log){//if it dous not exist then make one

            $this->IP_adresa = funkcijeOsnovne::uzmiIP();

            $this->broj_napada = 1;

            $this->create();

//crate is defined in an another class  and works 100% and it populates the object

        } else {//if teh entry exists then:

           

            //we check if there is a over step

          if($log->attacked<= max_nr_of_attacks) {

              $log->locked_until  = date('c',time()-1);

              // we set the locked until time

              $log->attack_nr += 1;

              $log->update();//update returns false/true no object just like save

              return $log; and here it returns the object here is my problem!!!!!!!!!!!!!

          }

         

        }

       

}

 

this is not the whole class, it is pretty big

 

 

my point is when i call the class like

$log = new bruteAttackLog();

$log->makeLog();

it duos the create thing, it duos even the update.

But id duos not return the object to the $log object  when the update hapens....i still get a  empty object,  how do i correct it??????????  :D

 

 

:wtf:  I am out of ideas....

Link to comment
https://forums.phpfreaks.com/topic/192198-can-you-help-me-to-return-a-class/
Share on other sites

Ok  :-[I admit it ::) I am an giant idiot  >:(

@selfdefence:

 

Well you cant blame me  im on the computer over 12 h already and it is 0:25 ,,,

 

you cant return a object inside an object ::) you have to use $this-> statments....

 

:'(  On to rewriting my other classes....

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.