Php简介:
引用:PHP即“超文本预处理器”,是在服务器端执行的脚本语言,尤其适用于Web开发并可嵌入HTML中。PHP语法学习了C语言,吸纳Java和Perl多个语言的特色发展出自己的特色语法,并根据它们的长项持续改进提升自己,例如java的面向对象编程,该语言当初创建的主要目标是让开发人员快速编写出优质的web网站。 PHP同时支持面向对象和面向过程的开发,使用上非常灵活。
经过二十多年的发展,随着php-cli相关组件的快速发展和完善,PHP已经可以应用在 TCP/UDP服务、高性能Web、WebSocket服务、物联网、实时通讯、游戏、微服务等非 Web 领域的系统研发。
我们开发php网站需要配置apache、mysql,利用集成环境开发网站,例如小皮面板、xampp等集成环境,现在我们利用PHP来做一个登录功能
前端页面:login.php
d877c38dfe6d3005ccc9b7336fbcdac0
8b05045a5be5764f313ed5b9168a17e6
100db36a723c770d327fc0aef2ce13b1
93f0f5c25f18dab9d176bd4f6de5d30e
ff94e7be1619a095952b0217c283b66c
9325f07d5ee000b791aa0e2d41c3ea79
b3c7cea9c5108026d29b214f796ba7df
e2704e862f167f39bfd113ae9c01df49
0069d8560d7bc062194b41882d743b38
e7bc5a6abff9afa5c73f1d398bb71886
8448925f133ecdbd4e628430b59244a12cacc6d41bbb37262a98f745aa00fbf0
5994da34af0234834cd8d632d4f1c5262cacc6d41bbb37262a98f745aa00fbf0
965237357465df1d11fca0161b31af3f2cacc6d41bbb37262a98f745aa00fbf0
ccb8621b7aad48c9d8a562dc099b48cc2cacc6d41bbb37262a98f745aa00fbf0
b2386ffb911b14667cb8f0f91ea547a76e916e0f7d1e588d4f442bf645aedb2f
9c3bca370b5104690d9ef395f2c5f8d1
6c04bd5ca3fcae76e30b72ad730ca86d
835db59e8bcc1934cc580fe4102b1403
173a25ad879eae6adfb1e8cf88265940
dc6dce4a544fdca2df29d5ac0ea9906b
560dc2cf5f61286c5337771d4be6cf3d
0c998a498d4bb99d357fbd026a89bea0
f86d17131095e9d8f5b66739f80fa4f954bdf357c58b8a65c66d7c19c8e4d114
65281c5ac262bf6d81768915a4a77ac0
16b28748ea4df4d9c2150843fecfba68
039dbc5dc7a2325bb985fa6d9a561642
45a2772a6b6107b401db3c9b82c049c2635837c3a36f47a8ad5df0921d7ac8a65a8028ccc7a7e27417bff9f05adf593272ac96585ae54b6ae11f849d2649d9e65db79b134e9f6b82c0b36e0489ee08ed54bdf357c58b8a65c66d7c19c8e4d114
16b28748ea4df4d9c2150843fecfba68
16b28748ea4df4d9c2150843fecfba68
0cb0d37bd827c253db804f192a046bde
926fbaeee457d63b300fd1ae81904598
030817b66d2175f2b3207b41152c7b9754bdf357c58b8a65c66d7c19c8e4d114
16b28748ea4df4d9c2150843fecfba68
6c12054be87346aec0920c394ee2e3aa
e002d7a8d07ee67e7173be47d1e5fd32
25edfb22a4f469ecb59f1190150159c6
9ef0119d98efbe01d0409e79cfac3925首页5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
7e3c38720c206efa7138f9ce6bc7e5ff模板5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
77bf89852c337d1d7b4d47d8b53d20a4套餐5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
778384ca7e0ca1540f93da8af939dd75案例5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
efc86c66f7c725828c13919863498098
3499910bf9dac5ae3c52d5ede7383485文档6f175935596a1cd4af1531ed20d13b9972ac96585ae54b6ae11f849d2649d9e65db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
a2133a93de9d57604e8dc99f6cc300a9
3499910bf9dac5ae3c52d5ede7383485关于6f175935596a1cd4af1531ed20d13b9972ac96585ae54b6ae11f849d2649d9e65db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
929d1f5ca49e04fdcb27f9465b944689
5ff5cd4398dedd2994f6accfe1c8d923
ff6d136ddc5fdfeffaf53ff6ee95f185
c03d504d8fc37b9626bd93af98b1a2d7
3499910bf9dac5ae3c52d5ede7383485返回上一级5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
3499910bf9dac5ae3c52d5ede7383485教程中心5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
3499910bf9dac5ae3c52d5ede7383485建站资讯5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
3499910bf9dac5ae3c52d5ede7383485更新日志5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
929d1f5ca49e04fdcb27f9465b944689
16b28748ea4df4d9c2150843fecfba68
652d4590fa9c3531a196feced0178b72
db837f111b490cf2a843ae6be9f2a7fe
896cec2cf8296f982099bf97dda1e743
3499910bf9dac5ae3c52d5ede7383485返回上一级5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
5c62385e7862a64aa12abcb3e9fa6177
3499910bf9dac5ae3c52d5ede7383485公司信息6f175935596a1cd4af1531ed20d13b9972ac96585ae54b6ae11f849d2649d9e65db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
3499910bf9dac5ae3c52d5ede7383485荣誉资质5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
3499910bf9dac5ae3c52d5ede7383485联系客服5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
929d1f5ca49e04fdcb27f9465b944689
16b28748ea4df4d9c2150843fecfba68
1d9fdce3b806493b433d7504d01df5dd
ff6d136ddc5fdfeffaf53ff6ee95f185
205fb9efb3a8556c061ab3acdc87a0af
3499910bf9dac5ae3c52d5ede7383485返回上一级5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
3499910bf9dac5ae3c52d5ede7383485公司介绍5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
3499910bf9dac5ae3c52d5ede7383485服务条款5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
3499910bf9dac5ae3c52d5ede7383485法律声明5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
3499910bf9dac5ae3c52d5ede7383485可接受服务5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6
3499910bf9dac5ae3c52d5ede7383485免责声明5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
929d1f5ca49e04fdcb27f9465b944689
16b28748ea4df4d9c2150843fecfba68
16b28748ea4df4d9c2150843fecfba68
16b28748ea4df4d9c2150843fecfba68
44f9630a3d507ae7532760da37622b0f
dc6dce4a544fdca2df29d5ac0ea9906b
dc6dce4a544fdca2df29d5ac0ea9906b
dc6dce4a544fdca2df29d5ac0ea9906b
c5f8d752a5a5b859c842b2f660c2c101
dc6dce4a544fdca2df29d5ac0ea9906b
7f7a76da34f48ad77c55494c9ffc859c用户名或邮箱8c1ecd4bb896b2264e0711597d40766c
53a41be44a280f7cf4025d65b6af70e0
16b28748ea4df4d9c2150843fecfba68
dc6dce4a544fdca2df29d5ac0ea9906b
39ced541509fd40cc54352ddf151ac55密码8c1ecd4bb896b2264e0711597d40766c
2845496f39d6af3c5f24f12ec05b80ce
16b28748ea4df4d9c2150843fecfba68
dc6dce4a544fdca2df29d5ac0ea9906b
2e1cf0710519d5598b1f0f14c36ba674
514d05be645eb7d51e331036aaf6fa36 记住我(请在私人计算机上使用此功能)
8c1ecd4bb896b2264e0711597d40766c
16b28748ea4df4d9c2150843fecfba68
dc6dce4a544fdca2df29d5ac0ea9906b
88aebddf53de96f3cea6473d134d71b2登录65281c5ac262bf6d81768915a4a77ac0
44238adb8e19c287e0d3e8312c798054注册5db79b134e9f6b82c0b36e0489ee08ed
16b28748ea4df4d9c2150843fecfba68
4a215f3237c3b605e995784b79619aa2
45a2772a6b6107b401db3c9b82c049c2其他账号登录:54bdf357c58b8a65c66d7c19c8e4d114
dc6dce4a544fdca2df29d5ac0ea9906b
c1a5f0a81dfd3a61af9b5bb2898516ed45a2772a6b6107b401db3c9b82c049c254bdf357c58b8a65c66d7c19c8e4d1145db79b134e9f6b82c0b36e0489ee08ed
fae4424bc87195d0e16684c11e10adfd45a2772a6b6107b401db3c9b82c049c254bdf357c58b8a65c66d7c19c8e4d1145db79b134e9f6b82c0b36e0489ee08ed
b628f8981bdfb2204efa6ce5df72691545a2772a6b6107b401db3c9b82c049c254bdf357c58b8a65c66d7c19c8e4d1145db79b134e9f6b82c0b36e0489ee08ed
1f8d53aa73690073d3cedf445a9880de45a2772a6b6107b401db3c9b82c049c254bdf357c58b8a65c66d7c19c8e4d1145db79b134e9f6b82c0b36e0489ee08ed
16b28748ea4df4d9c2150843fecfba68
16b28748ea4df4d9c2150843fecfba68
649884c9f235e0dc5bfe3cd9b4f6c158
8fb0647cc270c6c60ce1679670afa6fc忘记密码?点这里找回5db79b134e9f6b82c0b36e0489ee08ed
16b28748ea4df4d9c2150843fecfba68
f5a47148e367a6035fd7a2faa965022e
16b28748ea4df4d9c2150843fecfba68
16b28748ea4df4d9c2150843fecfba68
16b28748ea4df4d9c2150843fecfba68
ff6d136ddc5fdfeffaf53ff6ee95f185
25edfb22a4f469ecb59f1190150159c6
9dba6f1f949f5e07bed667bf670fd9c4
484ccb1d2c4346f112100c2685cae6995a8028ccc7a7e27417bff9f05adf593272ac96585ae54b6ae11f849d2649d9e645a2772a6b6107b401db3c9b82c049c2在线客服54bdf357c58b8a65c66d7c19c8e4d11416b28748ea4df4d9c2150843fecfba68
5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
5a8028ccc7a7e27417bff9f05adf593272ac96585ae54b6ae11f849d2649d9e6
25edfb22a4f469ecb59f1190150159c6
9dba6f1f949f5e07bed667bf670fd9c4
0a7e317b1dfce37cc8b23791d662d5dd5a8028ccc7a7e27417bff9f05adf593272ac96585ae54b6ae11f849d2649d9e645a2772a6b6107b401db3c9b82c049c21766398512654bdf357c58b8a65c66d7c19c8e4d11416b28748ea4df4d9c2150843fecfba68
5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
5a8028ccc7a7e27417bff9f05adf593272ac96585ae54b6ae11f849d2649d9e6
25edfb22a4f469ecb59f1190150159c6
9dba6f1f949f5e07bed667bf670fd9c4
dc6dce4a544fdca2df29d5ac0ea9906b5a8028ccc7a7e27417bff9f05adf593272ac96585ae54b6ae11f849d2649d9e645a2772a6b6107b401db3c9b82c049c2免责声明54bdf357c58b8a65c66d7c19c8e4d11416b28748ea4df4d9c2150843fecfba68
5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
5a8028ccc7a7e27417bff9f05adf593272ac96585ae54b6ae11f849d2649d9e6
25edfb22a4f469ecb59f1190150159c6
9dba6f1f949f5e07bed667bf670fd9c4
86195a7140dcfa1b76cbb04b9b0239eb076402276aae5dbec7f672f8f4e5cc81 关注微信 " data-html="true">5a8028ccc7a7e27417bff9f05adf593272ac96585ae54b6ae11f849d2649d9e616b28748ea4df4d9c2150843fecfba68
5db79b134e9f6b82c0b36e0489ee08ed
bed06894275b65c1ab86501b08a632eb
929d1f5ca49e04fdcb27f9465b944689
16b28748ea4df4d9c2150843fecfba68
36cc49f0c466276486e50c850b7e4956
73a6ac4ed44ffec12cee46588e518a5e
Backend code: public/login.php
6f813dd33230812ecea7ca1e099ce1faquery($sql);
if($result->num_rows>0){
$row=$result->fetch_assoc();//Get an array from the result set
echo json_encode( $row);//Convert to json format
session_start();
$_SESSION['name']=$user;
echo "85892338dea33e2daa35f4b67e3bcc9b
window.location.href='//m.sbmmt.com/m/faq/../index.php?user=' $user;
2cacc6d41bbb37262a98f745aa00fbf0";
}
else{
echo "7c6ecc2a75ade4ffa1f50134f6be3b0e
alert('Account password is incorrect' );
window.location.href='//m.sbmmt.com/m/faq/../login.php';
2cacc6d41bbb37262a98f745aa00fbf0";
}
$ result->free_result();
$conn->close();
?>
This code will take out the data if the login is successful. Failure will result in an incorrect account and password
Sever.php:
3fe7a3065578aa0f76a0873ac822ed57connect_error){
die(" Connection failed: ".$conn->connect_error);
}
//echo "Connection successful";
?>
This The code segment is the database connection code
Database creation statement
/*
Navicat MySQL Data Transfer
Source Server : stu1
Source Server Version : 50505
Source Host : localhost:3306
Source Database : shop_center
Target Server Type : MYSQL
Target Server Version : 50505
File Encoding : 65001
Date: 2021-04-29 18:57:52
*/
SET FOREIGN_KEY_CHECKS=0;
------------------ -----------
-- Table structure for `dingdan`
------------------ -----------
DROP TABLE IF EXISTS `dingdan`;
CREATE TABLE `dingdan` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`shopname` varchar(50) DEFAULT NULL,
`price` decimal(8,2) DEFAULT NULL,
`jieshao` varchar(50 ) DEFAULT NULL,
`img` int(11) DEFAULT NULL,
`count` int(11) DEFAULT NULL,
`sum` int(11) DEFAULT NULL,
`address` varchar(50) DEFAULT NULL,
`name` varchar(25) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
------------------------ -------
-- Records of dingdan
------------------------ ----
INSERT INTO `dingdan` VALUES ('4', 'Facial cleanser', '50.00', 'Very easy to use facial cleanser', '1', '1', null, null , '123');
-----------------------------------
-- Table structure for `gouwuche`
-- ----------------------------
DROP TABLE IF EXISTS `gouwuche`;
CREATE TABLE `gouwuche` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`shopname` varchar(25) DEFAULT NULL,
`price` decimal(8,2) DEFAULT NULL,
`jieshao` varchar(50) DEFAULT NULL,
`img` int(2) DEFAULT NULL,
`count` int(10) DEFAULT NULL,
`name` varchar(20) DEFAULT NULL,
`address` varchar( 50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of gouwuche
-- --- -----------------------
INSERT INTO `gouwuche` VALUES ('13', 'Facial Cleanser', '50.00' , 'A very useful facial cleanser', '1', '10', '123', null);
INSERT INTO `gouwuche` VALUES ('14', 'Skin care lotion', '60.00' , 'Soft skin, shiny and moisturized', '2', '3', '123', null);
INSERT INTO `gouwuche` VALUES ('15', 'Huawei mobile phone', '5000.00' , 'High quality, curved screen, fast refresh, no lag', '7', '2', '123', null);
-- ----- -----------------------
-- Table structure for `shop`
-- ----- -----------------------
DROP TABLE IF EXISTS `shop`;
CREATE TABLE `shop` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`shopname` varchar(25) DEFAULT NULL,
`price` decimal(8,2) DEFAULT NULL,
`jieshao` varchar(50) DEFAULT NULL,
`img` int(2) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
----------------------- ---
-- Records of shop
--------------------------------
INSERT INTO `shop` VALUES ('1', 'Facial cleanser', '50.00', 'Very easy to use facial cleanser', '1');
INSERT INTO `shop ` VALUES ('2', 'skin lotion', '60.00', 'soft skin, radiant and moisturizing', '2');
INSERT INTO `shop` VALUES ('3', 'headphones' , '50.00', 'Bluetooth headset, long standby', '3');
INSERT INTO `shop` VALUES ('4', 'High-quality headset', '100.00', 'Clear sound quality, High-quality lossless sound quality', '4');
INSERT INTO `shop` VALUES ('5', 'Slippers', '20.00', 'Durable and very comfortable', '5');
INSERT INTO `shop` VALUES ('6', 'Mobile phone', '980.00', 'Fast refresh, two minutes of charging, two hours of talk time', '6');
INSERT INTO `shop` VALUES ('7', 'Huawei mobile phone', '5000.00', 'High quality, curved screen, fast refresh, no lag', '7');
INSERT INTO `shop` VALUES ('8', 'Conditioner', '50.00', 'Moisturize the scalp, protect the hair, and make the bald head look long and flowing', '8');
INSERT INTO `shop` VALUES (' 9', 'iPhone', '5000.00', 'High quality, Apple brings you a different experience', '9');
INSERT INTO `shop` VALUES ('10', 'Luggage Box', '280.00', 'Silent wheel, strong load-bearing capacity, wear-resistant', '10');
INSERT INTO `shop` VALUES ('11', 'Toothpaste', '18.00', ' Contains tea polyphenols to whiten teeth', '11');
INSERT INTO `shop` VALUES ('12', 'Sensodyne Toothpaste', '28.00', 'Prevent tooth sensitivity and whiten teeth, Prevent gum bleeding', '12');
---------------------------- --
-- Table structure for `user`
---------------------------- --
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(25) DEFAULT NULL,
`password` varchar(25) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-------------------------------
-- Records of user
-----------------------------
INSERT INTO `user` VALUES ('1', '123', '123');
INSERT INTO `user` VALUES ('2', '', '');
INSERT INTO `user` VALUES ('3', '12121', '212');
The above is the detailed content of php implements login function. For more information, please follow other related articles on the PHP Chinese website!