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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:36:50+00:00 2026-05-21T14:36:50+00:00

I am fairly new to php security, and for my site, I was a

  • 0

I am fairly new to php security, and for my site, I was a sign up and login, and I want to add md5 their passwords, but I can’t find anywhere which has a clear guide on what needs to be added to the sign up, and what needs to be added to the login files, and/or the database, as I say I am fairly new to php in terms of web security, so I am in need of some help, here’s part of what I have on my sign up form:

    $error = $user = $pass = "";
if (isset($_SESSION['user'])) destroySession();

if (isset($_POST['user']))
{
    $user = sanitizeString($_POST['user']);
    $pass = sanitizeString($_POST['pass']);


    if ($user == "" || $pass == "")
    {
        $error = "Not all fields were entered<br /><br />";
    }
    else
    {
        $query = "SELECT * FROM members WHERE user='$user'";

        if (mysql_num_rows(queryMysql($query)))
        {
            $error = "Username already taken<br /><br />";
        }
        else
        {
            $query = "INSERT INTO members VALUES('$user', '$pass')";
            queryMysql($query);
            die("<h4>Account created</h4>Please Log in.");
        }

    }
}

I just need an example or a good guide of what I need to do to get it working correctly.

  • 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-21T14:36:50+00:00Added an answer on May 21, 2026 at 2:36 pm

    I think you’re looking to salt and then hash your passwords. Simply add a string of your choosing to the front (and if you wish, to the end) of your password before hashing it using MD5.

    e.g.

    $pass = 'mypassword';
    $salt = 'S%gh3578';  //anything you want
    $pepper = 'w890rrk'; //anything you want
    $query = "INSERT INTO members VALUES('$user', md5('".$salt.$pass.$pepper."'))";
    queryMysql($query);
    

    This will store the password in the database using salted MD5 encryption that cannot be reversed using a lookup table of common passwords using unsalted MD5 encryption.

    To check if a password is valid, you do something similar:

    $passToCheck = 'something';
    $correctMD5 = (retrieve hash from db)
    if($salt.$passToCheck.$pepper == $correctMD5)
    {    
       //valid login
    } else {
       //login failure
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fairly new to PHP, but have applied my previous knowledge of programming,
This might be a simple question, but I'm fairly new to PHP and am
I have plenty of experience with this in PHP, but am fairly new to
I've got a really simple problem but I just can't sort it, fairly new
I'm trying to parse a quite large XML-sheet with PHP, but I'm fairly new
Notes: I'm still fairly new to php This login form seems to work perfectly
I'm fairly new to PHP, but have managed to set up a script that
I'm fairly new to PHP and MySQL (experienced with other languages). Basically I want
Fairly new to PHP but in the middle of building an admin panel for
i'll try my best to explain the situation but i'm fairly new to php

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.