1673374140
Sign-in with Ethereum using MetaMask, PHP, JWT, and MySQL/PostgreSQL.
The concept of such user authentication system (initially based on this article) is as follows: The backend provides a random message for the user to sign it with his or her MetaMask wallet. The signed message is then returned to the backend, together with the user's public Ethereum address. Having the message
, the same message signed by the user
and user's public address
, the backend can perform some cryptographic magic in order to know if the message was signed with the same private key to which the public address
belongs. The public address
also works as a username to identify the user's account. If the signed message
and public address
belong to the same private key, it means that the user who is trying to log in is also the owner of the account.
After the successful validation, the backend creates a JSON Web Token (JWT) and sends it to the frontend to authenticate the further user requests.
The "Public name" input field (visible after the successful login) is just an example showing how to update user's metadata using JWT. When entered by the user, this field is stored in the db and loaded the next time the user logs in.
The cryptographic magic mentioned above is done using Elliptic Curve Cryptography and Keccak (SHA-3) libraries. The necessary parts of these libraries are bundled into the source of this repository, but if you wish, you can install them separately using Composer. Keccak requires PHP version 7.1.0 or higher.
To launch the demo app provided in this repository, first download all files. Then put them in your remote or local PHP + MySQL/PostgreSQL server's public html directory. Create an empty database, edit credentials in backend/config.php
and then open create_db_table.php
in your browser. Then open index.html
.
To add this to your website or a web app:
config.php
file with your database credentials and then run create_db_table.php
to create the required database table.backendPath
JavaScript variable.your-app.domain/php-metamask-user-login
in your browser. There should be a fully working demo login screen.index.html
file as a reference when building your own user login UI/UX.Report issues in issue tracker.
Feel free to make a pull request or suggest ideas.
Demo: https://setinblock.com/php-metamask-user-login
Author: giekaton
Source code: https://github.com/giekaton/php-metamask-user-login
License: MIT license
#metamask #php #Web3 #blockchain #bitcoin
1598427973
complete login system php mysql. Here, i will show you how to build complete login system in php mysql using session.
And as well as how to create login page, user profile page in php with database and validation.
https://www.tutsmake.com/login-system-in-php-mysql-source-code-with-validation/
#login system php source code #simple login page in php with database source code #login page in php with database and validation #simple login form in php with mysql database #php login session
1673374140
Sign-in with Ethereum using MetaMask, PHP, JWT, and MySQL/PostgreSQL.
The concept of such user authentication system (initially based on this article) is as follows: The backend provides a random message for the user to sign it with his or her MetaMask wallet. The signed message is then returned to the backend, together with the user's public Ethereum address. Having the message
, the same message signed by the user
and user's public address
, the backend can perform some cryptographic magic in order to know if the message was signed with the same private key to which the public address
belongs. The public address
also works as a username to identify the user's account. If the signed message
and public address
belong to the same private key, it means that the user who is trying to log in is also the owner of the account.
After the successful validation, the backend creates a JSON Web Token (JWT) and sends it to the frontend to authenticate the further user requests.
The "Public name" input field (visible after the successful login) is just an example showing how to update user's metadata using JWT. When entered by the user, this field is stored in the db and loaded the next time the user logs in.
The cryptographic magic mentioned above is done using Elliptic Curve Cryptography and Keccak (SHA-3) libraries. The necessary parts of these libraries are bundled into the source of this repository, but if you wish, you can install them separately using Composer. Keccak requires PHP version 7.1.0 or higher.
To launch the demo app provided in this repository, first download all files. Then put them in your remote or local PHP + MySQL/PostgreSQL server's public html directory. Create an empty database, edit credentials in backend/config.php
and then open create_db_table.php
in your browser. Then open index.html
.
To add this to your website or a web app:
config.php
file with your database credentials and then run create_db_table.php
to create the required database table.backendPath
JavaScript variable.your-app.domain/php-metamask-user-login
in your browser. There should be a fully working demo login screen.index.html
file as a reference when building your own user login UI/UX.Report issues in issue tracker.
Feel free to make a pull request or suggest ideas.
Demo: https://setinblock.com/php-metamask-user-login
Author: giekaton
Source code: https://github.com/giekaton/php-metamask-user-login
License: MIT license
#metamask #php #Web3 #blockchain #bitcoin
1660835433
In this tutorial we will show you how to create password protected webpage using PHP, HTML and CSS.
In this user have to write correct password to see the webpage content without password user will not be able to see the webpage content.
We make a PHP file and save it with a name password.php
<?php
session_start();
if(isset($_POST['submit_pass']) && $_POST['pass'])
{
$pass=$_POST['pass'];
if($pass=="123")
{
$_SESSION['password']=$pass;
}
else
{
$error="Incorrect Pssword";
}
}
if(isset($_POST['page_logout']))
{
unset($_SESSION['password']);
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="password_style.css">
</head>
<body>
<div id="wrapper">
<?php
if($_SESSION['password']=="123")
{
?>
<h1>Create Password Protected Webpage Using PHP, HTML And CSS</h1>
<form method="post" action="" id="logout_form">
<input type="submit" name="page_logout" value="LOGOUT">
</form>
<?php
}
else
{
?>
<form method="post" action="" id="login_form">
<h1>LOGIN TO PROCEED</h1>
<input type="password" name="pass" placeholder="*******">
<input type="submit" name="submit_pass" value="DO SUBMIT">
<p>"Password : 123"</p>
<p><font style="color:red;"><?php echo $error;?></font></p>
</form>
<?php
}
?>
</div>
</body>
</html>
In this step we first check if user logged in or not by checking session variable if the user is not logged in we display login form and if user is logged in we display webpage content with logout button.
We use two isset() condition to do login or logout.In first condition we simply get the password and check if the password is '123' if yes we put the password in session variable and then display the webpage.
In second condition we simply unset the session variable which stores password value. You may also like simple http authentication using PHP .
We make a CSS file and save it with a name password_style.css
body
{
margin:0 auto;
padding:0px;
text-align:center;
width:100%;
font-family: "Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
background-color:#8A4B08;
}
#wrapper
{
margin:0 auto;
padding:0px;
text-align:center;
width:995px;
}
#wrapper h1
{
margin-top:50px;
font-size:45px;
color:white;
}
#wrapper p
{
font-size:16px;
}
#logout_form input[type="submit"]
{
width:250px;
margin-top:10px;
height:40px;
font-size:16px;
background:none;
border:2px solid white;
color:white;
}
#login_form
{
margin-top:200px;
background-color:white;
width:350px;
margin-left:310px;
padding:20px;
box-sizing:border-box;
box-shadow:0px 0px 10px 0px #3B240B;
}
#login_form h1
{
margin:0px;
font-size:25px;
color:#8A4B08;
}
#login_form input[type="password"]
{
width:250px;
margin-top:10px;
height:40px;
padding-left:10px;
font-size:16px;
}
#login_form input[type="submit"]
{
width:250px;
margin-top:10px;
height:40px;
font-size:16px;
background-color:#8A4B08;
border:none;
box-shadow:0px 4px 0px 0px #61380B;
color:white;
border-radius:3px;
}
#login_form p
{
margin:0px;
margin-top:15px;
color:#8A4B08;
font-size:17px;
font-weight:bold;
}
1597820991
Looking to develop a PHP based website from scratch or revamp your existing website?
HourlyDeveloper.io has always been an industry leader for companies and business owners looking to hire PHP web developer. By choosing to Hire PHP Developer from our company, you can always expect the best results. Our PHP services and solutions are always flexible which means that no matter the nature of your project, you can always count on us for getting the best PHP expertise.
Consult with our experts: https://bit.ly/3aEGxPy
#hire php developer #php developer #php development company #php development services #php development #php
1617276472
A framework that can drastically cut down the requirement to write original code to develop the web apps as per your requirement is PHP Framework. PHP frameworks offer code libraries for commonly used functions to reduce the development time.
Want to use PHP Web Frameworks for your web applications?
WebClues Infotech offers a service to hire dedicated PHP developers for all of the below-mentioned frameworks
Not sure which framework to use for your PHP web application?
Schedule Interview with PHP Developer https://bit.ly/3dsTWf0
Email: sales@webcluesinfotech.com
#hire php developer #hire php web developers #hire php developer in 2021 #hire php developers & dedicated php programmers #hire php developers india #hire and outsource freelance php developers