public function getMarks($mark = 'BOTSLCA') { $ar_marks = array(); $ar_domain_id = array(); $ar_domain = array(); $organ = json_decode(INPUT::get('data')); $ar0 = DB::connection('mysql2')->table('marks')->where('mark_name', 'like', '%' . $organ . '%')->where('mark_name', 'like', '%' . $mark . '%')->select('ID')->get(); $ar0 = $this->stdToArray($ar0); foreach ($ar0 as $val) { $ar_marks[] = $val['ID']; } $ar_marks = array_unique($ar_marks); //print_r($ar_marks); $ar0 = DB::connection('mysql2')->table('marks_domains')->whereIn('mark_name_id', $ar_marks)->select('domain_name_id')->get(); $ar0 = $this->stdToArray($ar0); foreach ($ar0 as $val) { $ar_domain_id[] = $val['domain_name_id']; } $ar_domain_id = array_unique($ar_domain_id); //print_r($ar_domain_id); //return response()->json($ar_domain_id)->setStatusCode(200); $ar0 = DB::connection('mysql2')->table('domains')->whereIn('ID', $ar_domain_id)->select('domain_name')->get(); $ar0 = $this->stdToArray($ar0); foreach ($ar0 as $val) { $ar_domain[] = $val['domain_name']; } $ar_domain = array_unique($ar_domain); //print_r($ar_domain); return response()->json($ar_domain)->setStatusCode(200); }
private function StoreProposal() { $obj = DB::transaction(function ($connection) { $var = INPUT::all(); $user = Auth::user()->user(); $mod = new Proposal(); $mod1 = new Proposal(); $filename = $user['id'] . '_' . $var['title_g'] . '.'; $filename .= $var['grantProposal']->getClientOriginalExtension(); $var['grantProposal']->move(storage_path('uploads/grant_proposals'), $filename); $mod::create(['field' => $var['fieldName'], 'title' => $var['title_g'], 'team_members' => $var['teamMembers'], 'research_place' => $var['researchPlace'], 'end_date_of_proposal' => $var['duration'], 'proposed_amount' => $var['grantNeeded'], 'description' => $var['propDescription'], 'userid' => $user['id']]); $obj = new \App\proposal_version(); $mod1 = $mod::get()->last(); $obj::create(['version_number' => '1', 'version_path' => $filename, 'proposal_id' => $mod1['id']]); }); }
public function filter() { $dns = json_decode(INPUT::get('data')); foreach ($dns as $val) { $vt = new VirusTotalController(); $loc = $vt->getInfoByDnsF($val); if (empty($loc)) { continue; } foreach ($loc as $location) { $ip = $location['ip']; $lat = $location['lat']; $lon = $location['lon']; \DB::collection('mapControlling')->where('dns', $val)->insert(array('dns' => $val, 'ip' => $ip, 'coordinates' => array('lat' => $lat, 'lon' => $lon))); } } //return redirect('proverka')->setStatusCode(200); }
public function makechanges($id) { $var = INPUT::all(); $obj = new \App\proposal_comment(); $obj1 = new \App\proposal_version(); $mod = \App\Proposal::join('proposal_versions', 'proposals.id', '=', 'proposal_versions.proposal_id')->where('proposals.id', '=', $id)->orderby('proposal_versions.id', 'DESC')->select('proposal_versions.id')->first(); $obj->comments = $var['comments']; $obj->type = 1; $obj->proposal_version_id = $mod->id; $obj->save(); $obj1 = $obj1::find($mod->id); $obj1->research_status = $var['status']; $obj1->save(); /*return $mod->id; if($var['status']) { if($var['status']==0) { $obj1->research_status=0; //$obj1->save(); } if($var['status']==1) { $obj1->research_status=1; // $obj1->save(); } /* if($var['status']==2) { $obj1->research_status=2; $obj1->save(); }*/ /*if($var['status']==3) { $obj1->research_status=3; $obj1->save(); }*/ // $obj1->save(); return $this->allgrants(); //return $var['status']; }
public function getInfoByDns() { $domain = json_decode(INPUT::get('data')); $url = "http://www.virustotal.com/vtapi/v2/domain/report"; $data = array("apikey" => $this->key, "domain" => $domain); $res = $this->send($url, $data, false); $res = json_decode($res); $res = $this->stdToArray($res); $ar_ip = array(); if ($res['response_code'] != 0) { $count_detected_urls = count($res['detected_urls']); if ($count_detected_urls > 0) { $resolutions = $res['resolutions']; $resolutions = $this->stdToArray($resolutions); foreach ($resolutions as $info) { if (!empty($info['ip_address'])) { $ar_ip[] = $info['ip_address']; } } } $ar_ip = array_unique($ar_ip); sort($ar_ip); } $ar_loc = array(); foreach ($ar_ip as $ip) { $location = GeoIP::getLocation($ip); $ar_loc[] = $location; //return response()->json($location)->setStatusCode(200); } //$ar_loc=array_unique($ar_loc); return response()->json($ar_loc)->setStatusCode(200); //print_r($res); ///return response()->json($res)->setStatusCode(200); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit() { $user_id = Auth::user()->id; $data = INPUT::all(); $rules = $this->rules(); $messages = $this->messages(); $validator = Validator::make($data, $rules, $messages); if (!$validator->fails()) { $book = Book::find($data['id']); $book->title = $data['title']; $book->subtitle = $data['subtitle']; $book->publishedDate = $data['publishedDate']; $book->description = $data['description']; $book->pages = $data['pages']; $book->isbn10 = $data['isbn10']; $book->isbn13 = $data['isbn13']; $book->price_day = $data['price_day']; $book->price_bail = $data['price_bail']; $book->price_sale = $data['price_sale']; $book->language = $data['language']; if ($data['publisher'] != $book->id_publisher) { if ($data['publisher'] != '0') { $book->id_publisher = $data['publisher']; } else { $publisher = new Publisher(); $publisher->publisher = $data['newpublisher']; $publisher->save(); $book->id_publisher = $publisher->id; } } if (isset($data['cover'])) { $book->cover = file_get_contents($data['cover']); } $book_id = $book->id; Book_Collection::where('book_id', $book_id)->delete(); Author_Book::where('book_id', $book_id)->delete(); $book_collection = new Book_Collection(); $book_collection->book_id = $book_id; $book_collection->collection_id = $data['collection']; $authors = explode(',', $data['authors']); foreach ($authors as $author) { $tmp = Author::where('name', 'like', $author)->limit(1)->get(); if (count($tmp) > 0) { $author_book = new Author_Book(); $author_book->book_id = $book_id; $author_book->author_id = $tmp[0]->id; $author_book->save(); } else { $newAuthor = new Author(); $newAuthor->name = $author; $newAuthor->save(); $author_id = $newAuthor->id; $author_book = new Author_Book(); $author_book->book_id = $book_id; $author_book->author_id = $author_id; $author_book->save(); } } $book->save(); return redirect('book/edit/' . $book_id . ''); } return back()->withInput($data)->withErrors($validator); }
public function getRecords() { $tables = json_decode(INPUT::get('data')); $rec = array(); foreach ($tables as $table) { $domains = DB::table($table)->select('dns')->get(); $domains = array_map(function ($item) { return (array) $item; }, $domains); foreach ($domains as $domain) { $domain = $domain['dns']; if (preg_match('/\\d*\\.\\d*\\.\\d*\\.\\d*/', $domain) == 1) { continue; } $tmp = explode('.', $domain); $count = count($tmp); if ($count > 2) { $domain = $tmp[$count - 2] . '.' . $tmp[$count - 1]; if (preg_match('/\\D{1,}/', $domain)) { $rec[] = $domain; } } } } $rec = array_unique($rec); //return response($tables,200); return response()->json($rec)->setStatusCode(200); }
public function getIpValue() { $ip = INPUT::json()->get('ip'); $ar = DB::connection('ferma')->table('servers')->where('ip', $ip)->select('ipval')->lists('ipval'); $ip = array_pop($ar); $ip = $this->returnIP($ip); DB::connection('ferma')->table('servers')->update(array('ipval' => $ip)); return response()->json($ip)->setStatusCode(200); }