首页文件 index.html
产品进销存管理系统 |
|
|
欢迎光临进销存管理系统! |
产品进销存管理系统 |
|
|
$conn=mysql教程_connect("localhost","phpdb","phpdb")
or die("不能连接数据库服务器: ".mysql_error());
mysql_select_db("product",$conn) or die ("不能选择数据库: ".mysql_error());
?>
数据库结构:
product.sql
drop database if exists product;
create database product;
use product;
CREATE TABLE user (
id int(3) NOT NULL auto_increment,
name varchar(20) not null,
password varchar(50) NOT NULL,
tel varchar(20),
regtime datetime not null,
PRIMARY KEY (id)
);
CREATE TABLE company (
id int(6) not null auto_increment,
name varchar(100) NOT NULL,
address varchar(255) NOT NULL,
tel varchar(100) NOT NULL,
product varchar(255),
linkman varchar(100) NOT NULL,
addtime datetime NOT NULL,
PRIMARY KEY (id)
);
create table product (
productid int(6) not null auto_increment,
companyid int(6) not null,
name varchar(50) not null,
brand varchar(50) not null,
type varchar(50) not null,
introduction text,
other text,
primary key (productid)
);
CREATE TABLE buylog(
id int(6) NOT NULL auto_increment,
user varchar(20) not null,
productid int(6) not null,
amount int(6) not null,
buyprice decimal(9,2) DEFAULT '0.00' NOT NULL,
cost decimal(9,2) DEFAULT '0.00' NOT NULL,
ip varchar(20),
buytime datetime NOT NULL,
other text,
primary KEY (id)
);
create table stock (
productid int(6) not null,
amount int(6) not null,
buyprice decimal(9,2) DEFAULT '0.00' NOT NULL,
sellprice decimal(9,2) DEFAULT '0.00' NOT NULL,
cost decimal(9,2) DEFAULT '0.00' NOT NULL,
introduction text,
buytime datetime not null,
other text,
primary key(productid, buyprice)
);
CREATE TABLE selllog(
id int(10) NOT NULL auto_increment,
user varchar(20) not null,
productid int(6) not null,
amount int(6) not null,
buyprice decimal(9,2) DEFAULT '0.00' NOT NULL,
sellprice decimal(9,2) DEFAULT '0.00' NOT NULL,
cost decimal(9,2) DEFAULT '0.00' NOT NULL,
sellmoney decimal(9,2) DEFAULT '0.00' NOT NULL,
ip varchar(20),
buytime datetime NOT NULL,
selltime datetime not null,
other text,
primary KEY (id)
);
下面我们从用户注册开始。打开index.html文件,点击注册,
注册reg.php
include("head.php");
?>
}
regok.php把数据保存到mysql数据库
//初始化session
session_cache_expire(30);
session_start();
// 包含数据库连接文件和头文件
require ('dbconnect.php');
include ('head.php');
?>
// 取得网页的参数
$name=$_POST['name'];
$password=$_POST['password'];
$tel=$_POST['tel'];
// 加密密码
$password=md5($password);
// 取得当前时间和日前
$now = date("Y-m-d H:i:s");
// 连接数据库,注册用户
$sql="insert into user(name,password, tel, regtime) values('$name','$password','$tel','$now')";
mysql_query($sql,$conn) or die ("注册用户失败: ".mysql_error());
// 获得注册用户的自动id,以后使用此id才可登录
$result=mysql_query("select last_insert_id()",$conn);
$re_arr=mysql_fetch_array($result);
$id=$re_arr[0];
// 注册成功,自动登录,注册session变量
session_register("user");
$user=$id;
echo "
| 注册成功! |
| 您的注册id是:".$id; echo ",请您记住,以后用此id登录! |
?>
好了用户注册成功了,我们就用刚才注册的用户名adsense,www.111com.net登陆吧。
登录login.php页面代码
//初始化session
session_cache_expire(30);
session_start();
// $_SESSION['UserName'] 不能用$UserName变量代替
if(isset($_SESSION['user'])) {
//重定向到查看存货
header("Location:browse.php");
// 登录过的话,立即结束
exit;
}
include ('head.php');
?>
恭喜您!!
登记完成!
//初始化session
session_cache_expire(30);
session_start();
// 如果没有登录,退出
if(!isset($_SESSION['user'])) {
echo "
";
echo "";
echo "您还没有登录,请!";
echo "
恭喜您!!
登记完成!
//初始化session
session_cache_expire(30);
session_start();
// 如果没有登录,退出
if(!isset($_SESSION['user'])) {
echo "
";
echo "";
echo "您还没有登录,请!";
echo "
?>
购买成功!
当然货好了,我们要出售货品了,就会出出售页面.
销售sell.php
//初始化session
session_cache_expire(30);
session_start();
// 如果没有登录,退出
if(!isset($_SESSION['user'])) {
echo "
";
echo "";
echo "您还没有登录,请!";
echo "
长途巴士模拟器手机版
长途巴士模拟器汉化版是一款十分比真好玩的大巴车模拟驾驶运营类
房东模拟器最新版2024
房东模拟器中文版是一个超级有趣的模拟经营类型的手游,这个游戏
原神祈愿模拟器最新版
原神祈愿模拟器手机版是一款完整汉化的趣味原神抽卡模拟小游戏,
宝宝森林美食完整版
宝宝森林美食游戏最新版是一款十分有趣的休闲益智游戏,帮助宝宝
g沙盒仇恨官方英文版(gorebox)
G沙盒仇恨英文原版是一款最近非常火热的沙盒模拟类游戏,在这里