Jump to content

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....

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.