Issues (86)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

app/Http/Controllers/UserController.php (6 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace App\Http\Controllers;
4
use App\Creator;
5
use Illuminate\Foundation\Auth\User;
6
use Illuminate\Http\Request;
7
use App\Http\Requests;
8
use Illuminate\Support\Facades\Auth;
9
use Illuminate\Support\Facades\Session;
10
use Illuminate\Support\Facades\DB;
11
use Illuminate\Support\Facades\Validator;
12
13
class UserController extends Controller
14
{
15
    /**
16
     * Display a listing of the resource.
17
     *
18
     * @return \Illuminate\Http\Response
19
     */
20
    public function index()
21
    {
22
        $user = Auth::user();
23
        $creator = $user->creator;
24
        $backer = $user->backer;
25
        $zagladki = DB::select('select * from bookmarks where user_id = ?', [$user->id]);
26
        return view('user.index',compact('creator','backer','zagladki'));
27
    }
28
29
    /**
30
     * Show the form for creating a new resource.
31
     *
32
     * @return \Illuminate\Http\Response
33
     */
34
    public function create()
35
    {
36
        //
37
    }
38
39
    /**
40
     * Store a newly created resource in storage.
41
     *
42
     * @param \App\Http\Controllers\Request|Request $request
43
     * @return \Illuminate\Http\Response
44
     */
45
    public function store(Request $request)
0 ignored issues
show
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
46
    {
47
        //
48
    }
49
50
    /**
51
     * Display the specified resource.
52
     *
53
     * @param  int  $id
54
     * @return \Illuminate\Http\Response
55
     */
56
    public function show($id)
0 ignored issues
show
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
57
    {
58
59
60
    }
61
62
    /**
63
     * Show the form for editing the specified resource.
64
     *
65
     * @param  int  $id
66
     * @return \Illuminate\Http\Response
67
     */
68
    public function edit($id)
0 ignored issues
show
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
69
    {
70
        //
71
    }
72
73
    /**
74
     * Update the specified resource in storage.
75
     *
76
     * @param \App\Http\Controllers\Request|Request $request
77
     * @param  int $id
78
     * @return \Illuminate\Http\Response
79
     */
80
    public function update(Request $request, $id)
0 ignored issues
show
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
81
    {
82
        //
83
    }
84
85
    /**
86
     * Remove the specified resource from storage.
87
     *
88
     * @param  int  $id
89
     * @return \Illuminate\Http\Response
90
     */
91
    public function destroy($id)
0 ignored issues
show
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
92
    {
93
        //
94
    }
95
    public function change(Request $request){
96
        $pass = bcrypt($request['password']);
97
        dd($pass);
98
        $pw_c = Auth::user()->password;
99
        if ($pass != $pw_c){
100
            return "sorry";
101
        }
102
        return redirect('prof');
103
    }
104
105
    /**
106
     * @param \App\Http\Controllers\Request|Request $request
107
     * @param $id
108
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
109
     */
110
    public function info(Request $request,$id){
111
        $validator = Validator::make($request->all(), [
112
            'image' => 'required|max:700|mimes:jpeg,bmp,png',
113
        ]);
114
        if ($validator->fails()) {
115
            return redirect('/profile')
116
                ->withInput()
117
                ->withErrors($validator);
118
        }
119
        if ($request->hasFile('image')){
120
            $user = User::find($id);
121
            $user->name = $request['username'];
122
            $user->email = $request['email'];
123
124
            $fileType1 = $request->file('image')->getClientOriginalExtension();
125
            $fname = Auth::user()->name.$request->title;
126
            $fileName1 = $fname.'.'.$fileType1;
127
            $documentRoot = 'images/user/';
128
            $request->file('image')->move($documentRoot,$fileName1);
129
            $user->avatar = $fileName1;
130
            $user->save();
131
            Session::flash('message','Successfully updated!');
132
        }
133
134
        return redirect('profile');
135
    }
136
    public function upload()
137
    {
138
        // getting all of the post data
139
        $file = array('image' => Input::file('image'));
140
        // setting up rules
141
        $rules = array('image' => 'required',); //mimes:jpeg,bmp,png and for max size max:10000
142
        // doing the validation, passing post data, rules and the messages
143
        $validator = Validator::make($file, $rules);
144
        if ($validator->fails()) {
145
            // send back to the page with the input data and errors
146
            return Redirect::to('upload')->withInput()->withErrors($validator);
147
        } else {
148
            // checking file is valid.
149
            if (Input::file('image')->isValid()) {
150
                $destinationPath = 'uploads'; // upload path
151
                $extension = Input::file('image')->getClientOriginalExtension(); // getting image extension
152
                $fileName = rand(11111, 99999) . '.' . $extension; // renameing image
153
                Input::file('image')->move($destinationPath, $fileName); // uploading file to given path
154
                // sending back with message
155
                Session::flash('success', 'Upload successfully');
156
                return Redirect::to('upload');
157
            } else {
158
                // sending back with error message.
159
                Session::flash('error', 'uploaded file is not valid');
160
                return Redirect::to('upload');
161
            }
162
        }
163
    }
164
}
165
166