/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (!$this->session->has('lastActivityTime')) { $this->session->put('lastActivityTime', time()); } else { if (time() - $this->session->get('lastActivityTime') > $this->getTimeOut()) { $this->session->forget('lastActivityTime'); Auth::logout(); return redirect($this->getRedirectUrl())->with([$this->getSessionLabel() => 'You have been inactive for ' . $this->timeout / 60 . ' minutes ago.']); } } $this->session->put('lastActivityTime', time()); return $next($request); }
public function login($username = null, $password = null, $remember = false) { if (!$username && !$password && $this->exists()) { session::put($this->_sessionName, $this->data()->id); } else { $user = $this->find($username); if ($user) { if ($this->data()->password === Hash::make($password, $this->data()->salt)) { session::put($this->_sessionName, $this->data()->id); if ($remember) { $hash = Hash::unique(); $hashCheck = $this->_db->get('user_session', array('user_id', '=', $this->data()->id)); if (!$hashCheck->count()) { $this->_db->insert('user_session', array('user_id' => $this->data()->id, 'hash' => $hash)); } else { $hash = $hashCheck->first()->hash; } cookie::put($this->_cookieName, $hash, config::get('remember/cookie_expiry')); } return true; } } } return false; }
public function getGantt($id) { if (!Auth::check()) { return redirect("/"); } $memberOfBoard = Membermanagement::where('User_id', '=', Auth::user()->id)->where('Board_id', '=', $id)->get(); if (count($memberOfBoard) == 0) { return redirect("/"); } $Board = Board::all()->find($id); session::put("idForGantt", $id); $boardCards = Board::with(['members'])->find(session()->get('idForGantt')); $cards = $boardCards->cards()->with(['memberCard.member', 'comments'])->get(); return view('pages.gantt.ganttChart')->with('Board', $Board)->with('Card', $cards); }
public function showBoard($id) { if (!Auth::check()) { return redirect("/"); } if (Auth::user()->Level_id == 1) { return redirect('/managementAccount'); } $data = Board::find($id); session::put("Board", $id); //--------------------------------------- CreateSession session::put("Manager", $data->manager_id); $memberOfBoard = Membermanagement::where('User_id', '=', Auth::user()->id)->where('Board_id', '=', $data->id)->get(); if (count($memberOfBoard) == 0) { return redirect("/"); } elseif (Auth::user()->id != $data->manager_id && $data->status_complete == 1) { return redirect("/"); } return view('pages.board.board')->with('Board', $data); }
public static function generate() { return session::put(config::get('session/token_name'), md5(uniqid())); }
public function login($UserID = null, $Password = null, $remember = false) { // $user=$this->find($UserID); if (!$UserID && !$Password && $this->exists()) { session::put($this->_sessionName, $this->data()); } else { $user = $this->find($UserID); // print_r($user); // print_r($this->_data); if ($user) { if ($this->data()->Password === hash::make($Password)) { echo 'ok!'; // need to check the node_id/UserID session::put($this->_sessionName, $this->data()->node_id); if ($remember) { $hash = hash::unique(); $hashCheck = $this->_database->get('User_session', array('UserID', '=', $this->data()->node_id)); if (!$hashCheck->counts()) { $this->_database->insert('User_session', array('userID' => $this->data()->SessionID, 'Hash' => $hash)); } else { $hash = $hashCheck->first()->hash; } cookie::put($this->_cookieName, $hash, config::get('remember/cookie_expiry')); } return true; } } } return false; }
public function Step3Form() { $fileNumber = Session::get('fileNumber'); $fields = array('FirstName', 'LastName', 'Name1SSN'); $client = $this->leadtracapi->getClient($fileNumber, $fields); $ValidationRules = array('dob' => 'required|date_format:n/d/Y', 'ssn' => 'required|min:4|max:12'); $Validate = Validator::make(Input::all(), $ValidationRules); //dob // ssn $dob = Input::get('dob'); $ssn = str_replace('-', '', Input::get('ssn')); $ssn = substr($ssn, 0, 3) . '-' . substr($ssn, 3, 2) . '-' . substr($ssn, 5); // fix blank bug $ssn = str_replace('--', '', $ssn); /** * @deprecated moved address/etc to another step */ // $address1 = Input::get('address1'); // $city = Input::get('city'); // $state = strtoupper(Input::get('state')); // $zipcode = Input::get('zip'); //Lets check if they have already gave us their social, if its not correct throw an error.. otherwise we'll create it with this social. if (isset($client->TProperties->Name1SSN) && $client->TProperties->Name1SSN && $client->TProperties->Name1SSN != '--') { if (substr($client->TProperties->Name1SSN, -4) != str_replace('-', '', $ssn)) { $messages = new Illuminate\Support\MessageBag(); $messages->add('* Error ', ' the social security number you provided does not match.'); return Redirect::to('step3')->withErrors($messages); } } $updateFields = array(); if (!isset($client->TProperties->Name1SSN) || $client->TProperties->Name1SSN == "" || $client->TProperties->Name1SSN == "--") { $updateFields['Name1SSN'] = $ssn; } $updateFields['Name1DOB'] = $dob; $updateFields[$this->tracking_field_name] = $this->tracking_field_value; /** * @deprecated moved address to another step */ // $updateFields['AddressLine1'] = $address1; // $updateFields['ZipSel'] = $city .', '.$state; // $updateFields['City'] = $city; // $updateFields['State'] = $state; // $updateFields['ZipCode'] = $zipcode; if ($fileNumber) { $UpdateStatus = $this->leadtracapi->CreateOrUpdateClient($this->campaignId, $updateFields, $fileNumber); // if they didnt fail, send them here. if ($Validate->fails()) { return Redirect::to('step3')->withErrors($Validate); } if ($UpdateStatus !== false) { /** * Client completed step3. */ $clientdetails = $client; if ($clientdetails->CompletedStep == 2) { // We need to change the status to Step3s. $this->leadtracapi->ChangeClientStatus($fileNumber, $this->statusUpdates['step3']); } session::put('Step3Completed', true); //check here if they are upgrading, this will put down the defenses to order nothing. //we'll try to force the capture payments to work but idk if it will! /** * @todo finish this part for the upgrades */ //update successful. return Redirect::to('step4'); } } }
<?php use Illuminate\Support\Facades\Session; /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', function () { session::regenerate(); session::put("name", "haitham"); if (!session::has("name")) { return redirect('user/unauthenticated'); } return view('login'); }); Route::get('/users', "testcontroller@allusers"); Route::get('/employee', function () { return view('employee'); }); Route::get('test', function () { $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->createSection(); $section->addText('Hello World!'); $file = 'HelloWorld.docx'; header("Content-Description: File Transfer");
public function login($username = null, $password = null, $remember = false) { if (!$username && !$password && $this->exists()) { //if no username or password sent to function and there is a user in database, used when remeber function is active session::put($this->_sessionName, $this->data()->Id); } else { $user = $this->find($username); if ($user) { if ($this->data()->Password === hash::make($password, $this->data()->Salt)) { session::put($this->_sessionName, $this->data()->Id); if ($remember) { //if remeber option selected $hash = hash::unique(); $hashCheck = $this->_db->get('User_Sessions', array('User_Id', '=', $this->data()->Id)); //check whether user session saved on db if (!$hashCheck->counts()) { $this->_db->insert('User_Sessions', array('User_Id' => $this->data()->Id, 'Hash' => $hash)); } else { $hash = $hashCheck->first()->Hash; //if already in session db use that hash (should not happen) } cookie::put($this->_cookieName, $hash, config::get('remember/cookie_expiry')); //create login cookie } return true; } else { $this->_log->warning('Wrong password used for user: '******'Wrong username used: ' . $username); // Will be logged echo "Sorry, username not found. "; } } //end of not remember return false; }
public function Step3Form() { $fileNumber = Session::get('fileNumber'); $fields = array('FirstName', 'LastName', 'Name1SSN', 'completed_steps_bitwise'); // $client = $this->leadtracapi->getClient($fileNumber, $fields); $clientdetails = $this->GetClientFromSession(true); $client = $clientdetails; $ValidationRules = array('dob' => 'required|date_format:n/d/Y', 'ssn' => 'required|min:4|max:4'); $Validate = Validator::make(Input::all(), $ValidationRules); //dob // ssn $dob = Input::get('dob'); $ssn = str_replace('-', '', Input::get('ssn')); $ssn = substr($ssn, 0, 3) . '-' . substr($ssn, 3, 2) . '-' . substr($ssn, 5); // fix blank bug $ssn = str_replace('--', '', $ssn); /** * @deprecated moved address/etc to another step */ if (Input::get('address1')) { $address1 = Input::get('address1'); $city = Input::get('city'); $state = strtoupper(Input::get('state')); $zipcode = Input::get('zip'); } //Lets check if they have already gave us their social, if its not correct throw an error.. otherwise we'll create it with this social. if (isset($client->TProperties->Name1SSN) && $client->TProperties->Name1SSN && $client->TProperties->Name1SSN != '--') { if (substr($client->TProperties->Name1SSN, -4) != str_replace('-', '', $ssn)) { $messages = new Illuminate\Support\MessageBag(); $messages->add('* Error ', ' the social security number you provided does not match.'); return Redirect::to('step3')->withErrors($messages); } } $updateFields = array(); if (!isset($client->TProperties->Name1SSN) || $client->TProperties->Name1SSN == "" || $client->TProperties->Name1SSN == "--") { $updateFields['Name1SSN'] = $ssn; } /** * Check if the address has been submitted or altered (This will fix the bug when updating addressses from step3 and they see their address fields.) * */ if (Input::get('address1') && isset($address1) && $address1) { $updateFields['Name1SSN'] = $ssn; $updateFields['AddressLine1'] = $address1; $updateFields['ZipSel'] = $city . ', ' . $state; $updateFields['City'] = $city; $updateFields['State'] = $state; $updateFields['ZipCode'] = $zipcode; } $updateFields['Name1DOB'] = $dob; $updateFields[$this->tracking_field_name] = $this->tracking_field_value; // if they didnt fail, send them here. if ($Validate->fails()) { return Redirect::to('step3')->withErrors($Validate); } if ($fileNumber) { // if (!isset($clientdetail) || !$clientdetail) // $clientdetail = $this->leadtracapi->GetClient($fileNumber, $fields); if (!$clientdetails) { return $this->RedirectWithError('/step1', 'Sorry, unable to find your account. Perhaps your session has expired. Please click returning customer if your information is not displayed below to log in to your account.'); } if (!($clientdetails->TProperties->completed_steps_bitwise & step3)) { $updateFields['completed_steps_bitwise'] = @$clientdetails->TProperties->completed_steps_bitwise | step3; } $UpdateStatus = $this->leadtracapi->CreateOrUpdateClient($this->campaignId, $updateFields, $fileNumber); if ($UpdateStatus !== false) { if ($clientdetails->CompletedStep == 2 || $clientdetails->CompletedStep == 3) { $this->leadtracapi->ChangeClientStatus($fileNumber, $this->statusUpdates['step3']); } session::put('Step3Completed', true); //update successful. ### Redirect to the Fasfa Pin ### return Redirect::to('step4'); ## Update, redirect to select the form they want. return Redirect::to('step4services'); } } }
public function showLinen($group, $colour) { $catSlug = 'linen'; $catName = 'Linen'; $groupId = Group::where('slug', '=', $group)->first(); $colourId = Colour::where('slug', '=', $colour)->first(); $group_id = "%"; $groupSlug = '0'; if ($group !== '0') { $group_id = $groupId->id; $groupSlug = $groupId->slug; $groupName = $groupId->name; } $colour_id = "%"; $colourSlug = '0'; $colourHex = '0'; if ($colour !== '0') { $colour_id = $colourId->id; $colourSlug = $colourId->slug; $colourHex = $colourId->hex; } //Living nightmare to work out how to get this to order on the collection field. //Seems you have to use the function to joing the products anf then run the eager load $results = colour::with(['product' => function ($query) { $query->select('products.*')->join('groups', 'group_id', '=', 'groups.id')->orderBy('groups.collection', 'ASC'); }, 'product.group'])->where('id', '=', $colour_id)->paginate(100); //return $results; $groups = Group::where('cat_id', 'LIKE', 60)->get(); $colours = Colour::orderby('order')->get(); $cat = 'linen'; $cat_id = 60; session::put('colour', $colourHex); Session::flash('keywords', 'linen, Tablecloths, napkins'); Session::flash('title', 'Linen'); //return $results[0]; return View::make('results', compact('results', 'groups', 'groupSlug', 'colours', 'colourId', 'cat', 'cat_id', 'catSlug', 'groupName', 'catName')); //return View::make('results'); }
/** * Returning Customer Form Processing. (This will redirect them back to the front end, which should have all of there information! */ public function ReturningCustomerForm() { $lastname = Input::get('lastname'); $email = Input::get('email'); $capche_key = '6LdI9wATAAAAANT_6rPnIaMpVXhAGO8AhOu7H_eV'; $capche_secret = '6LdI9wATAAAAAGAb9tN6ugLnTWFfHUtb3XCc8YdQ'; $response = Input::get('g-recaptcha-response'); //check if the y are correct $results = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . $capche_secret . '&response=' . $response . '&remoteip=' . $_SERVER['REMOTE_ADDR']); $response = json_decode($results); $response->success = true; # PRZ ReturningCustomerForm() if (isset($response->success) && $response->success) { $solved_capache = true; } else { $messages = new Illuminate\Support\MessageBag(); $messages->add('You must prove you are human ', " <b>Capache Error</b>"); Session::flash('ShowReturnPanel', true); Session::flash('SearchError', true); return Redirect::to('/')->withErrors($messages); } session::forget('Step3Completed'); $search = $this->leadtracapi->FindClientByLastNameAndEmail($lastname, $email); if (!$search) { //Show the page & add errors! Session::flash('ShowReturnPanel', true); Session::flash('SearchError', true); Session::forget('fileNumber'); } else { Session::put('fileNumber', $search); // lets see if they are upgrading/updating their profile (see if they have paid for anything.) $client = $this->GetClientFromSession(true); $upgrade = array('100% Payments Received', 'Process Payments'); session::put('Step3Completed', true); } // register their browser id so that this is the primary one editing the file $this->System_Register_With_Clients_BrowserID(); // run step 1, step 2. Session::flash('dont_auto_logout', true); return Redirect::to('/'); }
<?php require_once 'core/init.php'; $count = session::put('Count'); $arr = session::put('arr'); $res_id = session::put('res'); $i = 0; while ($i < $count) { $m = DB::getInstance()->get('service', array('name', '=', $arr[$i])); if ($m->count()) { foreach ($m->results() as $k) { $arr[$i] = $k->id; } } $i++; } print_r($arr); $ii = 0; /*while($ii<$count){ DB::getInstance()->insert('reservation_details',array( 'reservation_id'=>$res_id, 'service_id'=>$arr[$ii] )); $ii++; }*/
} // $query1=$res->get('reservation',array('start','=', $start)); $query2 = $res->get('reservation', array('date', '=', $re_date2)); $condition = false; foreach ($query2->results() as $row) { $s = $row->start; if ($row->start === $start) { $condition = true; break; } } if ($condition) { echo "sorry u can't reserve tomorrow too "; } else { echo "\n\t\t\t\t\t<input type='radio' name='op' value='2'>\n\t\t\t\t\tu can resrve tomorrow at same time </br>"; session::put('dates', $re_date2); //DB::getInstance()->update('reservation',$re_id,array('date', $re_date2)); } echo "\n\t\t<input class='more_btn btn-1' type='submit' name='submit' value='submit'>\n\t\t\t\t\t</form>", '<br>', '<br>'; ?> <?php echo "<a href='calendar.php'>reserve Manually</a>"; } else { echo "you didn't reserved yet "; echo "<a href='calendar.php' class='more_btn' > reserve </a>"; } ?> </div> </div>