php + mysql user registration login code

Source: Internet
Author: User
Keywords Network programming PHP tutorial
Tags added code echo function html http login mysql

This is a section using PHP and mysql database tutorials to achieve user registration and login code Oh, the function is relatively simple and practical user registration procedures Oh. At the same time also added when the user login verification code program, this is a lot of safety Oh.
* /
?>

<! doctype html public "- // w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns = "http://www.jzread.com/1999/xhtml">
<head>
<meta http-equiv = "content-type" content = "text / html; charset = gb2312" />
<title> Add users </ title> in the background
</ head>

<body>

<? php
require_once ("config.php");
if (isset ($ _ post ["submit2"])) {
mysql_select_db ('a0807000225'); / / this is the database table
$ author = $ _ session ["user_name"];
define (all_ps tutorial, "jinquan");
echo $ username = $ _ post ["username"];
echo $ password = md5 ($ password = $ _ post ["password"]. all_ps);
echo "</ br>";
if ($ username) {
if ($ password) {
$ str = "insert into` dx_user_list` (`uid`,` m_id`, `username`,` password`) values ​​(ascii (null), '1', '$ username', '$ password'); ";
$ rs = mysql_query ($ str, $ conn);
mysql_close ($ conn);
}
if ($ rs) {
echo "<script> alert ('add new'); location.href = 'yonghuzc.php' </ script>";
} else {
echo "<script> alert ('new failed'); location.href = '' yonghuzc.php '</ script>";
}
}
}
?>

Related Article

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.