This topic is locked
[SOLVED]

  register form

6/29/2011 10:12:29
PHPRunner General questions
R
rocknroll_france author

Hi,

On my project, i tried several ways but no issue at this time...
I'll try to clearly explain my problem in a poor english !
I have a table for users/pasword/mail adresses
I programm Phprunner for having the register form wih email to new user and admin. No problem at this time.

(no activation link on mail)
The problem is that whatever I tried, the new user have always the possibility of enter the entire project immediatly by clicking on the "Back to login page" button..
Is it possible to:
have a notification by mail to user and admin (done) but no possibilities to acces the project before "Admin" make a validation ?
Thanks for answers.
Rocknroll

R
rocknroll_france author 6/29/2011

Some new...

I delete some fields in the register page and on the register successful page.

Also, the links doesnot appear anymore.
BUT: if the user comes back to the login form and enter his login/password, he has acces to the project.... Not good !!!!!
Any idea to block the users until validation by Admin ?
thanks
Rocknroll



Hi,

On my project, i tried several ways but no issue at this time...
I'll try to clearly explain my problem in a poor english !
I have a table for users/pasword/mail adresses
I programm Phprunner for having the register form wih email to new user and admin. No problem at this time.

(no activation link on mail)
The problem is that whatever I tried, the new user have always the possibility of enter the entire project immediatly by clicking on the "Back to login page" button..
Is it possible to:
have a notification by mail to user and admin (done) but no possibilities to acces the project before "Admin" make a validation ?
Thanks for answers.
Rocknroll

C
cgphp 6/29/2011

Keep a boolean flag in DB. When admin set it to true the new user is validated.

R
rocknroll_france author 6/29/2011

Hi cristian,

Phprunner add automatically a field named "Active", set to 1 when a user register.

I tried to change it to 0... no way... I don't know the utility of this flag !!!!
Anymore, I don't know where (which page/form) must I program such a routine....

C
cgphp 6/29/2011

If you don't use the activation link, the user is active by default.
You can use a second custom flag and set it to FALSE(0) in the "After successful registration" event.
In the "Before login" event you can check this flag: if it is FALSE(0) return FALSE otherwise return TRUE.
Only an admin can set to TRUE(1) this flag in your application.
Hope to help you.

R
rocknroll_france author 6/29/2011

Hi Cristian,

Thanks for answer.... but for me you speak..... chenese.... LOL

Do you have an exemple ?

I created one another field named "validate2" (int(1)) in my table. And... that's all !

Sorry for giving you elementary work, but phprunner is a little bit diffucult for me at this time...

C
cgphp 6/29/2011

Take a look at this pages: http://xlinesoft.com/phprunner/docs/before_login.htm and http://xlinesoft.com/phprunner/docs/after_successful_registration.htm
You can access db from these events using the

global $conn;

or

global $dal;
R
rocknroll_france author 6/30/2011

Thanks for the links, but I read them BEFORE posting my first post !

These links does not explain "how to" ! That's juste information about the events...
"You can access db from these events using the global $conn; or global $dal;"...

Yes, I understood that, but if I put ONLY "global $conn" on the considered page, I think that it will not be sufficient...!!!
Clearly, what I need at this time is

Indications (examples ?) of "How check the flag in the Before Loging section" !

Indications (examples ?) of "how set the flag to 0 in the After successful registration event" !
Users of Phprunner are not specially expert in programming... If I bought (expensive !) Phprunner, that is because I'm not an Expert in programming and Phprunner could strongly help me to build project, instead of programming all lignes...
Beginners are beginners, and even they know elementary PHP coding, they still beginners until they have indications... !!!!

C
cgphp 6/30/2011



Clearly, what I need at this time is

Indications (examples ?) of "How check the flag in the Before Loging section" !

Indications (examples ?) of "how set the flag to 0 in the After successful registration event" !


You have to read the guide to learn more about PHPrunner. You are asking for custom code but I'll tell you how to do the first step. To set the flag you need an update sql statement.
In the "Before login" event:

global $conn;

$sql = "SELECT flag_field_name FROM your_table_name WHERE username_field_name='".$username."' AND password_field_name='".$password."'";

$rs = db_query($sql,$conn);

$data=db_fetch_array($rs);

if($data['flag_field_name'] == 1)

{

return true;

}

else

{

$message = "You can't access this page";

return false;

}
R
rocknroll_france author 6/30/2011

Many thanks Cristian,

Your example shows me that the syntax is the same as in PHP (and it works fine LOL) <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59105&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

My problem was that I found examples with another syntaxes (doen't works !) <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59105&image=2&table=forumreplies' class='bbc_emoticon' alt=':angry:' />

If .... then

else

endif
I was turning around it...
I know that I have to learn about Phprunner. This is not a problem ! But explanations on the "Help" are not really clear sometimes...

And I tought that the forum was here to help users in all problems... (including coding)

Beside this, I understand that "Admins" are not really here to support custum code, but other users could (may be !) help others... No ?
See you later for one another custom code <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59105&image=3&table=forumreplies' class='bbc_emoticon' alt=';)' />