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 4064668
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:53:06+00:00 2026-05-20T15:53:06+00:00

I have a form to signup with the code below: <form method=post> Username<input type=text

  • 0

I have a form to signup with the code below:

<form method="post">
Username<input type="text" size="12" maxlength="16" name="username"><br />
Password<input type="password" size="12" maxlength="32" name="password"><br />
<input type="submit" name="submit" value="Sign Up!" />
</form>

And then I have it too check if the username contains any special characters and if it doesn’t it runs this code:

define("DB_SERVER", "localhost");
define("DB_USER", "will");
define("DB_PASS", "blahblah");
define("DB_NAME", "blahblah");
define("TBL_USERS", "users");

$connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
mysql_select_db(DB_NAME, $connection) or die(mysql_error());

function addNewUser($username, $password){
   global $connection;
   $username =$POST['username'];
   $password =$_POST['password'];
   $password1 = md5($password);
   $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password1')";
   return mysql_query($q, $connection);
}

This should add the username and password to my table with the password as an md5 hash but it doesn’t, could someone please help me.

Thanks!

  • 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-20T15:53:06+00:00Added an answer on May 20, 2026 at 3:53 pm

    First of all:
    Don’t use concatenated strings to insert values to the database. This is a major security hole, it can be exploited using a technique called SQL-Injection. You can prevent this by using so called Prepared Statements.

    And this should solve your problem:
    You probably don’t really call the addNewUser function. You just connect ot the database.

    Try this:

    define("DB_SERVER", "localhost");
    define("DB_USER", "will");
    define("DB_PASS", "blahblah");
    define("DB_NAME", "blahblah");
    define("TBL_USERS", "users");
    
    function addNewUser($username, $password){
       global $connection;
       $password1 = md5($password);
       $username = mysql_real_escape_string($username);
       $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password1')";
       return mysql_query($q, $connection);
    }    
    
    $connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
    mysql_select_db(DB_NAME, $connection) or die(mysql_error());
    addNewUser($_POST["text"], $_POST["password"]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this HTML code to create the form: <form method=POST action=/post.php name=signup> <table>
I have a form like this: <form name=mine> <input type=text name=one> <input type=text name=two>
Simple scenario: I have a signup form, with user name, password, email address, may
I have a form with many input fields. When I catch the submit form
I have an issue with this jquery code below. Please give me advice or
I have this javascript code below that uses jquery, it is suppoed to be
I have a form to signup yourself in a mailing list. I had set
I have a signup form on my home page which uses server side validation
I have just finished creating my signup form and now ready to insert data
I have a signup form, and I wanted to make it so that they

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.