Desktop Center (2) database writing

Source: Internet
Author: User
Tags password protection

Source: Aesop

Desktop Center (2) database writing
Author: elong

1. The following is the HTML written by the database:ProgramYou can add the password function. Make the password into a variable and send it to the written PHP program below. In this way, password protection is implemented:
<HTML>
<Head>
<Title> database </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Style type = "text/CSS">
<! --
. P9 {font-size: 9pt}
-->
</Style>
</Head>

<Body bgcolor = "# ffffff">
<Div align = "center">
<P class = "P9"> Database Management Program

<A href = "mysql. php"> View database information </a> </P>
<P class = "P9"> <a href = "ww. php"> modify data </a>

</P>
<Form method = "Post" Action = "wsql. php">
<P align = "Left"> <SPAN class = "P9"> image URL
<Input type = "text" name = "url" size = "100">

Image thumbnail
<Input type = "text" name = "mess" size = "100">

Description
<Input type = "text" name = "fromx" size = "100">
</Span> </P>
<P align = "Left"> <SPAN class = "P9"> image URL 1
<Input type = "text" name = "url1" size = "100">

Image thumbnail 1
<Input type = "text" name = "mess1" size = "100">

Description 1
<Input type = "text" name = "fromx1" size = "100">
</Span> </P>
<P align = "Left"> <SPAN class = "P9"> image URL 2
<Input type = "text" name = "url2" size = "100">

Image thumbnail 2
<Input type = "text" name = "mess2" size = "100">

Description 2
<Input type = "text" name = "fromx2" size = "100">
</Span> </P>
<P align = "Left" class = "P9"> <SPAN class = "P9"> image URL 3
<Input type = "text" name = "url3" size = "100">

Image thumbnail 3
<Input type = "text" name = "mess3" size = "100">

Description 3
<Input type = "text" name = "fromx3" size = "100">
</Span>

Landscape color watercolor
<Input type = "radio" name = "jpg" value = "jpg" Checked>

Star photo
<Input type = "radio" name = "jpg" value = "jpg1">

Anime tablecloth
<Input type = "radio" name = "jpg" value = "jpg2">

Ad Creativity
<Input type = "radio" name = "jpg" value = "jpg3">

Other classes
<Input type = "radio" name = "jpg" value = "jpg4">

<Input type = "Submit" name = "Submit" value = "Submit">

</P>
</Form>
</Div>
</Body>
</Html>

2. the PHP program that handles the submission is as follows:
<HTML>
<Head> <title> Search </title>
</Head>
<Body>
<H1> database data <?
Mysql_connect ("localhost", "username", "password") or die ("unable to connect to the database! ");
$ Query = "insert into $ JPG values ('$ id',' $ url', '$ mess', '$ fromx', '$ url1',' $ mess1 ', '$ fromx1', '$ url2', '$ mess2', '$ fromx2', '$ url3', '$ mess3',' $ fromx3 ')";
$ Result = mysql_db_query ("elong", $ query); // execute write

If (mysql_affected_rows () = 1)
{
Echo "the data has been added to the database $ JPG

";
Echo "<Table> N
<Tr> N
<TD> id <TD> $ id </tr> N
<Tr> N
<TD> URL <TD> $ URL </tr> N
<Tr> N
<TD> thumbnail <TD> $ mess </tr> N
<Tr> N
<TD> description <TD> $ fromx </tr> N
<Tr> N
<TD> URL 1 <TD> $ url1 </tr> N
<Tr> N
<TD> Fig 1 <TD> $ mess1 </tr> N
<Tr> N
<TD> description 1 <TD> $ fromx1 </tr> N
<Tr> N
<TD> URL address 2 <TD> $ url2 </tr> N
<Tr> N
<TD> Fig 2 <TD> $ mess2 </tr> N
<Tr> N
<TD> Note 2 <TD> $ fromx2 </tr> N
<Tr> N
<TD> URL 3 <TD> $ url3 </tr> N
<Tr> N
<TD> Fig 3 <TD> $ mess3 </tr> N
<Tr> N
<TD> Note 3 <TD> $ fromx3 </tr> N
</Table> N ";
}
Else echo "An error occurred. Please try again! :(";
Mysql_close ();
?>
<A href='set.htm '> return to the home page </a>
</Body>
</Html>

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.