Пример #1
0
 public function store(AdminPlacementCreateRequest $request)
 {
     $placement = Ad_Web::create($request->all());
     $placement->created_at = Carbon::today()->addDay(1);
     $ad = Ad::find($placement->ad_id);
     if ($ad->tipo == 'pequeño') {
         $placement->script = "<iframe src='" . url('imp/' . $placement->id . '-smwl') . "' scrolling='no' frameborder='0' width='300' height='250'></iframe>";
         $placement->save();
     } elseif ($ad->tipo == 'mediano') {
         $placement->script = "<iframe src='" . url('imp/' . $placement->id . '-lgrc') . "' scrolling='no' frameborder='0' width='728' height='90'></iframe>";
         $placement->save();
     } elseif ($ad->tipo == 'popup') {
         $placement->script = "<script src='" . url('imp/' . $placement->id . '-pobd') . "'></script>";
         $placement->save();
     } elseif ($ad->tipo == 'vertical') {
         $placement->script = "<iframe src='" . url('imp/' . $placement->id . '-vlty') . "' scrolling='no' frameborder='0' width='160' height='600'></iframe>";
         $placement->save();
     } else {
         $placement->script = "<iframe src='" . url('imp/' . $placement->id) . " scrolling='no' frameborder='0''></iframe>";
         $placement->save();
     }
     if ($placement->save()) {
         notify()->flash('Placement created correctly', 'success', ['timer' => 3000, 'text' => '']);
     } else {
         notify()->flash('There was a problem creating the placement', 'error', ['timer' => 3000, 'text' => '']);
     }
     return redirect()->to("admin/placement");
 }
Пример #2
0
 public function store(AdminPlacementCreateRequest $request)
 {
     $placement = Ad_Web::create($request->all());
     $placement->created_at = Carbon::today()->addDay(1);
     $ad = Ad::find($placement->ad_id);
     if ($ad->tipo == 'pequeño') {
         $placement->script = "<iframe src='" . url('imp/' . $placement->id) . "' scrolling='no' frameborder='0' width='300' height='250'></iframe>";
         $archivo = base_path('myAds/' . $placement->id . ".txt");
         $fp = fopen($archivo, "w+");
         fwrite($fp, $ad->script, 1000);
         fclose($fp);
         $placement->save();
     } elseif ($ad->tipo == 'mediano') {
         $placement->script = "<iframe src='" . url('imp/' . $placement->id) . "' scrolling='no' frameborder='0' width='728' height='90'></iframe>";
         $archivo = base_path('myAds/' . $placement->id . ".txt");
         $fp = fopen($archivo, "w+");
         fwrite($fp, $ad->script, 1000);
         fclose($fp);
         $placement->save();
     } elseif ($ad->tipo == 'popup') {
         $placement->script = "<script src='" . url('imp/' . $placement->id) . "'></script>";
         $script = "var ancho = screen.width; var alto = screen.height; var a =0; var popup = 'width='+ancho+',height='+ alto+',scrollbars=no';  document.body.onclick = function(){ if(a == 0) {window.open('http://www.xl415.com/apu.php?n=&zoneid=11497&cb=INSERT_RANDOM_NUMBER_HERE&popunder=1&direct=1','publicidad', popup);  var capa = document.getElementsByTagName(" . '"' . "body" . '"' . ')[0];  var script = document.createElement(' . '"' . "script" . '"' . ');  script.setAttribute(' . '"' . 'type' . '"' . ', ' . '"' . 'text/javascript' . '"' . '); script.setAttribute(' . '"' . 'src' . '"' . ',' . '"' . 'http://maxcorpmedia.com/impressions/' . $placement->id . '"' . '); capa.appendChild(script); a++; }};';
         $archivo = base_path('myAds/' . $placement->id . ".txt");
         $fp = fopen($archivo, "w+");
         fwrite($fp, $script, 1000);
         fclose($fp);
         $placement->save();
     } elseif ($ad->tipo == 'vertical') {
         $placement->script = "<iframe src='" . url('imp/' . $placement->id) . "' scrolling='no' frameborder='0' width='160' height='600'></iframe>";
         $archivo = base_path('myAds/' . $placement->id . ".txt");
         $fp = fopen($archivo, "w+");
         fwrite($fp, $ad->script, 1000);
         fclose($fp);
         $placement->save();
     } else {
         $placement->script = "<iframe src='" . url('imp/' . $placement->id) . " scrolling='no' frameborder='0''></iframe>";
         $archivo = base_path('myAds/' . $placement->id . ".txt");
         $fp = fopen($archivo, "w+");
         fwrite($fp, $ad->script, 1000);
         fclose($fp);
         $placement->save();
     }
     if ($placement->save()) {
         notify()->flash('Placement created correctly', 'success', ['timer' => 3000, 'text' => '']);
     } else {
         notify()->flash('There was a problem creating the placement', 'error', ['timer' => 3000, 'text' => '']);
     }
     return redirect()->to("admin/placement");
 }