public function showhome() { $jewels = WebShopItems::select('price')->where('belongto', 'j')->get(); $shopitems = WebShopItems::whereNotIn('belongto', array('j', 'ad'))->where('onsale', 1)->orderby('uptime', 'desc')->take(5)->get(); $online = DB::connection('MuOnline')->select('SELECT COUNT(DISTINCT AccountID) AS Count FROM ConnectionHistory WHERE Date > DATEADD(day, -1, GETDATE())'); $numchars = DB::connection('MuOnline')->select('SELECT COUNT(Name) AS Count FROM Character'); $visited = DB::connection('MuOnline')->select('SELECT COUNT(DISTINCT IP) AS Count FROM ConnectionHistory'); $data = array('page' => 'Home', 'id' => NULL, 'coin' => NULL, 'jewels' => $jewels, 'items' => $shopitems, 'numchars' => $numchars, 'visited' => $visited, 'online' => $online); return View::make('template/neon/home')->with($data); }
public function domanageshop() { $db = Session::get('db'); Config::set('database.default', $db); $iAll = Input::all(); $input = $iAll['submit']; $id = Auth::user()->memb___id; $coin = $this->getCoin($id); $submit = substr($input, 0, 1); //u->update,s->stop, t->transfer $index = (int) substr($input, 1, strlen($input)); $price = (int) $iAll['price' . $index]; $db = DB::connection($db)->getPdo(); $stmt = $db->prepare("EXEC WebGetWareItems ?"); $stmt->bindParam(1, $id); $stmt->execute(); $search = array(); do { $search = $stmt->fetchAll(PDO::FETCH_CLASS, 'stdClass'); } while ($stmt->nextRowset()); if (empty($search)) { return Redirect::to('DashBoard')->withMessage('Your warehouse was not initilized!')->withError(1); } $item = WebShopItems::find($index); $slot = ItemsInfo::freewareslot($search, $item->icode); if ($slot >= 120) { return Redirect::to('MamageShop')->withMessage('Your warehouse is full!')->withError(1); } $db = Session::get('db'); $db = DB::connection($db)->getPdo(); $stmt = $db->prepare("EXEC WebManageShop ?,?,?,?,?"); $stmt->bindParam(1, $id); $stmt->bindParam(2, $submit); $stmt->bindParam(3, $index); $stmt->bindParam(4, $slot); $stmt->bindParam(5, $price); $stmt->execute(); $search = array(); do { $search = $stmt->fetchAll(PDO::FETCH_CLASS, 'stdClass'); } while ($stmt->nextRowset()); $error = $search[0]->error; $message = $search[0]->message; return Redirect::to('ManageShop')->withMessage($message)->withError($error); }