Check that the verification code is correct. after the data is valid, the data is written to the database. if you release another verification code, the system normally accesses the form page again. the verification code image is passively updated, and the session and cookie will change accordingly, however, water filling machine operations
Let's analyze the verification code release process.
1. display the form
2. display the verification code (a program that generates the verification code). encrypt the verification code and put it into the session or cookie.
3. the user submits the form.
4. check that the verification code is correct. after the data is valid, the data is written to the database. if you release another one, the system will normally access the form page again. the verification code image is passively updated, the session and cookie also change, but the water filling machine operation does not have to use the form page, it can directly simulate the post to send data to the server program; in this way, the verification code program is not called, of course, the encryption verification code stored in the session and cookie is the last value and is not updated. in this way, the data sent directly through post is unlimited in the future, regardless of the verification code. the verification code is also false!
Therefore, after verifying the verification code, clear the session and cookie values, and then determine the validity of the data! Such a vulnerability is replaced!
-
- If (md5 ($ _ post ['vcode']) = $ _ session ['vcode']) {
- $ _ Session ['vcode'] = ''; // This sentence is very important.
- } Else {
- Exit 'incorrect verification code! ';
- }
- // Subsequent processing
- ......
- ?>
Program for generating verification code images
-
- Session_start ();
- ......
- $ V = new authcode ();
- $ Vcode = $ v-> getauthcode ();
- $ _ Session ['vcode'] = md5 ($ vcode );
- ........
- ?>
Form page
-
- ......
-
-