Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- $("#username").focus();
- $(document).ready(function(){
- // Check to see if already logged in.
- $.post("ajax/getsession.php", {getLogin: "yes"}, function(data){
- if(data == 1){
- $("#loginBoxContainer").fadeOut(250, function(){
- css = {position: "absolute", top: "175px", left: "150px", width: "700px", height: "350px"};
- $("#loginBox").animate(css, 250, function(){
- $("#deckSelection").fadeIn(250);
- });
- });
- }else{
- //Not logged in
- }
- });
- $("#loginButton").click(function(){
- // Constants
- var errM1 = "The username or password entered was incorrect. Please try again.<br><br>";
- var errM2 = "Please enter a username.<br><br>";
- var errM3 = "Please enter a password.<br><br>";
- // Define username, password with current values
- username = $("#username").val();
- password = $("#password").val();
- // Validate fields (Empty username, empty password, else submit)
- if(username == ""){
- $("#loginFail").html(errM2);
- $("#username").focus();
- $("#loginFormWrapper").animate({top: "50px"}, 500, function(){
- $("#loginFail").removeClass("displayNone").animate({opacity:1}, 500);
- });
- }else if(password == ""){
- $("#loginFail").html(errM3);
- $("#password").focus();
- $("#loginFormWrapper").animate({top: "50px"}, 500, function(){
- $("#loginFail").removeClass("displayNone").animate({opacity:1}, 500);
- });
- }else{
- $.post("ajax/login.php", {username: username, password: password}, function(data){
- errorHandler(data);
- if(data == -103){
- $("#loginFail").html(errM1);
- $("#password").val("").focus();
- $("#loginFormWrapper").animate({top: "50px"}, 500, function(){
- $("#loginFail").removeClass("displayNone").animate({opacity:1}, 500);
- });
- }else if(data == 2){
- $("#username").addClass("successGlow");
- $("#password").addClass("successGlow");
- // We will re-use the login box and morph it into the size necessary for deck selection.
- $("#loginBoxContainer").fadeOut(1000, function(){
- css = {position: "absolute", top: "175px", left: "150px", width: "700px", height: "350px"};
- $("#loginBox").animate(css, 500, function(){
- $("#deckSelection").fadeIn(500);
- });
- });
- }else{
- errorHandler(-102);
- }
- });
- }
- }); // End #loginButton bind
- // Deck Selection Gallery
- // Constants
- var decks = new Array("adflatus", "dreamenchantress", "erotica", "fey", "greenwood", "novelsandfantasy", "paulina", "reflections", "scenery", "sidhe", "tarotduchat", "universalfantasy", "universalgoddess", "visionquest");
- var currentPosLeft = "adflatus";
- // Set up the gallery when the page loads.
- $("#lol")
- $("#dgLeftArrow").hover(function(){
- $("#dgLeftArrow").animate({color: "#333"}, 50)
- }, function(){
- $("#dgLeftArrow").animate({color: "#c5c7cb"}, 50)
- });
- $("#dgRightArrow").hover(function(){
- $("#dgRightArrow").animate({color: "#333"}, 50)
- }, function(){
- $("#dgRightArrow").animate({color: "#c5c7cb"}, 50)
- });
- $("#dgLeftArrow").click(function(){ alert("Clicked")});
- }); // End documentReady
- function errorHandler(err){
- if(err == "-100"){
- alert("A connection to the MySQL database could not be made (-100)");
- }else if(err == "-101"){
- alert("A connection to the MySQL database could not be made (-101)");
- }else if(err == "-102"){
- alert("Unknown response encountered (-102)");
- }else if(err == "-103"){
- //Login failed
- }else if(err == "-104"){
- alert("MySQL query failure.");
- }else if(err == "-105"){
- alert("Please login to your account first.");
- }else{
- // no fatal errors
- }
- }
- </script>
Add Comment
Please, Sign In to add comment