This topic is locked

Login Page

2/25/2013 04:57:42
PHPRunner General questions
M
msalim author

Is there any way to add a new field to the login page without hacking the login.php??
Example:
User ID:

Password:

Agency Code: (this field should also be validated from the database table)
Thanks

Sergey Kornilov admin 2/25/2013

Yes, you can add this field to the login page in Visual Editor. You can also add your own validation to BeforeLogin event.

M
msalim author 2/25/2013

An example would be highly appreciated.
Thanks

Sergey Kornilov admin 2/25/2013

What sort of example you looking for?
Take a look at this tutorial just in case:

http://www.4serendipity.com/form/

M
msalim author 2/26/2013



What sort of example you looking for?
Take a look at this tutorial just in case:

http://www.4serendipity.com/form/


Thanks for the link, but I am no PHP coder at least for now, but I do know the basics how to validate userid and password from the database in a php script. Having said that, I would like an example on how to implement it in PHPRunner, the scenario is below:
Login page -
UserID

Password

Agency Code
As far as checking the UserID and Password, PHPRunner is doing it through the login page, but I would also like to check the Agency Code in the database, if validated then it should proceed otherwise as message should appear that the Agency Code is not valid.
How can I implement it in PHPRunner login page through the events page.
Thanks

Sergey Kornilov admin 2/26/2013
  1. Add a new input field to the login page. Switch to HTML mode and paste the following where you need new field to appear:

<INPUT type=text size=20 name=AgencyCode>


2. Now in your BeforeLogin event you can access it as $_POST["AgencyCode"]
As a simple test add the following code to the beginning on BeforeLogin event:

echo $_POST["AgencyCode"];

exit();


This is it. If you need something more complicated i.e. running a query against your database check sample events in the manual:

http://xlinesoft.com/phprunner/docs/check_if_specific_record_exists.htm