A very detailed login code can be of great help to php beginners. If you need it, you can view it for free.
.
Index. php tutorial
The Code is as follows: |
Copy code |
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <Html xmlns = "http://www.w3.org/1999/xhtml"> <Head> <Meta http-equiv = "Content-Type" content = "text/html; charset = gbk"/> <Title> system logon </title> <Link href = "csstutorial .css" rel = "stylesheet" type = "text/css"/> </Head> <Body> <Div id = "box"> <Div id = "denglu"> <Div id = "pic"> & nbsp; system background logon </div> <Form action = "check. php" method = "post"> <P> User Name: <Input type = "text" name = "name" id = "name"/> <Span class = "must"> * </span> </p> <P> password & nbsp; Code: <Input name = "password" type = "password" id = "password"/> <Span class = "must"> * </span> </p> <P> Verification Code: <Input name = "check" type = "text" id = "check" size = "8"/> <span class = "must"> * </span> </p> <P class = "form_button"> <Input type = "submit" name = "sub" id = "sub" value = "login"/> <Input type = "reset" name = "unsub" id = "unsub" value = "cancel"/> </P> </Form> </Div> </Div> </Body> </Html> |
Connect to connect. php
The Code is as follows: |
Copy code |
<? Php $ Connect = mysql tutorial _ connect ("localhost", "root", "") or die ("server connection failed "); Mysql_select_db ("test", $ connect) or die ("no corresponding database is created "); $ SQL = "select * from admin "; ?> |
Piccheck. php
The Code is as follows: |
Copy code |
<? Php /* * Created on 2011-8-10 * * To change the template for this generated file go * Window-Preferences-PHPeclips tutorial e-PHP-Code Templates */ Session_start (); $ Code = rand (). dechex (rand (). rand (). dechex (rand )); $ _ SESSION [pic] = $ code; $ Image = imagecreatetruecolor (50, 18 ); $ Color = imagecolorallocate ($ image, 0); // The first time you use the color palette, it is set to the background color. $ Colortext = imagecolorallocate ($ image, rand (100,255), rand (100,255), rand (100,255 )); Imagestring ($ image, 10, rand (1, 15), rand (1, 5), $ code, $ colortext ); Imagegif ($ image ); ?> |
Css.css File
The Code is as follows: |
Copy code |
@ Charset "UTF-8 "; /* CSS Document */ Body { Background-color: # 9CF; Text-align: left; } # Denglu { Width: 400px; Margin-top: 0px; Margin-right: auto; Margin-bottom: 0px; Margin-left: auto; Background-image: url (images/login.gif ); Background-repeat: no-repeat; Height: 320px; Text-indent: 6px; } # Box # denglu form { Position: relative; Top: 50px; Left: 10px; Width: 92%; } . Must { Color: # F00; Font-size: 12px; } # Box # denglu # pic { Background-image: url (images/dot1.gif ); Background-repeat: no-repeat; Height: 20px; Width: 100px; Font-size: 12px; Color: # F00; Text-align: left; Line-height: 18px; Left: 10px; Top: 30px; Position: relative; } |