PHP图片分享系统 Linger

毕业设计主页

最近的几个问题:
1:配置文件没找到和IIS 500的错误在于程序的sys/core目录是独立出来的,引用的另一个项目。具体参考https://github.com/loveyu/php-framework-module,将该目录放到sys/core下面即可。
2:找不到/install.php文件,这个是因为你的根目录不是绑定在web目录下面,而是在web的上一级,应该可以通过web/install.php的形式访问。

  感觉是时候发出来了,毕竟留在手上也没法用,倒不如分享出去,让大家一起玩玩。这是之前的毕业设计做的一个分享网站,弄了很长时间,结果答辩的时候不了了之,怎么说呢,感觉意义不大,要是各位有兴趣可以去https://demo.loveyu.net/Linger/注册一个玩玩,总之功能在那里。同样,这次提供Github的下载,想看看的可以飞奔过去,也希望各位一起参与到其中来吧。

安装步骤

第一步下载源码解压

cd config
mv all-simple.php all.php
vim all.php //配置正确的数据库连接信息
访问 http://xxx.xxx/install.php 进行安装

安装后会创建一个管理员账户,用该账户登录可访问后台,然后进行详细的配置。

网站配置

由于完全依赖于伪静态,所以必须对文件进行重定向。

nginx配置

location / {
    if (!-f $request_filename){
        rewrite (.*) /index.php;
    }
}
# 重定向404页面,防止静态资源404无法获取
error_page 404 /index.php;

Apache 配置

RewriteEngine On
RewriteBase /

#不存在的文件直接重定向
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php [L]

  同时,对于Apache也可以使用PATH_INFO的形式,如 index.php/Home .

  系统默认将Web配置目录放到web文件夹下,其他对应的文件sys,app,install等文件均在web目录的上级目录,
这是为了安全性的考虑,如果有需要将文件调整到一个目录,可具体参考sys/config.php文件调整目录结构,并调整index.php文件的具体参数。同时如果未安装系统,同时可能需要修改install.php中的文件参数。

