To make a background login, you need to use the check code. The user tracks you need to use the sessionID. Of course, the default PHP has a sessionID after the session is turned on, but I need my own, and I can store it into the database, then I will Try it, constructing the following functions. / ****** Generate session ID ****** / basic ideas: is to get the time of the current microsecond, and then generate a random number, add the random number and the current time after encryption, finally Adjuned the required length / * function name: create_sess_id () function effect: Generate a random session ID parameter: $ LEN: Need a session string length, default is 32 bits, do not lower than 16 bits return value: Return session ID of function: heiyeluren * / function create_sess_id ($ len = 32) {// check whether the length of the valid submission if (is_numeric ($ len) || ($ len> 32) || ($ len <16)! {RETURN;} // Get the current time microsecond List ($ u, $ s) = exPlode ('', microtime ()); $ time = (float) $ u (float) $ S; // Generate A random number $ RAND_NUM = Rand (100000, 99999); $ RAND_NUM = Rand ($ RAND_NUM, $ TIME); Mt_srand ($ RAND_NUM); $ RAND_NUM = MT_RAND (); // Generate sessionid $ sess_id = MD5 (MD5 ($ Time). MD5 ($ RAND_NUM)); // Intercept SESSID $ sess_id = SUBSTR ($ sess_id, 0, $ len); Return $ sess_id;} / ****** Generate check code ** **** / Idea: This idea is relatively simple, because our check code can take a string in the session ID, because our sessionid is full of unique. / * Function Name: CREATE_CHECK_CODE () function effect: Generate a random check code parameter: $ le: You need to check the length of the code, please don't be longer than 16 bits, default is 4-bit return value: Return to the specified length (! is_numeric ($ len) || ($ len> 6) || ($ len <1)): checksum function OF heiyeluren * / function create_check_code ($ len = 4) {if {return;} $ check_code = Substr (Create_Sss_ID (), 16, $ LEN); Return StrtOUPPER ($ check_code);} / ****** Picture to generate a check code ****** / This is some relatively simple PHP image programming Things, I have a picture and simple.