Bag tag-light B2C e-commerce website login verification instance, bagb2c
Select email type username to log onLight B2C e-commerce websitesCheck whether the user name is a valid email address and the password is not empty.
Select username type and enter username and password
<TR> <TD width = 62 align = center> User Selection: </TD> <TD width = 256> <select name = my_type onChange = "swapAction (this. value) "> <chtml> <if x =" @ {pPage: i} "else = 0> <option value = 0 selected> email address </option> <option value = 1 x = 1 selected> mobile phone number </option> <option value = 2 x = 2 selected> VIP card number </option> </if> </chtml> <option value = 0> email address </option> <option value = 1> mobile phone number </option> <option value = 2> VIP card number </option> </select> </TD> </TR> <TD align = center> User: </TD> <TD width = 256> <INPUT name = "username" style = "width: 220px; height: 22px; font-size: 14px "/> </TD> </TR> <TD align = center> password: </TD> <INPUT type = "password" name = "pass" style = "width: 120px; height: 22px; font-size: 14px "/> </TD> </TR>
Effect
File inLight B2C e-commerce websitesMe/login.html in the me directory
Check whether the user name is a valid email address
<bag id=pPage act=verify><we name="lets.go" type="mail">@{pPage:username}</we></bag>
Determine whether the verification is successful (if the verification fails, set v_pass of the pPage schoolbag to false and record the prompt information with pop. out)
<If x = "@ {pPage: lets. go} "> <bag id = pPage x = false> <we name =" v_pass "> false </we> <we name =" pop. out "> @ {pPage: pop. out} \ n Email: it must be a real email address! </We> </bag> </if>
Check whether the password is empty(If it is empty, set v_pass of the pPage schoolbag to false and record the prompt information with pop. out)
<If x = "@ {trim: @ {pPage: pass }}"> <bag id = pPage> <we name = "v_pass"> false </we> <we name = "pop. out "> @ {pPage: pop. out} \ n password: cannot be blank! </We> </bag> </if>
Check whether all verification items have passed
<If x = "@ {pPage: v_pass}" else = 1> <we x = false> <script> alert ("Verification Failed! \ N @ {pPage: pop. out} "); location. href = '@ {head: referer}'; </script> </we> <! -- Check the username and password -->... </we> </if>
If it fails, a prompt is output and the previous page is returned. If it succeeds, the logon operation is performed.
This part of code
<! -- Verification --> <bag id = pPage act = verify> <we name = "lets. go "type =" mail ">@{ pPage: username} </we> </bag> <if x =" @ {pPage: lets. go} "> <bag id = pPage x = false> <we name =" v_pass "> false </we> <we name =" pop. out "> @ {pPage: pop. out} \ n Email: it must be a real email address! </We> </bag> </if> <if x = "@ {trim: @ {pPage: pass }}"> <bag id = pPage> <we name = "v_pass"> false </we> <we name = "pop. out "> @ {pPage: pop. out} \ n password: cannot be blank! </We> </bag> </if> <if x = "@ {pPage: v_pass} "else = 1> <we x = false> <script> alert (" Verification Failed! \ N @ {pPage: pop. out} "); location. href = '@ {head: referer}'; </script> </we> <! -- Check the USERNAME and password --> <ESql module = help id = user commit = true> Select pass From base_user Where USERNAME = '@ {pPage: USERNAME} '</ESql> <if x = "@ {user: getLength} "else = 1> <we x = 0> <esql module = help act = edit> insert into base_user (username, pass, cnname) values ('@ {pPage: username} ',' @ {pPage: pass} ',' @ {strLeft :@{ pPage: username }(@)}') </esql> <bag id = pPage> <we name = v_pass> 1 </we> </bag> </we> <if x = "@ {user: pass} "else = 1> <bag id = pPage x =" @ {pPage: pass} "> <we name = v_pass> 1 </we> </bag> <bag id = pPage> <we name = v_pass> 0 </we> </bag> </if> </we> </if>
File in
Light B2C e-commerce websitesMe/login_check.chtml in the me directory
Try it yourself and try it easily and easily.
Download and description of light platform Resources
Platform and the latest development manual free download: http://download.csdn.net/detail/tx18/8464425
Development Instance:Light B2C e-commerce websites, Free download: http://download.csdn.net/detail/tx18/8318585
The light-Open Platform will occasionally upgrade to provide more powerful and Easy functions for you. Please note thatDownload the latest version