Advertisement
Guest User

Untitled

a guest
Feb 27th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. $("a.logmein").colorbox({ width:"540", height:"420", href:function(){ return this.href + " #login"; }, onComplete: function(){
  2. $("#formLoginUser").submit(function(){
  3. $.ajax({
  4. data: $(this).serialize(),
  5. type: "POST",
  6. url: $(this).attr('action'),
  7.  
  8. success: function(response) {
  9. if(response.status == 'fail'){
  10. $("#notifications").removeClass().addClass('ajaxerror').html(response.message).show();
  11. } else {
  12. $("#notifications").removeClass().addClass('ajaxsuccess').html(response.message).show();
  13. }
  14. console.log(response);
  15.  
  16. },
  17. error: function (xhr, textStatus, errorThrown) {
  18. $("#notifications").addClass('ajaxsuccess').html(xhr.responseText).show();
  19. }
  20. });
  21. return false;
  22. });
  23. }});
  24.  
  25. header("Content-Type:application/json");
  26.  
  27. switch($_REQUEST['action']){
  28. case('formLoginUser'): $afm = $_POST['afm'];
  29. $password = $_POST['password'];
  30.  
  31. $query_finduser = sprintf("SELECT * FROM clients WHERE clientafm=%s and clientcode=%s and expires>%s",
  32. GetSQLValueString($afm, "text"),
  33. GetSQLValueString($password, "int"),
  34. GetSQLValueString(strtotime('now'), "int"));
  35. $finduser = mysql_query($query_finduser, $connection) or die(mysql_error());
  36. $row_finduser = mysql_fetch_assoc($finduser);
  37. $totalRows_finduser = mysql_num_rows($finduser);
  38.  
  39. if($totalRows_finduser==0) {
  40. echo json_encode(array("status"=>"fail", "message"=>"Login failed. Please retry"));
  41. } else {
  42.  
  43. echo json_encode(array("status"=>"success", "message"=>"Login successful!"));
  44. }
  45. break;
  46.  
  47. default: break;
  48.  
  49. }//switch end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement