Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Fri Apr 19, 2024 10:04 pm
Predictive Dialer


All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: module.access.php needs syntax change?
PostPosted: Fri Mar 07, 2008 6:38 pm 
Offline

Joined: Tue Feb 12, 2008 11:34 am
Posts: 87
Location: Germany
Dear All php programmers,
First of all a lot of respect for your work.
Second: I am really new to php and mysql, started looking into files after i started installing a2billing. I have some experience in JSP and Java, and Oracle SQL/PLSQL, So php syntax didn't look too different from jsp/java, I think there is a sytax error (no offense please).
So if I am wrong in my please accept my apologies in advance:

I am using A2Biling version 1.3.2
Alright, I come to the point:

I have read posts here about Blocked Account message, and also experiencing myself that no matter if an account exists or not in the database a2billing always throws "ACCOUNT BLOCKED" error.

When I look into the file module.access.php line 130 through 136 this is the code which returns errors -1 or -2
Code:
   if( $row [0][2] != "t" && $row [0][2] != "1" ) {
      return -1;
   }

    if( ACTIVATEDBYUSER==1 && $row [0][7] != "t" && $row [0][7] != "1" ) {
      return -2;
   }

Now what I understand is this code will always return -1 No matter if the query returned null or account is blocked (activated = 'f').

The second statement which should return -2 is never executed i think there is error in if statement , I don't know where does this 'ACTIVATEDBYUSER' come from? and due to this if is never true and error -2 is never returned.

What I experimented was this:
Repalced the code from line 130 through 136 with following:
Code:
if( $row [0][2] == "f") {
      return -1;
   }

    if( $row [0][7] != "t") {
      return -2;
   }


And this performs the required actions, (again i think so)

To be honest I don't know whats the purpose of using && operator in

Code:
if( $row [0][2] != "t" && $row [0][2] != "1" )


And i wonder how can $row [0][2] have a value =1 anyway if we have only two values in the database for column activated (t or f). And more amazing is that it lets user login if he is activated. Does && not work like in C++ or java? my understanding of && operator is that if the first statement is true, it returns immediate and if first is false then second would be evaluated and if false then again it should return.

Would be great if someone responds.

with sincere regards
mazhar


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 07, 2008 7:02 pm 
Offline

Joined: Thu Oct 19, 2006 9:56 am
Posts: 300
Location: Athens, Greece
The last is wrong. "&&" is the AND operator and all operands must be true ..


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 07, 2008 7:42 pm 
Offline

Joined: Tue Feb 12, 2008 11:34 am
Posts: 87
Location: Germany
You are right,, I understand what && (AND) operator is,, I was talking in reference with the statement in the code.
That is in this particular case:
Code:
if( $row [0][2] != "t" && $row [0][2] != "1" )


If the statement
Code:
$row [0][2] != "t"
returns true
then it event won't bother to look at
Code:
$row [0][2] != "1"

and return. because it won't matter if the second one is true or false as both need to be true.

So my confusion is if an account is active i.e. has activated = 't' in the database then the query would return 't' in this array, but since there is no value equal to 1 in the database for activated '1' will never be present in the array then how come it let user login and not return -1

Anyhow what about my replacement of the code? is that right what i did or is there some side-effect ?

regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 
Hosted Voice Broadcast


All times are UTC


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group