1 function statusChangeCallback(response) { 2 if (response.status === 'connected') { 3 testAPI(); 4 } else { 5 // The person is not logged into your app or we are unable to tell. 6 7 } 8 } 9 10 function checkLoginState() { 11 FB.getLoginStatus(function(response) { 12 statusChangeCallback(response); 13 }); 14 } 15 16 window.fbAsyncInit = function() { 17 FB.init({ 18 appId : '1506056846386383', 19 cookie : true, 20 xfbml : true, 21 version : 'v2.8' 22 }); 23 }; 24 25 (function(d, s, id) { 26 var js, fjs = d.getElementsByTagName(s)[0]; 27 if (d.getElementById(id)) return; 28 js = d.createElement(s); js.id = id; 29 js.src = "https://connect.facebook.net/en_US/sdk.js"; 30 fjs.parentNode.insertBefore(js, fjs); 31 }(document, 'script', 'facebook-jssdk')); 32 33 function testAPI() { 34 FB.api('/me?fields=id,name,first_name,last_name,email,gender,permissions', function(response) { 35 $("#login-box-login").html('<br><center><img src="img/loader.gif" style="width:100px;height:auto"></center>'); 36 $("#login-box-signup").html('<br><center><img src="img/loader.gif" style="width:100px;height:auto"></center>'); 37 38 var FB_id=response.id; 39 var FB_email=response.email; 40 var FB_first_name=response.first_name; 41 var FB_last_name=response.last_name; 42 var FB_gender=response.gender; 43 44 $.ajax({ 45 type: "POST", 46 dataType:'json', 47 url: "webapi/fb_connect.php", 48 data: {userid:FB_id, email:FB_email, firstname:FB_first_name,lastname:FB_last_name,gender:FB_gender,interfacePlatform:'web'}, 49 timeout: 10000, 50 success: function(result) { 51 if(result.res=="failed") 52 { 53 $("#btn-login").css('background-color', '#bd931d'); 54 $("#btn-login").html("Log in"); 55 $("#log_warning").html("There seems to be a connectivity issue...Please try again"); 56 $("#log_warning").css({ display: "block" }); 57 58 $("#btn-signup").css('background-color', '#bd931d'); 59 $("#btn-signup").html("Sign in"); 60 $("#signup_warning").html("There seems to be a connectivity issue...Please try again"); 61 $("#signup_warning").css({ display: "block" }); 62 } 63 else 64 { 65 if(result.act=="login") 66 { 67 $("#member-status").html('<div style="float:right"><div style="width:50px;float:left"><img src="'+result.ProfilePic+'" style="height:50px;width:50px;border-radius:50%;"></div><div style="float:left;color:#ffffff;padding-left:10px;font-size:12px;text-align:left;padding-top:5px"><a href="myaccount.php" style="color:#ffffff">My Account</a><br><a href="logout.php" style="color:#ffffff">Log out</a></div><div style="clear:both"></div></div>'); 68 $("#login-box-login").html('<center><img src="'+result.ProfilePic+'" style="height:100px;width:100px;border-radius:50%;"><h5>Hello '+result.firstname+'</h5><br> You are now logged in. What would you like to do?<br><br><a class="btn btn-lg" href="javascript:closeLogin();" style="border:2px solid #C0C0C0;background-color:#ffffff;color:#202020;font-size:14px;margin:10px;font-family:\'RalewayBold\'">I\'ll stay here thanks</a> <a class="btn btn-lg" href="dashboard.php" style="border:2px solid #C0C0C0;background-color:#ffffff;color:#202020;font-size:14px;margin:10px;font-family:\'RalewayBold\'">Go to my Whizzky Dashboard</a></center>'); 69 $("#login-box-signup").html('<center><img src="'+result.ProfilePic+'" style="height:100px;width:100px;border-radius:50%;"><h5>Hello '+result.firstname+'</h5><br> You are now logged in. What would you like to do?<br><br><a class="btn btn-lg" href="javascript:closeLogin();" style="border:2px solid #C0C0C0;background-color:#ffffff;color:#202020;font-size:14px;margin:10px;font-family:\'RalewayBold\'">I\'ll stay here thanks</a> <a class="btn btn-lg" href="dashboard.php" style="border:2px solid #C0C0C0;background-color:#ffffff;color:#202020;font-size:14px;margin:10px;font-family:\'RalewayBold\'">Go to my Whizzky Dashboard</a></center>'); 70 $("#login-box-tabs").css({ display: "none" });
71 $("#modal-close").html(' '); 72 } 73 else 74 { 75 window.location = "dashboard.php?newusr=yes"; 76 } 77 } 78 }, 79 error: function() { 80 81 } 82 }); 83 84 }); 85 } 86 87 88 89function closeLogin(){ 90$("#loginModal").modal('hide'); 91location.reload(); 92} 93 94function openLogin(attrib){ 95$("#login-box-tabs").css({ display: "block" }); 96$(".login-stage").css({ display: "none" }); 97$("#login-box-"+attrib).css({ display: "block" }); 98$(".login-action").css('color', '#8e8e8e'); 99$("#login-action-"+attrib).css('color', '#ffffff'); 100$("#loginModal").modal('show'); 101} 102 103function changeLogin(){ 104 105} 106 107function login() 108{ 109 $("#btn-login").css('background-color', '#404040'); 110 $("#btn-login").html("Loading..."); 111 112 var username = $('#login-email').val(); 113 var password = $('#login-password').val(); 114 var persistLogin=0; 115if ($('#login-remember').is(":checked")) 116{ 117 persistLogin=1; 118} 119 120 121 if(username=="" || username==null || password=="" || password==null) 122 { 123 $("#btn-login").css('background-color', '#bd931d'); 124 $("#btn-login").html("Log in"); 125 $("#log_warning").html("Incorrect details supplied"); 126 $("#log_warning").fadeIn('slow'); 127 } 128 else 129 { 130 $.ajax({ 131 type: "POST", 132 dataType:'json', 133 url: "webapi/login.php", 134 data: {username:username, password:password, interfacePlatform:'web', persistLogin:persistLogin}, 135 timeout: 10000, 136 success: function(result) { 137 if(result.res=="failed") 138 { 139 $("#btn-login").css('background-color', '#bd931d'); 140 $("#btn-login").html("Log in"); 141 $("#log_warning").html("Incorrect details supplied"); 142 $("#log_warning").css({ display: "block" }); 143 } 144 else 145 { 146 $("#member-status").html('<div style="float:right"><div style="width:50px;float:left"><img src="'+result.ProfilePic+'" style="height:50px;width:50px;border-radius:50%;"></div><div style="float:left;color:#ffffff;padding-left:10px;font-size:12px;text-align:left;padding-top:5px"><a href="myaccount.php" style="color:#ffffff">My Account</a><br><a href="logout.php" style="color:#ffffff">Log out</a></div><div style="clear:both"></div></div>'); 147 $("#login-box-login").html('<center><img src="'+result.ProfilePic+'" style="height:100px;width:100px;border-radius:50%;"><h5>Hello '+result.firstname+'</h5><br> You are now logged in. What would you like to do?<br><br><a class="btn btn-lg" href="javascript:closeLogin();" style="border:2px solid #C0C0C0;background-color:#ffffff;color:#202020;font-size:14px;margin:10px;font-family:\'RalewayBold\'">I\'ll stay here thanks</a> <a class="btn btn-lg" href="dashboard.php" style="border:2px solid #C0C0C0;background-color:#ffffff;color:#202020;font-size:14px;margin:10px;font-family:\'RalewayBold\'">Go to my Whizzky Dashboard</a></center>'); 148 $("#login-box-tabs").css({ display: "none" }); 149 $("#modal-close").html(' '); 150 } 151 }, 152 error: function() { 153 $("#btn-login").css('background-color', '#bd931d'); 154 $("#btn-login").html("Log in"); 155 $("#log_warning").html("There seems to be a connectivity issue...Please try again"); 156 $("#log_warning").css({ display: "block" }); 157 } 158 }); 159 160 } 161} 162 163 164function signup() 165{ 166 $("#signup_warning").css({ display: "none" }); 167 $("#btn-signup").css('background-color', '#404040'); 168 $("#btn-signup").html("Loading..."); 169 170 var firstname = $('#signup-fname').val(); 171 var lastname = $('#signup-lname').val(); 172 var username = $('#signup-email').val(); 173 var password = $('#signup-password').val(); 174 175 if(username=="" || username==null || password=="" || password==null || firstname=="" || firstname==null || lastname=="" || lastname==null) 176 { 177 $("#btn-signup").css('background-color', '#bd931d'); 178 $("#btn-signup").html("Sign up"); 179 $("#signup_warning").html("Please complete all fields"); 180 $("#signup_warning").fadeIn('slow'); 181 } 182 else 183 { 184 185if(validateEmail(username)==false) 186{ 187 $("#btn-signup").css('background-color', '#bd931d'); 188 $("#btn-signup").html("Sign up"); 189 $("#signup_warning").html("Please enter a vaild email address"); 190 $("#signup_warning").fadeIn('slow'); 191} 192else 193{ 194 $.ajax({ 195 type: "POST", 196 dataType:'json', 197 url: "webapi/register.php", 198 data: {firstname:firstname, lastname:lastname, email:username, password:password, interfacePlatform:'web'}, 199 timeout: 10000, 200 success: function(result) { 201 if(result.res=="failed") 202 { 203 $("#btn-signup").css('background-color', '#bd931d'); 204 $("#btn-signup").html("Sign up"); 205 $("#signup_warning").html("That email address is already in use"); 206 $("#signup_warning").css({ display: "block" }); 207 } 208 else 209 { 210 window.location = "dashboard.php?newusr=yes"; 211 } 212 }, 213 error: function() { 214 $("#btn-signup").css('background-color', '#bd931d'); 215 $("#btn-signup").html("Sign in"); 216 $("#signup_warning").html("There seems to be a connectivity issue...Please try again"); 217 $("#signup_warning").css({ display: "block" }); 218 } 219 }); 220 221 } 222} 223} 224 225function validateEmail(email) { 226 var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 227 return re.test(email); 228} 229 230function openForgotPassword(){ 231$("#loginModal").modal('hide'); 232$("#generic-modal-header").html('Password Reset'); 233var s='Enter your registered email address below and we will send you a link to reset your password.<div class="form-group"><br><div id="reset_success" class="form-success"></div><input type="email" class="form-control fancyInput" id="reset-email" aria-describedby="emailHelp" placeholder="Enter Email"></div><br><center><button id="btn-reset" class="btn btn-primary" onclick="resetPassword();" style="background-color:#bd931d;font-family:\'RalewayBold\';border:none">Reset Password</button></center>'; 234$("#generic-modal-body").html(s); 235$("#genericModal").modal('show'); 236} 237 238function resetPassword(){ 239 $("#btn-reset").html("Loading..."); 240 $("#btn-reset").prop('disabled', true); 241 242 var email = $('#reset-email').val(); 243 244if(email!="") 245{ 246 247 $.ajax({ 248 type: "POST", 249 dataType:'json', 250 url: "webapi/reset_password.php", 251 data: {email:email},
252 timeout: 10000, 253 success: function(result) { 254 $("#reset_success").html("We have sent you an email with a link to reset your password"); 255 $("#reset_success").css({ display: "block" }); 256 $("#btn-reset").html("Reset Password"); 257 $("#btn-reset").prop('disabled', false); 258 }, 259 error: function() { 260 $("#btn-reset").html("Reset Password"); 261 $("#btn-reset").prop('disabled', false); 262 } 263 }); 264} 265else 266{ 267 $("#btn-reset").html("Reset Password"); 268 $("#btn-reset").prop('disabled', false); 269} 270}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.