Outlook Could’n access to IMAP/POP3

May 1st, 2017 by Nov Piseth No comments »

Email Client (outlook) Could not access to IMAP or POP3 (CentOS7 with Virtualmin)
I was found the problem when I installed CentOS 7.x 64bits with Virtualmin
( please search wiki for keywork virtualmin for more detail)
Error Found:

I was check the log on server with email log I found below error:

Apr 27 06:16:20 box185 dovecot: imap-login:
Login: user=<piseth.mydomain.com>, method=PLAIN,
rip=xx.xxx.xx.xx, lip=yy.yyy.yyy.yyy, mpid=5259, TLS, session=<ZTcbOB5OtQAxnC8O>
Apr 27 06:16:20 box185 dovecot: imap: Error: user piseth.mydomain.com:
Mail access for users with UID 501 not
permitted (see first_valid_uid in config file, uid from userdb lookup).
Apr 27 06:16:20 box185 dovecot: imap: Error: Invalid user settings.
Refer to server log for more information.

Solution:
I was logged in to root account of virtualmin and Click Webmin à
Servers à Dovecot IMAP/POP3 Server à User Login
and Options at option call Minimum valid UID change from 1000 to Default.

Note:

I think CentOS 6.x with Virtualmin have no problem.
this is my solution but you can find other solution better than this.

mysql gone away when import

March 24th, 2017 by Nov Piseth No comments »

I was faced with this problem in my local and I’m using xampp. I was found out that max_allowed_packet

original configuration for xampp is only 1MB. After I changed the setting and to 512M.

I work smoothly for import my database file *.sql to MySQL Server in local machine. It is very

basic useful for me and also share to everyone.

please enjoy below basic configuration for general you can customize with your own.


[mysqld]
port= 3306
socket = "F:/xampp/mysql/mysql.sock"
basedir = "F:/xampp/mysql"
tmpdir = "F:/xampp/tmp"
datadir = "F:/xampp/mysql/data"
pid_file = "mysql.pid"
# enable-named-pipe
key_buffer = 16M
max_allowed_packet = 256M
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error = "mysql_error.log"
general_log = 1
general_log_file = 'F:\xampp\mysql\data\general_log.log'

properties & pass variable form to php

March 22nd, 2016 by Nov Piseth No comments »

access private properties and pass
variable form to php part 2

The part one shown you guys about how to use extract method for converted

all post which submit by HTML form to array.

In this part I would present that bring variable from HTML

from with method=”POST” to list in

array and access private properties via method.

and you can see the new style of generated $_REQUEST:

function setvalue($key) {
if(isset($_REQUEST[$key])) echo $_REQUEST[$key];
}

if($_SERVER[‘REQUEST_METHOD’] == “POST”){
extract($_POST);

You can check below code for detail:

Cal1.php


<?php
class Cal1{

private $x;
private $y;

function __construct($a = NULL ,$b = NULL){
$this->x = $a;
$this->y = $b;
}

function sum() {
$sum = $this->x + $this->y;
return $sum;
}

function sub() {
return $this->x - $this->y;
}

function div() {
return $this->x / $this->y;
}

function mul() {
return $this->x * $this->y;
}

}
?>

Viewcal5.php

<?php
include ('libs/Cal1.php');
function setvalue($key) {
if(isset($_REQUEST[$key])) echo $_REQUEST[$key];
}
$result ="";
if($_SERVER['REQUEST_METHOD'] == "POST"){
extract($_POST);
$obj = new Cal1($a,$b);
$opt = end($_POST);
$o = array_search($opt,$_POST);
$result = $obj->{$o}();
}
?>
<!DOCTYPE html>
<head>
<title>Access to private properties</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
A: <input type="text" name="a" value="<?php setvalue("a");?>"><br />
B: <input type="text" name="b" value="<?php setvalue("b"); ?>"><br />
Result: <input type="text" value="<?php echo $result;?>" />
<input type="submit" name="sum" value="+" />
<input type="submit" name="sub" value="-" />
<input type="submit" name="mul" value="*" />
<input type="submit" name="div" value="/" />
</form>
</body>

access private properties and pass variable form to php part 1

March 17th, 2016 by Nov Piseth No comments »

access private properties and pass variable form to php part 1

Below code is how to access private class by its method and pass through variable in HTML form to PHP code.

First we need coding class and assign the name of the file called Cal1.php.

Second we create HTML from with some variables and try to pass its to php code using extract() method and assign the file called viewcal1.php.

  • extract() method is the method that abstract the global variable $_POST after submit to array key in php.

Finally, you can test your code

Cal1.php

Cal1.php

 

 

 

 

 

 

 

 

 

 

viewcal1

viewcal1

access to private properties or methods in class

March 4th, 2016 by Nov Piseth No comments »

This is the code instructed about how to access private properties by methong set and get (it is not related to magic method)

  • date_default_timezone_set(“Asia/Phnom_Penh”); it is php function to let us change our php time to our location time zone. example we are in Phnom Penh, Cambodia so we just this.
  • we have class Student and we have declared seven private properties. in case we want to set value to each properties we need to clear one method that received value from out (short example is setID($id)) after that if we want to get value of the properties at outside class we need to create the method get ( short example is getID().
    please have to check below example code for detail.
<?php
date_default_timezone_set("Asia/Phnom_Penh");
class Student {

private $id;
private $firstname;
private $lastname;
private $gender;
private $age;
private $dat;
private $classes;

function Student($classes){
$this->classes = "PHP OOP and Codeigniter";
$this->dat = date("d-m-Y h:i:s");
}

function getDate(){
return $this->dat;
}

function getClasses(){
return $this->classes;
}

function setId($id){
$this->id=$id;
return $this;
}

function getId() {
return $this->id;
}

function setFirstname($fname){
$this->firstname = $fname;
return $this;
}
function getFirstname(){
return $this->firstname;
}

function setLasttname($lname){
$this->lastname = $lname;
return $this;
}
function getLastname(){
return $this->lastname;
}

function setGender($gender){
$this->gender = $gender;
return $this;
}
function getGender(){
return $this->gender;
}

function setAge($age){
$this->age = $age;
return $this;
}
function getAge(){
return $this->age;
}
function getFullname(){
return $this->firstname." ".$this->lastname;
}

}

$obj = new Student();
echo $obj->setId("5678")->getID()."<br />";
$obj->setFirstname("NOV");
$obj->setLasttname("Piseth");
echo $obj->getFullname()."<br />";
echo $obj->setGender("Male")->getGender()."<br />";
echo $obj->setAge("35")->getAge()."<br />";
echo $obj->getClasses()."<br />";
echo $obj->getDate();
?>

WP2Social Auto Publish Powered By : XYZScripts.com