Server IP : 108.163.255.210 / Your IP : 3.149.29.209 Web Server : Apache System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 User : ( 1172) PHP Version : 7.2.34 Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/unilinki/public_html/csrability.in/app/Http/Controllers/ |
Upload File : |
<?php namespace App\Http\Controllers; use App\User; use DB; use Exception; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Redirect; use Log; use Mail; use Socialite; use App\Savejob; use App\Job; use App\UserInterest; class SocialController extends Controller { /* facebook page redirect function */ public function redirectToFacebook() { return Socialite::driver('facebook')->redirect(); \Log::info('socialite driver error'); } /* facebook login user create and check existence of user */ public function handleFacebookCallback() { try { $user = Socialite::driver('facebook')->stateless()->user(); $existUser = User::where('email', $user->email)->first(); $last_user = User::orderBy('created_at', 'desc')->first(); $new_user = ($last_user->id + 1); $user_id = ('CLNT000'.$new_user); if (!empty($existUser)) { Auth::loginUsingId($existUser->id); $userInfo = $existUser->id; return redirect()->route('updateProfile', ['user_id' => base64_encode($userInfo)]); } else { $userModel = new User; $userModel->name = $user->name; $getFullName = explode(' ', $user->name); $userModel->first_name = $getFullName[0]; $userModel->last_name = $getFullName[1]; $userModel->user_type = 5; $userModel->user_id = $user_id; $userModel->email = $user->email; $userModel->user_image = $user->getAvatar(); $userModel->password = bcrypt('12345678'); $userModel->facebook_id = $user->getId(); $createdUser = $userModel->save(); $lastId = \DB::getPdo()->lastInsertId(); $userInfo = $lastId; if (!is_null($user->email)) { $data = array(); $data['name'] = $user->name; $data['email'] = $user->email; Mail::send('mail.social', $data, function ($message) use ($data) { $message->to($data['email']); $message->subject('Welcome to your new CSR membership'); }); } Auth::loginUsingId($lastId); return redirect()->route('updateProfile', ['user_id' => base64_encode($userInfo)]); } } catch (Exception $e) { return redirect()->route('user.login'); } } /* google page redirect function */ public function redirectToGoogle() { return Socialite::driver('google')->redirect(); } /* google login user create and check existence of user */ public function handleGoogleCallback() { try { $googleUser = Socialite::driver('google')->stateless()->user(); // dd($googleUser); $existUser = User::where('email', $googleUser->email)->first(); $last_user = User::orderBy('created_at', 'desc')->first(); $new_user = ($last_user->id + 1); $user_id = ('CLNT000'.$new_user); if (!empty($existUser)) { Auth::loginUsingId($existUser->id); $userInfo = $existUser->id; //request()->session()->put('userdata', $user); //dd(\Auth::user()->id); return redirect()->route('updateProfile', ['user_id' => base64_encode($userInfo)]); //request()->session()->put('userdata', $existUser); } else { $user = new User; $user->name = $googleUser->name; // $user->name = $user->name; $getFullName = explode(' ', $googleUser->name); $user->first_name = $getFullName[0]; $user->last_name = $getFullName[1]; $user->user_type = 5; $user->user_id = $user_id; echo $user->email = $googleUser->email; $user->user_image = $googleUser->avatar; $user->google_id = $googleUser->id; $user->password = bcrypt('12345678'); $user->save(); $lastId = \DB::getPdo()->lastInsertId(); $userInfo = $lastId; if (!is_null($user->email)) { $data = array(); $data['name'] = $user->name; $data['email'] = $user->email; Mail::send('mail.social', $data, function ($message) use ($data) { $message->to($data['email']); $message->subject('Welcome to your new CSR membership'); }); } Auth::loginUsingId($lastId); //request()->session()->put('userdata', $user); //dd(\Auth::user()->id); return redirect()->route('updateProfile', ['user_id' => base64_encode($userInfo)]); } } catch (Exception $e) { return redirect()->route('user.login'); } } public function redirectToLinkedin() { return Socialite::driver('linkedin')->redirect(); } public function handleLinkedinCallback() { try { $users = Socialite::driver('linkedin')->stateless()->user(); //dd($users); $existUser = User::where('email', $users->email)->first(); $last_user = User::orderBy('created_at', 'desc')->first(); $new_user = ($last_user->id + 1); $user_id = ('CLNT000'.$new_user); if (!empty($existUser)) { // Auth::loginUsingId($existUser->id); Auth::loginUsingId($existUser->id); $userInfo = $existUser->id; return redirect()->route('updateProfile', ['user_id' => base64_encode($userInfo)]); } else { $user = new User; $user->name = $users->first_name . ' ' . $users->last_name; $user->first_name = $users->first_name; $user->last_name = $users->last_name; $user->user_type = 5; $user->user_id = $user_id; $user->email = $users->email; $user->user_image = $users->avatar; $user->linkedin_id = $users->id; $user->password = bcrypt('12345678'); $user->save(); $lastId = \DB::getPdo()->lastInsertId(); $userInfo = $lastId; $data = array(); $data['name'] = $users->first_name . '' . $users->last_name; $data['email'] = $users->email; Mail::send('mail.social', $data, function ($message) use ($data) { $message->to($data['email']); $message->subject('Welcome to your new CSR membership'); }); Auth::loginUsingId($users->id); } Auth::loginUsingId($lastId); return redirect()->route('updateProfile', ['user_id' => base64_encode($userInfo)]); } catch (Exception $e) { return redirect()->route('user.login'); } } public function updateProfile(Request $request) { try { //$id = base64_decode($request->user_id); $id = Auth::user()->id; $userInfo = User::with('UserInterest')->where('id', $id)->first(); $UserInterest = $userInfo['UserInterest']; $jobdetails = DB::table('savejobs') ->leftJoin('jobs', 'savejobs.job_id', '=', 'jobs.id') ->select('jobs.job_title', 'jobs.id', 'jobs.organisation', 'savejobs.created_at') ->where('user_id', $id) ->orderBy('created_at', 'desc') ->limit(10) ->get(); $jobapplieddetails = DB::table('applications') ->leftJoin('jobs', 'applications.job_id', '=', 'jobs.id') ->select('jobs.job_title', 'jobs.id', 'jobs.organisation', 'applications.created_at') ->where('user_id', $id) ->orderBy('created_at', 'desc') ->limit(10) ->get(); $interest_area = UserInterest::where('user_id', $id)->get(); $interest_count = UserInterest::where('user_id', $id)->count(); // dd($interest_count); return view('front.updateProfile', compact('userInfo', 'UserInterest'))->with([ 'jobdetails' => $jobdetails, 'jobapplieddetails' => $jobapplieddetails, 'interest_area' => $interest_area, 'interest_count' => $interest_count ]); } catch (Exception $e) { // Log::error($e); // $message = array('flag'=>'alert-danger', 'message'=>$e->getMessage()); // return back()->with(['message'=>$message]); return view('error'); } } public function Usersubscription(Request $request) { try { return view('front.usersubscription')->with([ 'title'=>'Subscription Plans' ]); } catch (Exception $e) { Log::error($e); $message = array('flag'=>'alert-danger', 'message'=>$e->getMessage()); return back()->with(['message'=>$message]); } } public function UserProfile(Request $request) { try { return view('front.userprofile')->with([ 'title'=>'Profile' ]); } catch (Exception $e) { Log::error($e); $message = array('flag'=>'alert-danger', 'message'=>$e->getMessage()); return back()->with(['message'=>$message]); } } public function deleteInterest(Request $request, $id) { try { //$rs = User::where('id', $userId)->update(['is_deleted'=>1]); $rs = UserInterest::destroy('id', $id); if($rs) { $message = array('flag'=>'alert-success', 'message'=>'Interest Area Removed Successfully'); return back()->with(['message'=>$message]); } $message = array('flag'=>'alert-danger', 'message'=>'Unable to remove Interest Area, Please try again'); return back()->with(['message'=>$message]); } catch (Exception $e) { $message = array('flag'=>'alert-danger', 'message'=>$e->getMessage()); return back()->with(['message'=>$message]); } } }