PHP Upload file Instance registration account

Source: Internet
Author: User

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 Code

Login 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 Code

Personal 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 Code

PHP Upload file Instance registration account

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.