275条评论在“PHP图片分享系统 Linger”

  1. 这个系统,有拦截功能吗,为什么我的用户名不是adm开头的访问不到个人主页,提示页面不存在。

  2. 大神,这个$user = lib()->using(‘login_user’); 这个login_user这个类我怎么找不到呀。找了一下午了

  3. 请教恋羽,如何批量导入用户呢?直接数据库sql添加行不行?现在的用户中心无法直接批量导入?只能手动添加。

      1. 看到github上面的自动化工具了,有自动创建图集的。没找到批量导入用户的,需要自己模仿写一个是吧?

  4. 请问这个问题怎么解决?
    Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in /home/ftp/1520/ss-20130531-YcP/ss.ebsy.cc/web/index.php on line 8

    Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in /home/ftp/1520/ss-20130531-YcP/ss.ebsy.cc/web/index.php on line 8

    Parse error: syntax error, unexpected T_STRING in /home/ftp/1520/ss-20130531-YcP/ss.ebsy.cc/web/index.php on line 8

  5. 到这一步点击没反应,大神求解
    第二步,数据库导入

    下列操作会对数据库进行更改,将导致原有数据库完全被删除且无法恢复,做好心理准备!

    开始导入系统表结构

  6. 今天无法登录系统了,提示undefined:

    重启Apache好了,请问大约是哪方面的问题?

    1. 这个错误你把DEBUG模式关掉即可,不过依旧会无法登陆。如果是$_POST未定义应该是服务器的问题了

  7. 今天无法登录系统了,提示undefined:

    E_NOTICE: Undefined variable: _POST in D:\xampp\htdocs\linger\sys\core\request.php on line 144

    E_NOTICE: Undefined variable: _POST in D:\xampp\htdocs\linger\sys\core\request.php on line 144

    E_NOTICE: Undefined variable: _POST in D:\xampp\htdocs\linger\sys\core\request.php on line 144

    E_NOTICE: Undefined variable: _POST in D:\xampp\htdocs\linger\sys\core\request.php on line 144
    {“status”:false,”code”:-10,”msg”:”登录提交的参数错误”,”content”:null}

  8. 恋羽,非常感谢,增加了一个参数后,上传的目录和文件名对了。只有一个地方,log会记录错误,但上传无误。请看看要紧吗?

    [2016-06-22 08:59:32] http://127.0.0.1/linger/web/UserApi/picture_upload; ERR: Array
    (
    [path] => 2016/06/administrator-5769e2f4153dc.jpg
    [server_meta] => Array
    (
    [server_root_path] => D:\xampp\htdocs\Linger\web\images/
    [_Lib] => Local
    )

    [rt] => Array
    (
    [pic_hd_path] => 2016/06/administrator-5769e2f4153dc.jpg
    [pic_display_path] => 2016/06/administrator-5769e2f4153dc.jpg
    )

    [root] => D:\xampp\htdocs\Linger\web\images/
    [img_path] => D:\xampp\htdocs\Linger\web\images//2016/06/administrator-5769e2f4153dc.jpg
    [img] => CLib\Image Object
    (
    [img:CLib\Image:private] => CLib\Image\Gd Object
    (
    [img:CLib\Image\Gd:private] => Resource id #59
    [gif:CLib\Image\Gd:private] =>
    [info:CLib\Image\Gd:private] => Array
    (
    [width] => 800
    [height] => 600
    [type] => jpeg
    [mime] => image/jpeg
    )

    )

    )

    [img_w] => 800
    [img_h] => 600
    [x] => 1.3333333333333
    [c_w] => 400
    [c_h] => 300
    [x_w] => 800
    [x_h] => 600
    )

    [2016-06-22 08:59:32] http://127.0.0.1/linger/web/UserApi/picture_upload; ERR: Array
    (
    [path] => 2016/06/administrator-5769e2f4153dc.jpg
    [server_meta] => Array
    (
    [server_root_path] => D:\xampp\htdocs\Linger\web\images/
    [_Lib] => Local
    )

    [rt] => Array
    (
    [pic_hd_path] => 2016/06/administrator-5769e2f4153dc.jpg
    [pic_display_path] => 2016/06/administrator-5769e2f4153dc.jpg
    )

    [root] => D:\xampp\htdocs\Linger\web\images/
    [img_path] => D:\xampp\htdocs\Linger\web\images//2016/06/administrator-5769e2f4153dc.jpg
    [img] => CLib\Image Object
    (
    [img:CLib\Image:private] => CLib\Image\Gd Object
    (
    [img:CLib\Image\Gd:private] => Resource id #61
    [gif:CLib\Image\Gd:private] =>
    [info:CLib\Image\Gd:private] => Array
    (
    [width] => 800
    [height] => 600
    [type] => jpeg
    [mime] => image/jpeg
    )

    )

    )

    [img_w] => 800
    [img_h] => 600
    [x] => 1.3333333333333
    [c_w] => 400
    [c_h] => 300
    [x_w] => 800
    [x_h] => 600
    )

  9. 我可能不小心改错了,请问这个统计的功能在哪个文件的?

    [2016-06-21 14:39:27] http://127.0.0.1/linger/web/Photo; SQL: 获取用户统计信息出错USER ID:1
    ERROR:Array
    (
        [write] => Array
            (
                [0] => 00000
                [1] =>
                [2] =>
            )

        [read] => Array
            (
                [0] => 00000
                [1] =>
                [2] =>
            )

    )
    SQL:Array
    (
        [write] => SELECT `picture_count`, `gallery_count`, `comment_count`, `user_follow_count`, `user_fans_count`, `like_gallery_count`, `like_picture_count`, `like_comment_count`, `follow_gallery_count`, `unread_message_count` FROM `user_count` WHERE `users_id` = '1' LIMIT 1
        [read] => SELECT `picture_count`, `gallery_count`, `comment_count`, `user_follow_count`, `user_fans_count`, `like_gallery_count`, `like_picture_count`, `like_comment_count`, `follow_gallery_count`, `unread_message_count` FROM `user_count` WHERE `users_id` = '1' LIMIT 1
    )
  10. 真的很好用,但是上传后的路径和文件名在什么地方设置的?现在的文件名似乎是跟日期有关系?我想改成上传后的文件名是:用户名+现在的文件名,如何修改呢?另外,如果我想把存储的路径也改成按照用户id来存储,具体修改哪里才行呢?这个系统太高大上,找了好多地方都不对。比如upload里面?还是picture里面,还是add_pic2里面?谢谢!

      1. 非常感谢,看了一天也没有找到,原来网站的1.4版本跟github上面的这个文件不一样:(

          1. 我把picture.php这里的改了:
            ‘sub_path’ => [
            function (){
            return date(“Y/md/”) . substr(md5(time() . rand(0, 9999)), 0, 2);
            }
            改成了

            ‘sub_path’ => [
            function (){
            return $user->getAliases();
            }

            结果没有反应。不知道这样修改保存上传图片是否对?

            不好意思

      2. 这里似乎只是修改’sub_path’ ,请问修改文件名的地方没有看到?

          1. 能否明示一下,我想在文件名之前加上用户的id或者用户别名,直接看这个upload 类,不知道怎么调用$user->getid()这种,太愚笨 :nonono: 感觉能否在类里面操作呢?还是要在调用类(实例化)的时候操作?

            1. 可以参考下面的进行实例化

              
              
              <?php
              $upload = new Upload([
                  //....
                  'name_callback' =>[
                      function() use($user){
                          return $user->getId()."-".uniqid();
                      }
                  ]
              ]);
              1. 非常感谢!我太菜了。刚才还在想怎么凭空能找到$user,use一下就行。

              2. 照着上面改了以后提示:

                E_NOTICE: Undefined offset: 1 in D:\xampp\htdocs\linger\sys\core\lib\upload.php on line 283

                E_NOTICE: Undefined offset: 1 in D:\xampp\htdocs\linger\sys\core\lib\upload.php on line 283

                E_WARNING: imagecreatefromstring(): Empty string or invalid image in D:\xampp\htdocs\linger\sys\core\lib\image\Gd.php on line 82
                {“status”:false,”code”:0,”msg”:”未指定图像资源”,”content”:null}

                1. 这个问题是,少写了一个参数导致的,抱歉。

                  'name_callback' =>[
                      function() use($user){
                          return $user->getId()."-".uniqid();
                      },
                      ''
                  ]

                  我使用这样的规则可以创建,1-576970f44d0c5.png这样的名称,你的这个错误有点奇怪。

                  建议你直接下载github上的dev的源码进行安装下。可能修复了部分问题相对于1.4

          2. 这个系统看的眼花缭乱,不知道自学几年才能达到这种功力,感觉今生无望了。只知道简单的php语法,涉及到类、路由什么的都晕了

  11. DNS还没生效也是醉了。。。我要再换回ip加端口~继续找bug去 :wangxiang:肯定还有哇哈哈哈哈哈哈哈

  12. 我从下午四点搞到现在。。。从apache2换到nginx,就是不能登录系统,点完登录还让登录,是不是cookies有问题啊。快哭了

    1. 还有,这个问题应该是出现在PHP5.4以上的版本,你需要更新最新的/sys/core/目录下面的文件。https://github.com/loveyu/php-framework-module/tree/master

        1. 看了下,登录返回空白。应该是代码执行出错了。你看看错误记录看有没有信息。同时开启Debug模式看看

          1. 
            
            [2015-11-30 22:23:02] http://133.130.96.152:801/; ERR: [E_WARNING]:array_keys() expects parameter 1 to be array, boolean given;/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:02] http://133.130.96.152:801/; ERR: [E_WARNING]:Invalid argument supplied for foreach();/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:02] http://133.130.96.152:801/; ERR: [E_WARNING]:Invalid argument supplied for foreach();/var/www/html/linger/app/view/Show/home.php:70
            [2015-11-30 22:23:03] http://133.130.96.152:801/style/home.js?_v=20150724; ERR: [E_WARNING]:array_keys() expects parameter 1 to be array, boolean given;/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:03] http://133.130.96.152:801/style/home.js?_v=20150724; ERR: [E_WARNING]:Invalid argument supplied for foreach();/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:03] http://133.130.96.152:801/style/style.css?_v=20150724; ERR: [E_WARNING]:array_keys() expects parameter 1 to be array, boolean given;/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:03] http://133.130.96.152:801/style/style.css?_v=20150724; ERR: [E_WARNING]:Invalid argument supplied for foreach();/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:03] http://133.130.96.152:801/style/skin/skin_01.jpg?_v=20150724; ERR: [E_WARNING]:array_keys() expects parameter 1 to be array, boolean given;/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:03] http://133.130.96.152:801/style/skin/skin_01.jpg?_v=20150724; ERR: [E_WARNING]:Invalid argument supplied for foreach();/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:17] http://133.130.96.152:801/install; ERR: [E_WARNING]:array_keys() expects parameter 1 to be array, boolean given;/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:17] http://133.130.96.152:801/install; ERR: [E_WARNING]:Invalid argument supplied for foreach();/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:17] http://133.130.96.152:801/style/style.css?_v=20150724; ERR: [E_WARNING]:array_keys() expects parameter 1 to be array, boolean given;/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:17] http://133.130.96.152:801/style/style.css?_v=20150724; ERR: [E_WARNING]:Invalid argument supplied for foreach();/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:17] http://133.130.96.152:801/style/home.js?_v=20150724; ERR: [E_WARNING]:array_keys() expects parameter 1 to be array, boolean given;/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:17] http://133.130.96.152:801/style/home.js?_v=20150724; ERR: [E_WARNING]:Invalid argument supplied for foreach();/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:17] http://133.130.96.152:801/style/skin/skin_01.jpg?_v=20150724; ERR: [E_WARNING]:array_keys() expects parameter 1 to be array, boolean given;/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:17] http://133.130.96.152:801/style/skin/skin_01.jpg?_v=20150724; ERR: [E_WARNING]:Invalid argument supplied for foreach();/var/www/html/linger/app/lib/Router.php:24
            [2015-11-30 22:23:44] http://133.130.96.152:801/install.php?setup=setting; NOTICE: Mail send is cancel.Array
            (
                [0] =&gt; szzszz
                [1] =&gt; zheng6686@live.com
            )

            [2015-11-30 22:25:32] http://133.130.96.152:801/UserApi/register; NOTICE: User register success exception notice
            [2015-11-30 22:33:09] http://133.130.96.152:801/install.php?setup=setting; NOTICE: Mail send is cancel.Array
            (
                [0] =&gt; szzszz
                [1] =&gt; zheng6686@live.com
            )

            [2015-11-30 23:01:29] http://133.130.96.152:801/UserApi/register; NOTICE: User register success exception notice

            ++++++++++++++++++++++++++++++++++++++++++++++++++++
            上面是log,debug怎么直接开。

                1. 直接访问 http://133.130.96.152:801/UserApi/login 会看到输出
                  Parse error: syntax error, unexpected ‘private’ (T_PRIVATE) in /var/www/html/linger/app/lib/Router.php on line 39
                  这个应该就是原因了

                2. Parse error: syntax error, unexpected ‘private’ (T_PRIVATE) in /var/www/html/linger/app/lib/Router.php on line 39
                  我操。。在我把它改成public并访问了一下后,服务器炸了。。。

                3. 建议你 复制 https://raw.githubusercontent.com/loveyu/Linger/c780c010f2bca7563b6c9b8c2a9454354a1f8dbb/app/lib/Router.php 这个文件全部内容过去吧,可能改出问题了,不是public和private的问题

              1. core是https://github.com/loveyu/php-framework-module/tree/master
                app/lib/router.php是刚才你给的,还是不能登录

                1. sys/core/lib/cookie.php
                  这个文件的 domain , 你那边返回的是LC_LoginFlag=UGsCNVA2VWEGLQFiAjRRKQ45Uj4%3D; path=/; domain=133.130.96.152:801; httponly 你试着强制一下这个参数,应该是可以的

                2. 确定是端口问题了,我换成了80,去数据库里改了一下site_url和site_static_url后可以工作了。明天的改的DNS name server应该就能起效了,到时候用三级域名就不用换端口了。不过这怎也着也算是个小bug,还是修复一下吧。麻烦你了~

  13. 崩溃的边缘了,好不容易安装成功了,结果发生了前面那位同样的错误,多了一个home路径!! 你可以看下:tp.bjjcmy.com 点击登陆跳转的路径是http://tp.bjjcmy.com/Home/login 把Home手动去掉也是打不开。。。lnmp的环境,也更改了conf

      1. 已经修改过了。。。有空帮忙看下是哪里不对吗?

        
        
        server
        {
                listen 80; #listen end
                server_name tp.bjjcmy.com; #server_name end
                index index.html index.htm index.php; #index end

                set $subdomain '';
                root  /home/wwwroot/lnmp2/domain/img/web$subdomain;
                include /home/wwwroot/lnmp2/rewrite/amh.conf; #rewrite end

                location / {
                if (!-f $request_filename){
                        rewrite (.*) /index.php;
                      }
                   }
                error_page 404 /index.php;


                location ~ .*\.php$
                {
                        fastcgi_pass  unix:/tmp/php-cgi-lnmp2-img.sock;
                        fastcgi_index index.php;
                        include fcgi.conf;
                        fastcgi_param DOCUMENT_ROOT  /home/wwwroot/lnmp2/domain/img/web$subdomain;
                        fastcgi_param SCRIPT_FILENAME  /home/wwwroot/lnmp2/domain/img/web$subdomain$fastcgi_script_name;
                }

                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp3|wma)$
                {
                        expires      30d;
                }

                location ~ .*\.(js|css)$
                {
                        expires      12h;
                }
                access_log off; #access_log end
                error_log /dev/null; #error_log end
        }

回复 日志里面总是提示统计错误,无法显示传了几个图片   取消