PHP Access Control List (ACL)

November 13th, 2008 No comments

PHP Access Control List (ACL)

I made this Access Control List for Functions:

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Author Albertux (Alberto Isaac Ayala Esquivias)
// E-mail: albertoi7@gmail.com
// Web: http://albertux.ayalasoft.com
// Class: Access Control List
 
class ACL {
	public $functions;
 
	public function acl_function($function,$status) {
		if (function_exists($function)) {
			if($status==0) {
				$this->functions[$function]=0;
			} else {
				$this->functions[$function]=1;
			}
		}
	}
 
	public function acl_methods_class($class,$value) {
		$class_methods = get_class_methods($class);
		foreach ($class_methods as $method_name) {
			$this->functions[$class.'::'.$method_name]=$value;
		}
	}
 
	public function acl_functions($functions) {
		foreach($functions as $function => $value) {
			$this->functions[$function]=$value;
		}
	}
 
	public function execute($function,$params=NULL)  {
		$output='';  
		if($this->functions[$function]==1) {
				$output = call_user_func_array($function, $params);
			} 
		return $output;
	}
}

HOWTO use:

$ACL = new ACL();
 
// Array Functions, 0 = don't execute, 1 = execute
$functions = array ("somefunction" => 0, "otherfunction" => 0, "anotherfunction" => 1);
 
// Add functions on ACL
$ACL->acl_functions($functions);
 
$params = array("param 1", "param 2", "param 3");
$ACL->execute('somefunction',$params); // don't execute because on functions array 'somefunction ' => 0
 
// Add or modify function access
$ACL->acl_function('somefunction',1);
$ACL->execute('somefunction',$params); // execute, now 'somefunction' => 1
 
// Put the functions of the class 
$ACL->acl_methods_class('SomeClass',1);
 
// Execute a method from class
$ACL->execute('SomeClass::demo', $params);
Categories: develop, security Tags:

Instant Boot (ASRock Inc)

November 12th, 2008 No comments

Instant Boot (ASRock Inc)

Instant Boot is a pretty cool product of ASRock Inc, you can boot on Windows Vista only in 4 seconds.

See the video:

Download (see the model of the motherboard).

Categories: hardware, windows Tags: ,

LAMP on Ubuntu 8.10 Desktop Edition

November 10th, 2008 5 comments

LAMP on Ubuntu 8.10 Desktop Edition

# LAMP on Ubuntu 8.10 desktop edition
sudo apt-get install mysql-server
# Set root password (MySQL)
sudo apt-get install apache2
# Install PHP as module
sudo apt-get install libapache2-mod-php5
# Support MySQL on PHP
sudo apt-get install php5-mysql
# Restart Apache server
sudo /etc/init.d/apache2 restart
# Test php5 on Apache2
sudo echo "<? phpinfo ?>" > ._info.php
sudo mv ._info.php /var/www/info.php
firefox http://localhost/info.php

GEOIP

Something I found interesting is that there is already a php5-geoip module that uses a database of MaxMInd, see GeoIP Database on MySQL.

Categories: develop, unix/linux, web Tags: ,

Saturday Morning Hacking

November 8th, 2008 No comments

Saturday Morning Hacking

Este sabado en la mañana (madrugada para mi) acompañe a mi tia a un curso de RNA (Redes Neuronales Artificiales) aplicadas a la valuacion (mi tia es Arquitecta)

Me meti a un ruter AirLink101 (pesimo password: admin) aburrido un poco empeze a jugar con la pagina de AINetSolutions, despues de un tiempo consegui el usuario y password de MySQL.

Aqui un screenshoot:

No modifique nada, solo estuve de observador.

Saludos a toda la raza del MHT, recordando viejas costumbres este dia.

Les mande un correo a los de AINetSolutions espero no se molesten por publicarlo en mi Blog.

Como medidas de seguridad siempre cambien el password del ruter nunca dejen el password que viene por defecto, de preferencia no utilizen conexiones remotas de MySQL o si las requieren utilizen un filtro de IP.

Categories: database, network, personal, security, web Tags: ,

Google App Engine

November 5th, 2008 No comments

Google App Engine

Downloads (http://code.google.com/appengine/downloads.html)

Google App Engine use Django, webob, yaml.

You need Python (http://www.python.org) (Python 2.5)

The configuration file app.yaml

There are two main Python scripts:

Video from the The Google Code Channel:

See the applications gallery

Google App Engine

Switch to our mobile site