Ameen_France wrote:[color=blue]
> Can anybody help me by giving some examples for classes in PHP. please
> provide me some simple and understandable classes examples.
> regards
> Ameen
>[/color]
Ameen_France wrote:[color=blue]
> Can anybody help me by giving some examples for classes in PHP. please
> provide me some simple and understandable classes examples.
> regards
> Ameen
>[/color]
They're very simliar to that of C++ really. You use the new keyword to
instanciate a class within an application, and class data is handled the
same way as in C++ (for the most part). If you know OO programming, a google
search should be all you need to write PHP classes (just to get the syntax
down).
"Ameen_Fran ce" <ameen.pondy@gm ail.com> wrote in message
news:1138340785 .566362.284920@ g44g2000cwa.goo glegroups.com.. .[color=blue]
> Can anybody help me by giving some examples for classes in PHP. please
> provide me some simple and understandable classes examples.
> regards
> Ameen
>[/color]
Ameen_France wrote:[color=blue]
> Can anybody help me by giving some examples for classes in PHP. please
> provide me some simple and understandable classes examples.
> regards
> Ameen
>[/color]
well do you have any experience with OO programming? If you do not you
might wanna pick up a OO book. You can even pick up a java or C++ book
and read the classes and objects chapter. PHP classes are based on these
languages anyway.
A class to encrypt, decrypt data! if you have problems with using it please
visit my site http://www.alexandrub.tk and mail me using Contact section! I
use it to encrypt POST and GET data! I don't remember his name but thanks to
how recognize his code in the binFromHex function!
<?php
//copyright www.alexandrub.tk
//ver 1.00
class cript {
var $key;
var $td;
var $time4keyToChan ge;
var $iv;
function cript($aKey='ti me',$aTime4keyT oChange=3600) { //constructor
$this->time4keyToChan ge=$aTime4keyTo Change;
if($aKey!='time ') {
$this->key=$aKey."&". intval(time()/$this->time4keyToChan ge);
} else {
$this->key=intval(tim e()/$this->time4keyToChan ge);
}
$this->td = MCRYPT_RIJNDAEL _256;
$this->iv = "qe3jigneqfrgnq w2egfmas4qetjkn 5lg";
}
function hexFromBin($dat a) {
return bin2hex($data);
}
function binFromHex($dat a) {
$len = strlen($data);
return pack("H" . $len, $data);
}
function criptData($data ) {
return $this->hexFromBin(mcr ypt_encrypt($th is->td, $this->key,
$data, MCRYPT_MODE_CBC , $this->iv));
}
function decriptData($eD ata) {
return trim(mcrypt_dec rypt($this->td, $this->key,
$this->binFromHex($eD ata), MCRYPT_MODE_CBC , $this->iv));
}
}
return true;
?>
Comment