retrieve link url from database rather than request url
increases robustness and solve issues with sloppy redirect interpretation across browsers
This commit is contained in:
parent
661813b349
commit
697ed3ce19
|
@ -183,7 +183,6 @@ class UserController extends Controller
|
|||
public function clickNumber(request $request)
|
||||
{
|
||||
$link = $request->link;
|
||||
$query = $request->query();
|
||||
$linkId = $request->id;
|
||||
|
||||
if(empty($link && $linkId))
|
||||
|
@ -191,13 +190,8 @@ class UserController extends Controller
|
|||
return abort(404);
|
||||
}
|
||||
|
||||
if(!empty($query)) {
|
||||
$qs = [];
|
||||
foreach($query as $qk => $qv) { $qs[] = $qk .'='. $qv; }
|
||||
$link = $link .'?'. implode('&', $qs);
|
||||
}
|
||||
|
||||
Link::where('id', $linkId)->increment('click_number', 1);
|
||||
$link = Link::select('link')->where('id', $linkId)->get()[0]['link'];
|
||||
|
||||
return redirect()->away($link);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue