Note that there are some explanatory texts on larger screens.

plurals
  1. POmysql insert to database Registration Page example?
    primarykey
    data
    text
    <p>I am making my first attempts at creating secure logins via php/msql and things are going pretty well. I've been following the tutorial here: <a href="http://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL" rel="nofollow">http://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL</a> and amazingly I've got everything working and relating to my page and database. Going through this code has given me a much better understanding of how it all fits together. </p> <p>The problem I'm having is, the example registration page they provided isn't very complete, or at least not in a way a newbie like me can wrap my head around. Below is what they posted for their registration page example. Would someone be able to fill it in a bit so I'm less lost? I'm guessing I need to build a form around this so users can make accounts but as for the <em>//add your insert to database script here</em> part and where to pull/place form variables from what they posted, I'm thus far disoriented.</p> <pre><code>// The hashed password from the form $password = $_POST['p']; // Create a random salt $random_salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true)); // Create salted password (Careful not to over season) $password = hash('sha512', $password.$random_salt); // Add your insert to database script here. // Make sure you use prepared statements! if ($insert_stmt = $mysqli-&gt;prepare("INSERT INTO members (username, email, password, salt) VALUES (?, ?, ?, ?)")) { $insert_stmt-&gt;bind_param('ssss', $username, $email, $password, $random_salt); // Execute the prepared query. $insert_stmt-&gt;execute(); } </code></pre> <p>As always, any help is greatly appreciated. Thank you in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload