Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3460616
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:15:05+00:00 2026-05-18T10:15:05+00:00

I’m trying to create a simple login system that will have the forms and

  • 0

I’m trying to create a simple login system that will have the forms and everything on one domain (Let’s call it Domain A) and the PHP files on another domain (Domain B). Why? Simply because Domain A is more reliable but doesn’t support PHP. I’m quite new to all this AJAX stuff, so I’m currently using the resources I’ve found online.

The Jquery and Forms part of it on Domain A are as below:

<form id="submit" method="post">
<fieldset>
<legend>Enter Information</legend>  

<label for="fname">Name:</label>  
<input class="text" id="fname" name="fname" size="20" type="text" />  

<label for="lname">Email:</label>  
<input class="text" id="lname" name="lname" size="20" type="text" />  

<button class="button positive"> Submit </button>  </fieldset>
</form>
<script>
$(document).ready(function(){  
    $("form#submit").submit(function() {  
    // we want to store the values from the form input box, then send via ajax below  
    var fname     = $('#fname').attr('value');  
    var lname     = $('#lname').attr('value');  
        $.ajax({  
            type: "POST",  
            url: "http://domainB.com/somefolder/ajax.php",  
            data: "fname="+ fname +"& lname="+ lname,  
            success: function(){  
                $('form#submit').hide(function(){$('div.success').fadeIn();});  

            }  
        });  
    return false;  
    });  
});  
</script>

Please note that the ‘lname’ and ‘fname’ are going to represent Name and Email instead of Firstname and Lastname respectively.

The PHP code on Domain B :

<?php  

    // CLIENT INFORMATION  
    $uname        = htmlspecialchars(trim($_POST['fname']));  
    $umail        = htmlspecialchars(trim($_POST['lname']));  
  $uip = 12345;
  $usecret = "secret";
//Mysql
$con = mysql_connect("mysql.domainB.com","username","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
//Connect
mysql_select_db("login_db", $con);
//Insert user details irrespective of whether the user is a member or not to make a log kind of thing
mysql_query("INSERT INTO log_data (Name, Email, IP_ADDRESS, Secret)
VALUES ('$uname', '$umail', '$uip', '$usecret')");

//Now check if the user is a subscriber or not


//   mysql_query("SELECT Email, Secret FROM login_data WHERE Email='$umail' AND Secret="secret"");
//I don't know the code to check if the user has logged in correctly
//This is where I need you to help me
//I need to check if the user has logged in correctly, if yes, then return a message saying //success which should be caught by Jquery and displayed as an Alert, or something
//If the user login failed, this php code should return a failure message which again should be caught by Jquery on Domain A and displayed as an alert in the least.


mysql_close($con);
//end Mysql

?>  

Things to note here – There are two tables inside the login_db database – log_data which stores the log information and the login_data which stores usernames and passwords. The variable $secret stores the user’s password.

The log_data insertion works like a charm, but its the login_data that is bugging me. Any help would be much appreciated. Thanks!

Imag

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:15:06+00:00Added an answer on May 18, 2026 at 10:15 am

    Just give a trying the below code…it should take care of cross domain issue also

    var dataString = "fName=" + $('#fname').attr('value') + "&lname=" + $('#lname').attr('value');
                    var url = "http://demo/exampe.php?" + dataString;
    
    
                  $.getJSON(url + "&jsoncallback=?", function(data){
    
                    alert("success");
    

    jsonp object construction should be as below..

    {"menu": {
      "id": "file",
      "value": "File",
      "popup": {
        "menuitem": [
          {"value": "New", "onclick": "CreateNewDoc()"},
          {"value": "Open", "onclick": "OpenDoc()"},
          {"value": "Close", "onclick": "CloseDoc()"}
        ]
      }
    }}
    
    
    
                    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.