Create a PHP Login Script 2015(youtube).
<p>hi there, i have some problems with simple login php script.<br />actually i have problem like this - Notice: Only variables should be passed by reference in D:\X_AMPP\htdocs\www\register.php on line 15.</p>
<p>and my code on that lines (line 15 is - <span style="background-color: #272822; color: #f8f8f2; font-family: 'Courier New';">$stmt</span><span style="font-family: 'Courier New'; color: #f92672;">-></span><span style="font-family: 'Courier New'; color: #a6e22e;">bindParam</span><span style="background-color: #272822; color: #f8f8f2; font-family: 'Courier New';">(</span><span style="font-family: 'Courier New'; color: #e6db74;">':password'</span><span style="background-color: #272822; color: #f8f8f2; font-family: 'Courier New';">, </span><span style="font-family: 'Courier New'; color: #a6e22e;">password_hash</span><span style="background-color: #272822; color: #f8f8f2; font-family: 'Courier New';">($_POST[</span><span style="font-family: 'Courier New'; color: #e6db74;">'password'</span><span style="background-color: #272822; color: #f8f8f2; font-family: 'Courier New';">], PASSWORD_BCRYPT));</span> looks like -</p>
<p> </p>
<pre style="background-color: #272822; color: #f8f8f2; font-family: 'Courier New'; font-size: 11,3pt;"><!--?php <br ?--><span style="color: #75715e;">//error_reporting(0);<br /></span><span style="color: #75715e;"><br /></span><span style="color: #f92672;">require </span><span style="color: #e6db74;">'database.php'</span>;<br /><br />$message <span style="color: #f92672;">= </span><span style="color: #e6db74;">''</span>;<br /><br /><span style="color: #f92672;">if</span>(<span style="color: #f92672;">!empty</span>($_POST[<span style="color: #e6db74;">'email'</span>]) <span style="color: #f92672;">&& !empty</span>($_POST[<span style="color: #e6db74;">'password'</span>]))<span style="color: #f92672;">:<br /></span><span style="color: #f92672;"><br /></span> <span style="color: #75715e;">//Enter new user into DB!<br /></span> $sql <span style="color: #f92672;">= </span><span style="color: #e6db74;">"INSERT INTO users (email, password) VALUES (</span><span style="color: #fd971f; font-style: italic;">:email</span><span style="color: #e6db74;">, </span><span style="color: #fd971f; font-style: italic;">:password</span><span style="color: #e6db74;">)"</span>;<br /> $stmt <span style="color: #f92672;">= </span>$conn<span style="color: #f92672;">-></span><span style="color: #a6e22e;">prepare</span>($sql);<br /><br /> $stmt<span style="color: #f92672;">-></span><span style="color: #a6e22e;">bindParam</span>(<span style="color: #e6db74;">':email'</span>, $_POST[<span style="color: #e6db74;">'email'</span>]);<br /> $stmt<span style="color: #f92672;">-></span><span style="color: #a6e22e;">bindParam</span>(<span style="color: #e6db74;">':password'</span>, <span style="color: #a6e22e;">password_hash</span>($_POST[<span style="color: #e6db74;">'password'</span>], PASSWORD_BCRYPT));<br /><br /> <span style="color: #f92672;">if</span>($stmt<span style="color: #f92672;">-></span><span style="color: #a6e22e;">execute</span>())<span style="color: #f92672;">:<br /></span> $message <span style="color: #f92672;">= </span><span style="color: #e6db74;">'Successfully crated new user'</span>;<br /> <span style="color: #f92672;">else:<br /></span> $message <span style="color: #f92672;">= </span><span style="color: #e6db74;">'Sorry there must have been an issue to create an account!'</span>;<br /> <span style="color: #f92672;">endif</span>;<br /><br /><span style="color: #f92672;">endif</span>;<br /><br /><span style="color: #f92672;">?><br /></span></pre>
<p> </p>
<p>alright my bad , already find the answer below :)</p>
<p>To others finding same issue, the solution is simple to change:</p>
<pre class="language-php"><code>$stmt->bindParam(':email', $_POST['email']);
$stmt->bindParam(':password', password_hash($_POST['password'], PASSWORD_BCRYPT));</code></pre>
<p>to</p>
<pre class="language-php"><code>$email = $_POST['email'];
$password = password_hash($_POST['password'], PASSWORD_BCRYPT);
$stmt->bindParam(':email', $email); $stmt->bindParam(':password', $password);</code></pre>
Login scripts will always be really had to create from the different parts of the page in the You Tube channels. If problem from the references on the superiorpapers com website only be compact then register will be need only password and username.
I read that Post and got it fine and informative. Please share more like that...Great Article it it's really informative and innovative keep here:<a href="http://www.Anikadigital.com/"> Quality web design & development services london </a> with new updates. Its was really valuable. Thanks a lot.


