Пример #1
0
 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     if (Auth::user()->role == 'Moderator') {
         $codes = Code::all();
         return view('home')->with('codes', $codes);
     } else {
         return view('home');
     }
 }
 public function show()
 {
     $codes = Code::all();
     return view('codes', ['codes' => $codes]);
     /*foreach ($codes as $code) {
             echo $code->name . "<br>";
             $clean = $code->code;
             $clean = str_replace("<?php", "", $clean);
             $clean = str_replace("?>", "", $clean);
             echo $clean;
             eval($clean);
             echo "<hr>";
     
           }*/
 }
Пример #3
0
 protected function create()
 {
     // $adobot = User::where('id', '=', '')->first();
     //$user = App\User::find($id);
     $role = Auth::user()->role;
     if ($role == 'User') {
         $id = Auth::id();
         $input = Input::only('code');
         $test = new Code();
         if (stristr($input['code'], 'create table') !== false || stristr($input['code'], 'drop table') || stristr($input['code'], 'create database') || stristr($input['code'], 'drop database') || stristr($input['code'], 'delete') || stristr($input['code'], 'select *')) {
             echo "<script type='text/javascript' script-name='cabin-condensed' src='http://use.edgefonts.net/cabin-condensed.js'></script>";
             echo "<body  style='background-color:rgba(249,234,234,1)'>";
             echo "<h2 style ='font: normal 20px/normal 'cabin-condensed'', Helvetica, sans-serif'>Cannot execute this php code</h2>";
             echo "<br>";
             echo "<br>";
             echo "</body>";
         } else {
             $test->php_code = $input['code'];
             $test->user_id = $id;
             // $test->published_at= Carbon::now();
             $test->save();
             File::put('C:\\xampp\\htdocs\\laravel\\first-project\\resources\\views\\auth\\test.blade.php', $input['code']);
             return view('auth\\test');
         }
     } else {
         $count = 1;
         $codes = Code::all();
         echo "<body  style='background-color:rgba(249,234,234,1)'>";
         File::put('C:\\xampp\\htdocs\\laravel\\first-project\\resources\\views\\auth\\AllCodes.php', "");
         foreach ($codes as $codes) {
             echo "<h3>Code# " . $count . "</h3> ";
             highlight_string($codes->php_code);
             File::append('C:\\xampp\\htdocs\\laravel\\first-project\\resources\\views\\auth\\AllCodes.php', $codes->php_code);
             //File::append('C:\xampp\htdocs\laravel\first-project\resources\views\auth\AllCodes.php', "<br>");
             $count++;
             echo "<br>";
             echo "<br>";
         }
         echo "</body>";
         //$codes = DB::table('code')->get();
         //return view('auth\AllCodes');
     }
 }
 public function codes()
 {
     $codes = Code::all();
     return view('Pages.codes')->withCodes($codes);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $codes = Code::all();
     return view('codes', ['codes' => $codes]);
 }
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $codes = \App\Code::all();
     return view('moderator')->withCodes($codes);
 }