Automatic form submission, form submission
In a project, for example, B2B jumps from the mall to the background of the seller center. When he logs on to the mall as both a member account and a seller, the seller does not need to log on to the mall, the form can be used for automatic logon during processing.
Simple implementation: You can store the login name, password, and user ID in a place where normal members can log on. For security purposes, you can use aes encryption (described in the previous article ), store the cookie and go to the seller center on the page. You can determine whether the cookie is saved and whether it is a seller. If yes, use form to automatically log on to the seller.
The implementation case in ecshop:
Create a lib_assist_form.php file under the nodes:
Class form {public function hform ($ username, $ password) {$ str = '<body> <form action = "privilege. php "method =" post "id =" qqform "name =" qqform ">;$ str. = 'account: <input type = "text" name = "username" value = "'. $ username. '"/> <br/>'; $ str. = 'password: <input type = "text" name = "password" value = "'. $ password. '"/> <br/>'; $ str. = '<input type = "hidden" name = "act" value = "signin"/> </form> </body>'; $ str. = '<scrip T> window. onload = function () {document. getElementById ("qqform"). submit () ;}</script> '; echo $ str; exit ;}?>
In the signin method of privilege. php, perform aes decryption and introduce lib_assist_form.php ::
require_once(ROOT_PATH . 'includes/lib_smt_from.php'); $form = new form(); $username = $j_token['username']; $password =$j_token['password']; $a = $form->hform($username,$password); exit;
In this way, form automatically submits logon. If it is a member or a seller's identity, you can achieve one login.
You are welcome to leave a comment to record the growth process and hope you can grow together.