Following my previous posts, I have been discussing about how to connect to the database and also how to create a sign-up system with php. And I can see you guys requested for more.

So today, I am here to complete that tutorial.
So today we'll be discussing on how to create login system using php.

as discussed before, you should know how to create $con variable.

I'll be using the variable here and I will not teach on how I did that.

Go back and read the post If you haven't.

But first week need to create the form to submit to the process login script.

<form>
<input type="text" name="username"><br />
<input type="password" name="password"><br />
<input type="submit" name="login"><br />
</form>

I think the last time we used "md5" to encrypt the password.

So we'll check the username and password if it's exist from the database.

< ? php
$name = mysqli_real_escape_string($conn,$_POST['username']);
$password = mysqli_real_escape_string($conn,$_POST['password']);

//The mysqli_real_escape_string is to remove the tags that can 
//destroy the website database.

//and so now we need to insert the data into the database.
//turing the password to the md5 encrypted string to match the 
//encrypted password we upload to the database with the sign up system.

$password = md5($password);

if(mysqli_query($conn,"select * from `users` where username='$username' AND password ='$password'"){
    echo 'Login set';
}
else {
    echo 'Login not set';
}

? >

I'll provide the materials soon.

if you have any question to this post, please comment it here and i would like to reply you as soon as possible.
Love you guys.

Following my previous posts, I have been discussing about [how to connect to the database](https://mrbarnk.com/t/26/how-to-connect-to-the-database-with-mysqli) and also [how to create a sign-up system with php](https://mrbarnk.com/t/27/how-to-create-a-signup-system-in-php-part-1). And I can see you guys requested for more. So today, I am here to complete that tutorial. So today we&#039;ll be discussing on how to create login system using php. as discussed before, you should know how to create $con variable. I&#039;ll be using the variable here and I will not teach on how I did that. Go back and read the post If you haven&#039;t. But first week need to create the form to submit to the process login script. ```` &lt;form&gt; &lt;input type=&quot;text&quot; name=&quot;username&quot;&gt;&lt;br /&gt; &lt;input type=&quot;password&quot; name=&quot;password&quot;&gt;&lt;br /&gt; &lt;input type=&quot;submit&quot; name=&quot;login&quot;&gt;&lt;br /&gt; &lt;/form&gt; ```` I think the last time we used &quot;md5&quot; to encrypt the password. So we&#039;ll check the username and password if it&#039;s exist from the database. ```` &lt; ? php $name = mysqli_real_escape_string($conn,$_POST[&#039;username&#039;]); $password = mysqli_real_escape_string($conn,$_POST[&#039;password&#039;]); //The mysqli_real_escape_string is to remove the tags that can //destroy the website database. //and so now we need to insert the data into the database. //turing the password to the md5 encrypted string to match the //encrypted password we upload to the database with the sign up system. $password = md5($password); if(mysqli_query($conn,&quot;select * from `users` where username=&#039;$username&#039; AND password =&#039;$password&#039;&quot;){ echo &#039;Login set&#039;; } else { echo &#039;Login not set&#039;; } ? &gt; ```` I&#039;ll provide the materials soon. if you have any question to this post, please comment it here and i would like to reply you as soon as possible. Love you guys.

#php, #js, #laravel, #jquery backend developer.

Share      

43
0
1
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft