Saturday, January 28, 2012

REpresentational State Transfer(REST) and security

What is REST?
Client sends a request to the server witch responds with a representation of required informational Object.This respond usually formatted in JSON or XML.

A RESTful service normally provides two
components in its responses, the response body itself and a status code.Most of the REST servers allow users to specify a response format by sending ACCEPT parameter or by specifying a file extension.Others have hard-coded response formats.

Security Aspects

By Accepting certain data type,certain length and validating each request.

Authenticating/Authorizing requests : by making developers to register for a API key and validate key against the stored key for that particular developer.

by having quotas and data limits

finally by using SSL to encrypt communication.

Tuesday, March 22, 2011

making multiple db connection handles


$handle_db1 = mysql_connect(hostname_and_port,user,password);
$handle_db2 = mysql_connect(hostname_and_port,user,password);

mysql_select_db("db1",$handle_db1);
mysql_select_db("db2",$handle_db2);

$query1 = "select * from one";
$query2 = "select * from two";

mysql_query($query1,$handle_db1);
mysql_query($query2,$handle_db2);

?>

stream editing shell/php

place var1,var2,.... inside common file tempale.xml which u need to add values automatically,
eg :- config file with 2 variables, user_name=VAR1 and path=VAR2

inside php file,

$username='udara';
$path='/var/www/mobsync';
$create='cat tempale.xml | sed -e "s/VAR1/'.$username.'/g" | sed -e "s/VAR2 /'.$path.'/g" > template_new.xml';
exec($create);