Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.