Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* @author Mahesh EU <mahesh@nintriva.com>
* @copyright 2017 Nintriva Technology solutions
* PHP version < 7.1
*/
include('SecurityAES.php');
$value = "<service_id>#" . strtotime('NOW') * 1000;
$key = "<preshared>"; //16 Character Key
<?php
/**
* @author Mahesh EU <mahesh@nintriva.com>
* @copyright 2017 Nintriva Technology solutions
* PHP version < 7.1
*/
class SecurityAES {
public static function encrypt($input, $key) {
$size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
@francis22
francis22 / gist:f485ec20986f20da64c1b9405c59d842
Created August 16, 2016 08:00 — forked from kewogc/gist:1d679c6c83977d69106f
HOW TO INSTALL KANNEL ON UBUNTU
~# uname -a
~# lsb_release -a
~# locale-gen en_US
~# locale-gen en_US.UTF-8
~# apt-get -y --force-yes remove ntpdate
~# apt-get -y --force-yes install ntp
~# /etc/init.d/ntp restart
~# dpkg-reconfigure tzdata
#base lcoation
RewriteBase /webroot/
#RewriteCond $1 ^(admin/.*) this will check whether location(url) start with admin/
RewriteCond $1 ^(admin/.*)
#RewriteRule ^regular expression$ newlcoation/$1 ($1 string matched in condition)
RewriteRule ^(webroot/www/admin/.*)$ webroot/www/index-test.php/$1
#RewriteRule Flags
RewriteRule ^(.*)$ webroot/www/index-test.php [L]
<?php
public function accessRules() {
return array(
/* rest of permission */
array('allow',
'actions'=>array('details','update'),
'roles'=>array('updateOwnBiz','editor'),
),
array('allow',
<?php
$auth=Yii::app()->authManager
$auth->assign('admin',Yii::app()->user->id);
//here admin is privilege or role not user
// instead of Yii::app()->user->id you can give the id of user to whom role is need to be assign
//so we can assign permission to each user.
//We can check permission or role of user by
if(Yii::app()->user->checkAccess('deleteBiz'),Yii::app()->user->id);
<?php
'components'=>array(
/*.
restof body
.*/
'authManager'=>array(
'class'=>'CDbAuthManager',
'connectionID'=>'db',
// 'assignmentTable’=>'tbl_authassignment',
// 'itemTable’=>'tbl_authitem',
<?php
Yii::app()->clientScript->registerScript('likefun',
"jQuery('body').undelegate('#like1','click').delegate(
'#like1','click',jQuery.ajax({'success':function(data){
$('#like1').html(data);
},
'url':'".$url."',
'cache':false
});return false;});",
CClientScript::POS_LOAD);
<?php
CHtml::ajaxLink('label',array('url'),
array(
// 'dataType'=>'json',
'success'=>'js:function(data){
$("#divId").html(data);
}',
),
array('class'=>'like','id'=>'like1')
);
<?php
CHtml::ajaxLink('label',array('url'),
array(
'update'=>'#divId'
),
array('class'=>'like','id'=>'like1')
);
?>