🐘 PHP Database MySql decrypted password

wow magic. sa inserting mo ba nilagay ?
oo

<?php
require_once '../includes/database.php';
//----------------------SIGN UP / REGISTER NEW USER FUNCTIONS ---------------------------------------//
function createUser($conn, $usertype, $email, $fullname, $password, $contact, $address){
session_start();
$Pwd = $password;
$sql = "INSERT INTO users (user_type, email, full_name, user_password, user_contact, user_address) VALUES (?,?,?,?,?,?);";
if(!$stmt = $conn->prepare($sql)){
echo '
<script>
alert("Something went wrong. Please try again.")
</script>';
}
$stmt->bind_param("ssssss", $usertype, $email, $fullname, $Pwd, $contact, $address);
$stmt->execute();
$trail_user = $_SESSION["full_name"];
$trail_utype = $_SESSION["user_type"];
$trail_ip = $_SERVER['REMOTE_ADDR'];
$trail_action = "Created new account";
$trail_date = date('Y-m-d H:i:s');
$trail_time = date("H:i:sa");
recordTrail($conn, $trail_user, $trail_utype, $trail_ip, $trail_action, $trail_date, $trail_time);
echo '
<script>
alert("Successful Sign Up")
location.replace("../layouts/register.php")
</script>';

}

pag bagong user na yung magccreate ng account, di na hash yung masesave dyan sa db mo
pero kung yung mga lumang user then naglogin, di sila makakalogin kasi hash != plain text na password :)
balak ko sana yung old password is naka decrpted din
 
