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();
?>

php class and it properties

March 4th, 2016 by Nov Piseth No comments »

In this step I would like to show some identify php class and it properties also identify object of the class as below:

  • class person is identify the class name
  • var $name; var $age; var $gender is proerties of the class person
  • $obj = new Person(); identify variable $obj as object of class Person
  • so $obj can access all properties and method in class person

<?php
class Person {
var $name;
var $age;
var $gender;
}
$obj = new Person();

$obj->name ="Dara";
$obj->age = 15;
$obj->gender = "Male";

echo "Person Name: $obj->name <br />";
echo "Person Age: $obj->age <br />";
echo "Person Gender: $obj->gender <br />";
?>

Enjoy your cloud storage file anywhere anytime with Gmail Drive.

December 11th, 2011 by Nov Piseth No comments »

What is Gmail Drive?

Gmail Drive is shell extension software that allows to connect from your computer through to your Gmail account for store your data anytime anywhere. In my opinion it is use as like dropbox. For detail information please check  http://en.wikipedia.org/wiki/GMail_Drive.

1. Requirement

You have to create gmail account. Example: pisethnov at gmail dot com

2. Download Gmail Drive as link below

http://majorgeeks.com/GMail_Drive_d4405.html (download  and use with your own risk. If want to make sure that is virus or not please check my post at http://pis3th.info/personal/2010/10/06/online-virus-scan/)

3. Install it with file setup.exe

 4. You will see a new drive(Gmail Drive) appear under My Computer in explorer.

 5. Right click on Gmail Drive and click on Login As

6. And fill out information login of your Gmail account

 Enjoy your cloud storage file anywhere anytime.

P.S: using this tutorial with your own risk.

Open God Mode in Windows 7

December 11th, 2011 by Nov Piseth No comments »

Introduction

God Mode is trick to show all windows setting under one click without needing to browse options and folders in the Control Panel.
1.Create a new folder.
2.Rename the folder to GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}  (you can change the name GodMode to any name as you wish) but remember not to change the text after GodMode.

This the trick to help you setting your windows. Please use with your own risk.

Facebook Auto Publish Powered By : XYZScripts.com