Registration interface
Public "-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
View Code<?PHPinclude("dbda.php");$db=NewDbda ();//Control upload Formatif(($_files["Pic"] ["Type"]== "Image/jpeg" | |$_files["Pic"] ["Type"]== "Image/png") &&$_files["Pic"] ["Size"]<102400){ //working with file names $filename= "./img/".Date("Ymdhis").$_files["Pic"] ["Name"]; //transcoding format $filename=Iconv("UTF-8", "gb2312",$filename); //determine if a file exists if(!file_exists($filename)) { //Upload (save) file Move_uploaded_file($_files["Pic"] ["Tmp_name"],$filename); }}//add a piece of data to the database users$uid=$_post["UID"];$pwd=$_post["PWD"];$name=$_post["Name"];$sex=$_post["Sex"]== "male"?true:false;$url="/".$filename;$sql= "INSERT into users values (' {$uid}‘,‘{$pwd}‘,‘{$name}‘,{$sex},‘{$url}‘)";$db->query ($sql, 0);Header("location:wenjianshangchuan3.php");
View CodeLogin interface
Public "-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
View Code<?PHPSession_Start();include("dbda.php");$db=NewDbda ();$uid=$_post["UID"];$pwd=$_post["PWD"];$sql= "SELECT count (*) from users where Uid= ' {$uid} ' and pwd= ' {$pwd}‘";$zhi=$db->strquery ($sql);if($zhi>0){ $_session["UID"]=$uid; Header("location:wenjianshangchuan4.php"); }Else{ Echo"Login Failed"; }
View CodePersonal Data Interface
<! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >PHPSession_Start();if(Empty($_session["UID"])){ Header("location:wenjianshangchuan3.php"); Exit;}$uid=$_session["UID"];include("dbda.php");$db=NewDbda ();$sql= "SELECT * from Users where uid= ' {$uid}‘";$attr=$db->query ($sql);?><body><div><div> User name: <?phpEcho $attr[0] [0]?></div><div> Password: <?phpEcho $attr[0] [1]?></div><div> name: <?phpEcho $attr[0] [2]?></div><div> sex: <?phpEcho $attr[0] [3]? " Male ":" Female "?></div><div> head: $attr[0] [4]?> "width=" "height="/></div></div></body>View CodePHP Upload file Instance registration account