ayaw parin makita yung passoword lods naka encrypted parin
function createUser($conn, $usertype, $email, $fullname, $password, $contact, $address){

echo mo muna lahat nung pinapasa mo.
return 0;
ka nalang after ng echo tapos check mo kung yung password ba e plaintext
 
The code you provided appears to be a bcrypt hash. Bcrypt is a password hashing function designed to be computationally intensive to resist brute-force attacks. It is not possible to decrypt a bcrypt hash back to the original plaintext because bcrypt is a one-way hashing algorithm.

However, you can verify if a given plaintext matches the bcrypt hash.

Here is an example in Python using the bcrypt library:

Python:
import bcrypt

# The bcrypt hash you provided
hashed_password = b"$2y$10$MTYBqd/.Kwu8EXuGz904SeyAXoePpXfwLRgtPrAAwtGvnkGQnpLwq"

# The plaintext password you want to verify
plaintext_password = b"your_password_here"

# Check if the plaintext password matches the hashed password
if bcrypt.checkpw(plaintext_password, hashed_password):
    print("Password matches")
else:
    print("Password does not match")

Replace your_password_here with the plaintext password you want to check against the hash.

To install the bcrypt library, you can use pip:

Code:
pip install bcrypt

Remember, bcrypt is designed to be a one-way function so you can only verify passwords not decrypt them.
 
The code you provided appears to be a bcrypt hash. Bcrypt is a password hashing function designed to be computationally intensive to resist brute-force attacks. It is not possible to decrypt a bcrypt hash back to the original plaintext because bcrypt is a one-way hashing algorithm.

However, you can verify if a given plaintext matches the bcrypt hash.

Here is an example in Python using the bcrypt library:

Python:
import bcrypt

# The bcrypt hash you provided
hashed_password = b"$2y$10$MTYBqd/.Kwu8EXuGz904SeyAXoePpXfwLRgtPrAAwtGvnkGQnpLwq"

# The plaintext password you want to verify
plaintext_password = b"your_password_here"

# Check if the plaintext password matches the hashed password
if bcrypt.checkpw(plaintext_password, hashed_password):
    print("Password matches")
else:
    print("Password does not match")

Replace your_password_here with the plaintext password you want to check against the hash.

To install the bcrypt library, you can use pip:

Code:
pip install bcrypt

Remember, bcrypt is designed to be a one-way function so you can only verify passwords not decrypt them.
muntik na sayang. php daw boss d python hehe
 
function createUser($conn, $usertype, $email, $fullname, $password, $contact, $address){

echo mo muna lahat nung pinapasa mo.
return 0;
ka nalang after ng echo tapos check mo kung yung password ba e plaintext
ayaw parin lods
<?php
require_once '../includes/database.php';
//----------------------SIGN UP / REGISTER NEW USER FUNCTIONS ---------------------------------------//
function createUser($conn, $usertype, $email, $fullname, $password, $contact, $address){
session_start();
$plainPwd = $password; // Store the password directly (NOT recommended for production use)
$sql = "INSERT INTO users (user_type, email, full_name, user_password, user_contact, user_address) VALUES (?,?,?,?,?,?);";
if(!$stmt = $conn->prepare($sql)){
return "Something went wrong. Please try again.";
}
 
muntik na sayang. php daw boss d python hehe
Bangag ako ngayon sorry haha.

To verify a bcrypt hash in PHP, you can use the password_verify function. Here is an example of how you can do this:

PHP:
<?php
// The bcrypt hash you provided
$hashed_password = '$2y$10$MTYBqd/.Kwu8EXuGz904SeyAXoePpXfwLRgtPrAAwtGvnkGQnpLwq';

// The plaintext password you want to verify
$plaintext_password = 'your_password_here';

// Verify the password
if (password_verify($plaintext_password, $hashed_password)) {
    echo "Password matches";
} else {
    echo "Password does not match";
}
?>

Replace 'your_password_here' with the plaintext password you want to check against the hash.

Explanation:
  • password_verify($plaintext_password, $hashed_password) is used to check if the provided plaintext password matches the hashed password.
  • If the password matches, it will print "Password matches"; otherwise, it will print "Password does not match".

Additional Information:
  • The password_verify function is compatible with crypt(), so it can verify hashes created by crypt() as well.
  • The password_hash function can be used to create a new bcrypt hash if needed.

This method ensures that you can securely verify passwords without needing to decrypt the hash, which is not possible with bcrypt.

Tinatamad ako mag display ng citation
 
ayaw parin lods
<?php
require_once '../includes/database.php';
//----------------------SIGN UP / REGISTER NEW USER FUNCTIONS ---------------------------------------//
function createUser($conn, $usertype, $email, $fullname, $password, $contact, $address){
session_start();
$plainPwd = $password; // Store the password directly (NOT recommended for production use)
$sql = "INSERT INTO users (user_type, email, full_name, user_password, user_contact, user_address) VALUES (?,?,?,?,?,?);";
if(!$stmt = $conn->prepare($sql)){
return "Something went wrong. Please try again.";
}
function createUser($conn, $usertype, $email, $fullname, $password, $contact, $address){
echo $conn. $usertype. $email. $fullname. $password. $contact. $address;
return 0;
session_start();
$plainPwd = $password; // Store the password directly (NOT recommended for production use)
$sql = "INSERT INTO users (user_type, email, full_name, user_password, user_contact, user_address) VALUES (?,?,?,?,?,?);";
if(!$stmt = $conn->prepare($sql)){
return "Something went wrong. Please try again.";
}

PA COPY PASTE TAPOS PA SEND KUNG ANONG RESULT DITO SALAMAT
 
function createUser($conn, $usertype, $email, $fullname, $password, $contact, $address){
echo $conn. $usertype. $email. $fullname. $password. $contact. $address;
return 0;
session_start();
$plainPwd = $password; // Store the password directly (NOT recommended for production use)
$sql = "INSERT INTO users (user_type, email, full_name, user_password, user_contact, user_address) VALUES (?,?,?,?,?,?);";
if(!$stmt = $conn->prepare($sql)){
return "Something went wrong. Please try again.";
}

PA COPY PASTE TAPOS PA SEND KUNG ANONG RESULT DITO SALAMAT
ayaw parin lods password did not macth
 
The code you provided appears to be a bcrypt hash. Bcrypt is a password hashing function designed to be computationally intensive to resist brute-force attacks. It is not possible to decrypt a bcrypt hash back to the original plaintext because bcrypt is a one-way hashing algorithm.

However, you can verify if a given plaintext matches the bcrypt hash.

Here is an example in Python using the bcrypt library:

Python:
import bcrypt

# The bcrypt hash you provided
hashed_password = b"$2y$10$MTYBqd/.Kwu8EXuGz904SeyAXoePpXfwLRgtPrAAwtGvnkGQnpLwq"

# The plaintext password you want to verify
plaintext_password = b"your_password_here"

# Check if the plaintext password matches the hashed password
if bcrypt.checkpw(plaintext_password, hashed_password):
    print("Password matches")
else:
    print("Password does not match")

Replace your_password_here with the plaintext password you want to check against the hash.

To install the bcrypt library, you can use pip:

Code:
pip install bcrypt

Remember, bcrypt is designed to be a one-way function so you can only verify passwords not decrypt them.
nabigla ako python ang sagot
Pero hinahanap ang php ahaha
 

About this Thread

  • 44
    Replies
  • 2K
    Views
  • 11
    Participants
Last reply from:
Arcturus

Trending Topics

Online now

Members online
318
Guests online
1,133
Total visitors
1,451

Forum statistics

Threads
2,273,577
Posts
28,950,440
Members
1,235,838
Latest member
Bogs0811
Back
Top