2 Star 2 Fork 0

鉛華 / Statistics Ver1.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.php 4.05 KB
一键复制 编辑 原始数据 按行查看 历史
鉛華 提交于 2018-08-01 21:22 . Upload usermanage.php index.php
<?php
include 'system/config.php';
include 'system/mysql.php';
if(!file_exists('system/install.lock')){
Mysql::query('CREATE TABLE `user` ( `user_id` INT(4) NOT NULL , `user_name` VARCHAR(16) NOT NULL , `user_email` VARCHAR(100) NOT NULL , `user_pass` VARCHAR(32) NOT NULL , `user_cookie` VARCHAR(64) , `user_reg_time` DATETIME NOT NULL , `user_reg_ip` VARCHAR(15) NOT NULL , `user_login_time` DATETIME , `user_login_ip` VARCHAR(15) , PRIMARY KEY (`user_id`), UNIQUE (`user_name`), UNIQUE (`user_email`), UNIQUE (`user_cookie`)) ENGINE = MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;');
Mysql::query('CREATE TABLE `site` ( `site_id` VARCHAR(32) NOT NULL , `user_id` INT(4) NOT NULL , `site_name` VARCHAR(16) NOT NULL , `site_pass` VARCHAR(32) , `site_kind` VARCHAR(4) NOT NULL , `site_icon_default` INT(1) NOT NULL , `site_icon_custom` TEXT , `site_ip` INT , `site_pv` INT , PRIMARY KEY (`site_id`)) ENGINE = MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;');
Mysql::query('CREATE TABLE `ip` ( `site_id` VARCHAR(32) NOT NULL , `ip_ip` VARCHAR(15) NOT NULL , `ip_timestamp` TEXT NOT NULL , `ip_datetime` DATETIME NOT NULL , `ip_ua` TEXT ) ENGINE = MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;');
Mysql::query('CREATE TABLE `pv` ( `site_id` VARCHAR(32) NOT NULL , `pv_ip` VARCHAR(15) NOT NULL , `pv_timestamp` TEXT NOT NULL , `pv_datetime` DATETIME NOT NULL , `pv_browser` VARCHAR(32) , `pv_client` VARCHAR(32) , `pv_source` TEXT ) ENGINE = MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;');
file_put_contents('system/install.lock','installed');
header('location:/');
}else{
if(!empty($_COOKIE[md5($siteKey)]) && Mysql::getAllRows('select * from user where user_cookie=\''.$_COOKIE[md5($siteKey)].'\'')){
//首页页面
$user=Mysql::getAllRows('select * from user where user_cookie=\''.$_COOKIE[md5($siteKey)].'\'');
include 'include/index.php';
echo $head;
echo $center;
echo $foot;
}else{
if(!empty($_GET['locate']) && $_GET['locate']=='reg'){
//注册页面
include 'include/reg.php';
if(!empty($_POST['username']) && !empty($_POST['password']) && !empty($_POST['email'])){
$username=$_POST['username'];
$password=md5($_POST['password']);
$email=$_POST['email'];
$urow=Mysql::getAllRows('select * from user where user_name=\''.$username.'\'');
$erow=Mysql::getAllRows('select * from user where user_email=\''.$email.'\'');
if(!$urow && !$erow){
$user_id_get=Mysql::getAllRows('select count(*) from user');
$user_id=$user_id_get[0]['count(*)']+1000;
$user_name=$username;
$user_email=$email;
$user_pass=$password;
$user_reg_time=date('Y-m-d H:i:s');
$user_reg_ip=$_SERVER['REMOTE_ADDR'];
Mysql::query('insert into user (user_id,user_name,user_email,user_pass,user_reg_time,user_reg_ip) values (\''.$user_id.'\',\''.$user_name.'\',\''.$user_email.'\',\''.$user_pass.'\',\''.$user_reg_time.'\',\''.$user_reg_ip.'\')');
echo $head;
echo $alert2;
echo $foot;
header('refresh:3;url=/?locate=login');
}else{
echo $head;
echo $alert;
echo $form;
echo $foot;
}
}else if(!empty($_POST['username']) || !empty($_POST['password']) || !empty($_POST['email'])){
echo $head;
echo $alert1;
echo $form;
echo $foot;
}else{
echo $head;
echo $form;
echo $foot;
}
}else{
//登录界面
include 'include/login.php';
if(!empty($_POST['username']) && !empty($_POST['password'])){
$username=$_POST['username'];
$password=$_POST['password'];
$row=Mysql::getAllRows('select user_pass from user where user_name=\''.$username.'\'');
if($row[0]['user_pass']==md5($password)){
$cookie=md5(date('Y-m-d H:i:s')).md5(mt_rand(10000,99999));
setcookie(md5($siteKey),$cookie,time()+86400);
$logintime=date('Y-m-d H:i:s');
$loginip=$_SERVER['REMOTE_ADDR'];
Mysql::query('update user set user_login_time=\''.$logintime.'\',user_login_ip=\''.$loginip.'\',user_cookie=\''.$cookie.'\' where user_name=\''.$_POST['username'].'\'');
header('location:/');}else{
echo $head;
echo $alert;
echo $form;
echo $foot;
}
}else if(!empty($_POST['username']) || !empty($_POST['password'])){
echo $head;
echo $alert;
echo $form;
echo $foot;
}else{
echo $head;
echo $form;
echo $foot;
}
}
}
}
?>
PHP
1
https://gitee.com/yloveo/Statistics-Ver1.0.git
git@gitee.com:yloveo/Statistics-Ver1.0.git
yloveo
Statistics-Ver1.0
Statistics Ver1.0
master

搜索帮助