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

  • SEARCH
  • Home
  • 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 6971143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:48:05+00:00 2026-05-27T16:48:05+00:00

Right now I have a site that I only allow about five people to

  • 0

Right now I have a site that I only allow about five people to log into.

Those five people every time they login have to read an NDA and type their name in two text boxes provided. First and last name. When the user presses the submit button they are either taken to the site, if their name is correct, or logged out of the site if they type in anything other than their name.

Right now I am using javascript to do this since I don’t know how to use php to do this.

If the user does not enter his name in correctly the first time I want the user to be logged out, like what I have now, and I also want this users username to be altered by adding, “xxx10017969” to the end of his username. This will prevent him from logging back in and require him to contact me so I can fix his username in the database.

here is the HTML:

      <form method="post" action="index.php" style="width: 600px;"><p>By typing your first and last name below you are bound by this contract. If you type anything other than your first and last name, you will be logged out and your account will be deleted.</p>
<p><input type="text" value="First Name" name="first_name" id="first_name" />
<input type="text" value="Last Name" name="family_name" id="last_name" />
<input type="date" value="Date" name="signiature" /></p>
      <p><input type="button" value="Access Site" onclick="checkforname();" /><p>
      </form>

And here is my javascript:

    <script type="text/javascript">

  function checkforname() {
  var fname = "<?php echo "$identity->first_name"; ?>";
  var lname = "<?php echo "$identity->family_name"; ?>";

  var enteredFname = document.getElementById("first_name").value;
  var enteredLname = document.getElementById("last_name").value;

  if (enteredFname == fname && enteredLname == lname) {

  }
  else {
    window.location = ("login.php?logout");
  }

  }

  </script>
  • 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-27T16:48:07+00:00Added an answer on May 27, 2026 at 4:48 pm

    To do this in PHP instead of javascript –

    The form submits to index.php, so that is where the logic should be.

    If you want to leverage the way you redirect to login.php?logout, than index.php would have to have code something like this in it:

    <?php
    
    // Code to populate $identity from the database goes here
    
    // Checks if user entered fields match database record
    if ($identity->first_name != $_POST['first_name'] ||
        $identity->family_name != $_POST['family_name'])
    {
        // Code to disable account goes here, but need to see a sample of
        // your existing php database code to show how to modify first_name
        header("Location: login.php?logout");
    }
    

    Keep in mind any headers should be processed before the php prints anything including newlines … so if index.php is an “in-line php” html page, make sure this happens at the very top of the file before the html portion starts. The opening <?php tag should be on line 1.

    Also, this assumes you have a way to lookup the user again from a session or something to get the $identity variable populated with the user record.

    There are some other things that ideally would be done here like sanitizing the user input in the post fields, and checking if post fields are empty to not generate warnings, but those are lessons for another time.

    EDIT: Please show your existing php code when it is interacting with the database, like how it populates $identity, otherwise a specific solution cannot be provided.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the thing. Right now I have this e-commerce web site where people
I have a site which has an area that requires authentication. Right now I
I am working on a site right now and have discovered that the jquery/javascript
Right now I have a Drupal site where I'm integrating a custom front-end interface
Right now we have AD/Exchange to manage all of our users logins/e-mail on-site at
I have a membership site in beta right now... At the moment, when a
Right now I have something like this in NHibernate: Expression.Like(property, value, MatchMode.Anywhere) and that
Right now I have two different groups of users on my site: customers and
I have a free web site that streams real-time stock-options data. I want to
I have been reading this ebook about DDD and it says that only highly

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.