Jump to content

Help with secure login/registration


LocaButt

Recommended Posts

I Posted in another forum but I'm not getting any suggestions. Hopefully you all can help me.

I have looked everywhere the past 2 days.  I have flip-flopped this thing a million different ways - still no luck.
Can someone PLEASE help me and tell me what I need to do to get this thing working?
I found this script online for secure login, there was no registration page included so I have been trying to make one work.
As of now it goes from the registration page(form) to process_registration (this page) then should redirect to index.htm if it is successful.  If there is no password entered, it should just say error.

I get connected to the database , "Localhost via UNIX socket" is what I get in the browser.  No entries, however.

Thanks a lot

 

<script type="text/javascript" src="sha512.js"></script>
<?php

include 'db_connect.php';


if (isset($_POST['password'])) {
$Username = $_POST['username'];
$Email = $_POST['email'];
$Password1 = $_POST['password'];
$Random_Salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true));
$Password = hash('sha512', $Password1.$Random_Salt);
$ip = $_SERVER['REMOTE_ADDR'];
$ml = $_POST['mailinglist'];


$insert_stmt = $mysqli->prepare('INSERT INTO members (username, email, password, salt, ipaddress, date, mailinglist) VALUES (?, ?, ?, ?, ?, ?, ?)');
$insert_stmt->bind_param('sssssis', $Username, $Email, $Password, $Random_Salt, $ip, NOW(), $ml);
$insert_stmt->execute();
header ['Location: index.htm'];
}
	else
	{
		echo 'ERROR';
	}


?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/276406-help-with-secure-loginregistration/
Share on other sites

There are many issues present here, but for actually getting it to work:

 

Are you not receiving any errors?  Place

error_reporting(-1); 

right below the opening <?php line just to be sure.

 

Do you have the database table created with a schema that lines up with what is in the query?

 

The header() call should use parentheses and not brackets.

 

nbst

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.