SQL File to PHP5 Classes (sql2class)

martes, 25 de noviembre de 2008 Albertux Sin comentarios

Archivo de SQL a Clases de PHP5 (sql2class)

(shell prompt) perl sql2class.pl database.sql > classes.php

Descargar sql2class-0.2.tar.gz sql2class-0.3.tar.gz

LLevo poco tiempo programando en Perl espero ampliar este script para que soporte otros lenguajes en un futuro

Con este post me despido del año 2008, hasta enero del 2009.

Categories: database Tags: , ,

C Compile on Demand

lunes, 24 de noviembre de 2008 Albertux Sin comentarios

C Compile on Demand

If you want to use C/C++ as CGI you need compile the code you can compile on demand check C Cod WebSite

See the Documentation some aspects similars to ASP(VBScript).

you now:

#!/usr/bin/php
#!/usr/bin/perl
#!/usr/bin/python
#!/bin/bash
...

Add this #!/usr/bin/ccod to use C/C++, one simple example:

#!/usr/bin/ccod
<?
   printf("Hello World\n");
?>

Download C Cod.

Categories: network, unix/linux, web, windows Tags: ,

PHP Access Control List (ACL)

jueves, 13 de noviembre de 2008 Albertux Sin comentarios

PHP Access Control List (ACL)

Hice un Access Control List para Funciones:

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.net
// 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;
	}
}

Como usarlo:

$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: security Tags:

Instant Boot (ASRock Inc)

miércoles, 12 de noviembre de 2008 Albertux Sin comentarios

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

lunes, 10 de noviembre de 2008 Albertux 5 comentarios

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

Algo interesante que encontre, es que ya existe un modulo php5-geoip que utiliza una base de datos de MaxMInd, ver GeoIP Database on MySQL.

Categories: unix/linux, web Tags: ,