Automatic form submission, form submission

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.