/web/pass/sql/.functions.php.swp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/web/pass/sql/drivers/mysql/functions.php |
---|
0,0 → 1,136 |
<?php |
function da_sql_limit($limit,$point,$config) |
{ |
switch($point){ |
case 0: |
return ''; |
case 1: |
return ''; |
//modif by MG for Alcasar |
case 2: |
return "LIMIT $limit"; |
case 3: |
return "LIMIT $limit"; |
} |
} |
function da_sql_host_connect($server,$config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
if ($config[sql_connect_timeout] != 0) |
@ini_set('mysql.connect_timeout',$config[sql_connect_timeout]); |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
return @mysql_connect("$server:$config[sql_port]",$SQL_user,$SQL_passwd); |
} |
function da_sql_connect($config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
if ($config[sql_connect_timeout] != 0) |
@ini_set('mysql.connect_timeout',$config[sql_connect_timeout]); |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
return @mysql_connect("$config[sql_server]:$config[sql_port]",$SQL_user,$SQL_passwd); |
} |
function da_sql_pconnect($config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
if ($config[sql_connect_timeout] != 0) |
@ini_set('mysql.connect_timeout',$config[sql_connect_timeout]); |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
return @mysql_pconnect("$config[sql_server]:$config[sql_port]",$SQL_user,$SQL_passwd); |
} |
function da_sql_close($link,$config) |
{ |
return @mysql_close($link); |
} |
function da_sql_escape_string($string) |
{ |
return @mysql_escape_string($string); |
} |
function da_sql_query($link,$config,$query) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Query: <i>$query</i></b><br>\n"; |
return @mysql_db_query($config[sql_database],$query,$link); |
} |
function da_sql_num_rows($result,$config) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Num rows:: " . @mysql_num_rows($result) . "</b><br>\n"; |
return @mysql_num_rows($result); |
} |
function da_sql_fetch_array($result,$config) |
{ |
$row = array_change_key_case(@mysql_fetch_array($result, |
MYSQL_ASSOC),CASE_LOWER); |
if ($config[sql_debug] == 'true'){ |
print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: <pre>"; |
print_r($row); |
print "</b></pre>\n"; |
} |
return $row; |
} |
function da_sql_affected_rows($link,$result,$config) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Affected rows:: " . @mysql_affected_rows($result) . "</b><br>\n"; |
return @mysql_affected_rows($link); |
} |
function da_sql_list_fields($table,$link,$config) |
{ |
return @mysql_list_fields($config[sql_database],$table); |
} |
function da_sql_num_fields($fields,$config) |
{ |
return @mysql_num_fields($fields); |
} |
function da_sql_field_name($fields,$num,$config) |
{ |
return @mysql_field_name($fields,$num); |
} |
function da_sql_error($link,$config) |
{ |
return @mysql_error($link); |
} |
?> |
/web/pass/sql/drivers/oracle/functions.php |
---|
0,0 → 1,147 |
<?php |
// $Id$ |
function da_sql_limit($limit,$point,$config) |
{ |
switch($point){ |
case 0: |
return ''; |
case 1: |
return "AND ROWNUM <= $limit"; |
case 2: |
return ''; |
} |
} |
function da_sql_host_connect($server,$config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
$link = @ocilogon($SQL_user, $SQL_passwd, $config[sql_database]); |
$res = @da_sql_query($link,$config,"ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT='YYYY-MM-DD HH24:MI:SS.FF TZH:TZM'"); |
return $link; |
} |
function da_sql_connect($config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
$link = @ocilogon($SQL_user, $SQL_passwd, $config[sql_database]); |
$res = @da_sql_query($link,$config,"ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT='YYYY-MM-DD HH24:MI:SS.FF TZH:TZM'"); |
return $link; |
} |
function da_sql_pconnect($config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
$link = @ociplogon($SQL_user, $SQL_passwd, $config[sql_database]); |
$res = @da_sql_query($link,$config,"ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT='YYYY-MM-DD HH24:MI:SS.FF TZH:TZM'"); |
return $link; |
} |
function da_sql_close($link,$config) |
{ |
@ociclose($link); |
} |
function da_sql_escape_string($string) |
{ |
return addslashes($string); |
} |
function da_sql_query($link,$config,$query) |
{ |
$trimmed_query = rtrim($query, ";"); |
if ($config[sql_debug] == 'true') { |
print "<b>DEBUG(SQL,OCI DRIVER): Query: <i>$trimmed_query</i></b><br>\n"; |
} |
$statement = OCIParse($link,$trimmed_query); |
OCIExecute($statement); |
return $statement; |
} |
function da_sql_num_rows($statement,$config) |
{ |
// Unfortunately we need to fetch the statement as ocirowcount doesn't work on SELECTs |
$rows = OCIFetchStatement($statement,$res); |
if ($config[sql_debug] == 'true'){ |
print "<b>DEBUG(SQL,OCI DRIVER): Query Result: Num rows:: " . $rows . "</b><br>\n"; |
} |
// Unfortunately we need to re-execute because the statement cursor is reset after OCIFetchStatement :-( |
OCIExecute($statement); |
return $rows; |
} |
function da_sql_fetch_array($statement,$config) |
{ |
OCIFetchInto($statement, $temprow, OCI_ASSOC); |
$row = array_change_key_case($temprow, CASE_LOWER); |
if ($config[sql_debug] == 'true') { |
print "<b>DEBUG(SQL,OCI DRIVER): Query Result: <pre>"; |
print_r($row); |
print "</b></pre>\n"; |
} |
return $row; |
} |
function da_sql_affected_rows($link,$statement,$config) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,OCI DRIVER): Query Result: Affected rows:: " . @ocirowcount($statement) . "</b><br>\n"; |
return @ocirowcount($statement); |
} |
function da_sql_list_fields($table,$link,$config) |
{ |
$res = @da_sql_query($link,$config,"SELECT * from $table WHERE ROWNUM <=1"); |
if ($res){ |
$fields[res]=Array(); |
for ($i = 1;$i<=ocinumcols($res);$i++) { |
array_push($fields[res],strtolower(OCIColumnName($res,$i))); |
} |
$fields[num]=@ocinumcols($res); |
}else{ |
return NULL; |
} |
return $fields; |
} |
function da_sql_num_fields($fields,$config) |
{ |
return $fields[num]; |
} |
function da_sql_field_name($fields,$num,$config) |
{ |
return $fields[res][$num]; |
} |
function da_sql_error($link,$config) |
{ |
return ocierror($link); |
} |
?> |
/web/pass/sql/drivers/pg/functions.php |
---|
0,0 → 1,154 |
<?php |
function da_sql_limit($limit,$point,$config) |
{ |
switch($point){ |
case 0: |
return ''; |
case 1: |
return ''; |
case 2: |
return "LIMIT $limit"; |
} |
} |
function da_sql_host_connect($server,$config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,PG DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
return @pg_connect("host=$server port=$config[sql_port] |
dbname=$config[sql_database] user=$SQL_user |
password=$SQL_passwd"); |
} |
function da_sql_connect($config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,PG DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
return @pg_connect("host=$config[sql_server] port=$config[sql_port] |
dbname=$config[sql_database] user=$SQL_user |
password=$SQL_passwd"); |
} |
function da_sql_pconnect($config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,PG DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
return @pg_pconnect("host=$config[sql_server] port=$config[sql_port] |
dbname=$config[sql_database] user=$SQL_user |
password=$SQL_passwd"); |
} |
function da_sql_close($link,$config) |
{ |
@pg_close($link); |
} |
function da_sql_escape_string($string) |
{ |
return addslashes($string); |
} |
function da_sql_query($link,$config,$query) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,PG DRIVER): Query: <i>$query</i></b><br>\n"; |
return @pg_query($link,$query); |
} |
function da_sql_num_rows($result,$config) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,PG DRIVER): Query Result: Num rows:: " . @pg_numrows($result) . "</b><br>\n"; |
return @pg_numrows($result); |
} |
function da_sql_fetch_array($result,$config) |
{ |
$row = @pg_fetch_array($result,$config[tmp_pg_array_num][$result]++,PGSQL_ASSOC); |
if ($row && $config[sql_debug] == 'true'){ |
print "<b>DEBUG(SQL,PG DRIVER): Query Result: <pre>"; |
print_r($row); |
print "</b></pre>\n"; |
} |
if (!$row) |
$config[tmp_pg_array_num][$result] = 0; |
return $row; |
} |
function da_sql_affected_rows($link,$result,$config) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,PG DRIVER): Query Result: Affected rows:: " . @pg_cmdtuples($result) . "</b><br>\n"; |
return @pg_cmdtuples($result); |
} |
function da_sql_list_fields($table,$link,$config) |
{ |
$res = @pg_query($link, |
"select count(*) from pg_attribute where attnum > '0' and |
attrelid = (select oid from pg_class where relname='$table');"); |
if ($res){ |
$row = @pg_fetch_row($res,0); |
if ($row){ |
if (!$row[0]) |
return NULL; |
$fields[num] = $row[0]; |
} |
} |
$res = @pg_query($link, |
"select attname from pg_attribute where attnum > '0' and |
attrelid = (select oid from pg_class where relname='$table');"); |
if ($res) |
$fields[res]=$res; |
else |
return NULL; |
return $fields; |
} |
function da_sql_num_fields($fields,$config) |
{ |
if ($fields) |
return $fields[num]; |
} |
function da_sql_field_name($fields,$num,$config) |
{ |
if ($fields){ |
$row = @pg_fetch_row($fields[res],$num); |
if ($row) |
return $row[0]; |
} |
} |
function da_sql_error($link,$config) |
{ |
return pg_errormessage($link); |
} |
?> |
/web/pass/sql/drivers/sqlrelay/functions.php |
---|
0,0 → 1,193 |
<?php |
function da_sql_limit($limit,$point,$config) |
{ |
switch($point){ |
case 0: |
return ''; |
case 1: |
return ''; |
case 2: |
return "LIMIT $limit"; |
} |
} |
function da_sql_host_connect($server,$config) |
{ |
$retrytime = 0; |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
if ($config[sql_connect_timeout] != 0) |
$retrytime = $config[sql_connect_timeout]; |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,SQLRELAY DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
$link[con] = @sqlrcon_alloc($server,$port,'',$SQL_user,$SQL_passwd,$retrytime,1); |
if ($link[con]){ |
$link[cur] = @sqlrcur_alloc($link[con]); |
if ($link[cur]) |
return $link; |
else |
return 0; |
} |
else |
return 0; |
} |
function da_sql_connect($config) |
{ |
$retrytime = 0; |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
if ($config[sql_connect_timeout] != 0) |
$retrytime = $config[sql_connect_timeout]; |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,SQLRELAY DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
$link[con] = @sqlrcon_alloc($config[sql_server],$config[sql_port],'',$SQL_user,$SQL_passwd,$retrytime,1); |
if ($link[con]){ |
$link[cur] = @sqlrcur_alloc($link[con]); |
if ($link[cur]) |
return $link; |
else |
return 0; |
} |
else |
return 0; |
} |
function da_sql_pconnect($config) |
{ |
$retrytime = 0; |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
if ($config[sql_connect_timeout] != 0) |
$retrytime = $config[sql_connect_timeout]; |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,SQLRELAY DRIVER): Connect: Host=$config[sql_server],Port=$config[sql_port],User=$SQL_user,Password=$SQL_passwd </b><br>\n"; |
$link[con] = sqlrcon_alloc($config[sql_server],$config[sql_port],'',$SQL_user,$SQL_passwd,$retrytime,1); |
if ($link[con]){ |
sqlrcon_debugOn($link[con]); |
$link[cur] = sqlrcur_alloc($link[con]); |
if ($link[cur]){ |
sqlrcur_setResultSetBufferSize($link[cur], 4); |
sqlrcur_lowerCaseColumnNames($link[cur]); |
return $link; |
} |
else |
return false; |
} |
else{ |
return false; |
} |
} |
function da_sql_close($link,$config) |
{ |
if (sqlrcur_free($link[cur])) |
return sqlrcon_free($link[con]); |
else |
return 0; |
} |
function da_sql_escape_string($string) |
{ |
return addslashes($string); |
} |
function da_sql_query($link,$config,$query) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,SQLRELAY DRIVER): Query: <i>$query</i></b><br>\n"; |
if (sqlrcur_sendQuery($link[cur],$query)){ |
sqlrcon_endSession($link[con]); |
$link[count] = sqlrcur_rowCount($link[cur]); |
return $link; |
} |
else{ |
return false; |
} |
} |
function da_sql_num_rows($result,$config) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,SQLRELAY DRIVER): Query Result: Num rows:: " . @sqlrcur_rowCount($result[cur]) . "</b><br>\n"; |
return sqlrcur_rowCount($result[cur]); |
return 0; |
} |
function da_sql_fetch_array($result,$config) |
{ |
static $counter = 0; |
if ($counter < $result[count]){ |
$row = sqlrcur_getRowAssoc($result[cur],$counter); |
$counter++; |
} |
else{ |
$counter = 0; |
return false; |
} |
if ($config[sql_debug] == 'true'){ |
print "<b>DEBUG(SQL,SQLRELAY DRIVER): Query Result: <pre>"; |
} |
return $row; |
} |
function da_sql_affected_rows($link,$result,$config) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,SQLRELAY DRIVER): Query Result: Affected rows:: " . @sqlrcur_affectedRows($result[cur]) . "</b><br>\n"; |
return sqlrcur_affectedRows($result[cur]); |
} |
function da_sql_list_fields($table,$link,$config) |
{ |
if (sqlrcur_sendQuery($link[cur],"SELECT * FROM $table WHERE 1 = 0;")){ |
sqlrcon_endSession($link[con]); |
return $link[cur]; |
} |
else |
return false; |
} |
function da_sql_num_fields($fields,$config) |
{ |
return sqlrcur_colCount($fields); |
} |
function da_sql_field_name($fields,$num,$config) |
{ |
return sqlrcur_getColumnName($fields,$num); |
} |
function da_sql_error($link,$config) |
{ |
return sqlrcur_errorMessage($link[cur]); |
} |
?> |
/web/pass/sql/drivers/dbx/functions.php |
---|
0,0 → 1,146 |
<?php |
function da_sql_limit($limit,$point,$config) |
{ |
switch($point){ |
case 0: |
return ''; |
case 1: |
return ''; |
case 2: |
return "LIMIT $limit"; |
} |
} |
function da_sql_host_connect($server,$config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
// FIXME: This function is still Postgres specific. Needs to be configurable. |
return @dbx_connect(DBX_PGSQL, "$server", "$config[sql_database]", |
"$SQL_user", "$SQL_passwd", DBX_PERSISTENT); |
} |
function da_sql_connect($config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
// FIXME: This function is still Postgres specific. Needs to be configurable. |
return @dbx_connect(DBX_PGSQL, "$server", "$config[sql_database]", |
"$SQL_user", "$SQL_passwd"); |
} |
function da_sql_pconnect($config) |
{ |
if ($config[sql_use_http_credentials] == 'yes'){ |
global $HTTP_SERVER_VARS; |
$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"]; |
$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"]; |
} |
else{ |
$SQL_user = $config[sql_username]; |
$SQL_passwd = $config[sql_password]; |
} |
// FIXME: This function is still Postgres specific. Needs to be configurable. |
return @dbx_connect(DBX_PGSQL, "$server", "$config[sql_database]", |
"$SQL_user", "$SQL_passwd", DBX_PERSISTENT); |
} |
function da_sql_close($link,$config) |
{ |
@dbx_close($link); |
} |
function da_sql_escape_string($string) |
{ |
return addslashes($string); |
} |
function da_sql_query($link,$config,$query) |
{ |
if ($config[sql_debug] == 'true') { |
print "<b>DEBUG(SQL,PG DRIVER): Query: <i>$query</i></b><br>\n"; |
} |
return @dbx_query($link,$query); |
} |
function da_sql_num_rows($result,$config) |
{ |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,PG DRIVER): Query Result: Num rows:: " . $result->rows . "</b><br>\n"; |
return $result->rows; |
} |
$dbx_global_record_counter = array() ; |
function da_sql_fetch_array($result,$config) |
{ |
global $dbx_global_record_counter; |
if (!$dbx_global_record_counter[$result->handle]){ |
$dbx_global_record_counter[$result->handle] = 0; |
} |
if ($dbx_global_record_counter[$result->handle] <= $result->rows - 1 ){ |
return $result->data[$dbx_global_record_counter[$result->handle]++]; |
} elseif ($dbx_global_record_counter[$result->handle] > $result->rows - 1 ) { |
$dbx_global_record_counter[$result->handle]++; |
return NULL; |
} else { |
$dbx_global_record_counter[$result->handle]++; |
return FALSE; |
} |
} |
function da_sql_affected_rows($link,$result,$config) |
{ |
// FIXME: This function is still Postgres specific. |
if ($config[sql_debug] == 'true') |
print "<b>DEBUG(SQL,PG DRIVER): Query Result: Affected rows:: " . @pg_cmdtuples($result->handle) . "</b><br>\n"; |
return @pg_cmdtuples($result->handle); |
} |
function da_sql_list_fields($table,$link,$config) |
{ |
$res = @dbx_query($link,"SELECT * FROM ".$table." LIMIT 1 ;"); |
if ($res){ |
$fields[num] = $res->cols; |
} |
$res = @dbx_query($link,"SELECT * FROM ".$table." LIMIT 1 ;"); |
if ($res) |
$fields[res] = $res->info[name]; |
else |
return NULL; |
return $fields; |
} |
function da_sql_num_fields($fields,$config) |
{ |
if ($fields) |
return $fields[num]; |
} |
function da_sql_field_name($fields,$num,$config) |
{ |
if ($fields) |
return $fields[res][$num]; |
} |
function da_sql_error($link,$config) |
{ |
return dbx_error($link); |
} |
?> |
/web/pass/crypt/crypt.php |
---|
0,0 → 1,14 |
<?php |
function da_encrypt() |
{ |
$numargs=func_num_args(); |
$passwd=func_get_arg(0); |
# calcul d'un salt pour forcer le chiffrement en MD5 au lieu de blowfish par defaut dans php versin mdva > 2007.1 |
$salt='$1$passwd$'; |
if ($numargs == 2){ |
$salt=func_get_arg(1); |
return crypt($passwd,$salt); |
} |
return crypt($passwd,$salt); |
} |
?> |
/web/pass/crypt/md5.php |
---|
0,0 → 1,6 |
<?php |
function da_encrypt($passwd) |
{ |
return md5($passwd); |
} |
?> |
/web/pass/crypt/clear.php |
---|
0,0 → 1,6 |
<?php |
function da_encrypt($passwd) |
{ |
return $passwd; |
} |
?> |
/web/pass/index.php |
---|
0,0 → 1,141 |
<?php |
# change user password on Alcasar captive Portal |
# Copyright (C) 2003, 2004 Mondru AB. |
# Copyright (C) 2008-2009 ANGEL95 & REXY |
require('/etc/freeradius-web/config.php'); |
$current_page = $_SERVER['PHP_SELF']; |
# Choice of language |
$Language = 'fr'; |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); |
$Language = strtolower(substr(chop($Langue[0]),0,2)); } |
if($Language == 'es'){ |
$R_title = "User password change"; |
$R_form_l1 = "User"; |
$R_form_l2 = "Old password"; |
$R_form_l3 = "New password"; |
$R_form_l4 = "New password (confirmation)"; |
$R_form_button = "Modify"; |
$R_form_result1 = "Your password has been successfuly changed"; |
$R_form_result2 = "Error when trying to change password"; |
} |
if($Language == 'de'){ |
$R_title = "User password change"; |
$R_form_l1 = "User"; |
$R_form_l2 = "Old password"; |
$R_form_l3 = "New password"; |
$R_form_l4 = "New password (confirmation)"; |
$R_form_button = "Modify"; |
$R_form_result1 = "Your password has been successfuly changed"; |
$R_form_result2 = "Error when trying to change password"; |
} |
if($Language == 'nl'){ |
$R_title = "User password change"; |
$R_form_l1 = "User"; |
$R_form_l2 = "Old password"; |
$R_form_l3 = "New password"; |
$R_form_l4 = "New password (confirmation)"; |
$R_form_button = "Modify"; |
$R_form_result1 = "Your password has been successfuly changed"; |
$R_form_result2 = "Error when trying to change password"; |
} |
if($Language == 'en'){ |
$R_title = "User password change"; |
$R_form_l1 = "User"; |
$R_form_l2 = "Old password"; |
$R_form_l3 = "New password"; |
$R_form_l4 = "New password (confirmation)"; |
$R_form_button = "Modify"; |
$R_form_result1 = "Your password has been successfuly changed"; |
$R_form_result2 = "Error when trying to change password"; |
} |
if($Language == 'fr'){ |
$R_title = "Changement de mot de passe utilisateur"; |
$R_form_l1 = "Utilisateur"; |
$R_form_l2 = "Ancien mot de passe"; |
$R_form_l3 = "nouveau mot de passe"; |
$R_form_l4 = "nouveau mot de passe (confirmation)"; |
$R_form_button = "Modifier"; |
$R_form_result1 = "Votre mot de passe a été modifié avec succès"; |
$R_form_result2 = "Erreur de changement de mot de passe"; |
} |
echo " |
<html> |
<head> |
<title>$R_title</title> |
<meta http-equiv=\"Cache-control\" content=\"no-cache\"> |
<meta http-equiv=\"Pragma\" content=\"no-cache\"> |
<link rel=\"stylesheet\" href=\"/css/style.css\" type=\"text/css\"> |
</head> |
<body> |
<center> |
<table border=0 width=400 cellpadding=0 cellspacing=2> |
<tr> |
<td> |
<form name=\"master\" action=\"$current_page\" method=\"post\"> |
<input type=hidden name=action value=checkpass> |
<br> |
<table border=0 width=540 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor=\"black\" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor=\"#907030\" align=right valign=top><th> |
<font color=\"white\">$R_title</font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor=\"black\" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor=\"#ffffd0\" valign=top> |
<tr><td> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor=\"#ffffe0\" valign=top> |
<tr><td align=center bgcolor=\"#d0ddb0\">$R_form_l1</td><td><input type=\"text\" name=\"login\" value=\"\"></td></tr> |
<tr><td align=center bgcolor=\"#d0ddb0\">$R_form_l2</td><td><input type=\"password\" name=\"passwd\" value=\"\"></td></tr> |
<tr><td align=center bgcolor=\"#d0ddb0\">$R_form_l3</td><td><input type=\"password\" name=\"newpasswd\" value=\"\"></td></tr> |
<tr><td align=center bgcolor=\"#d0ddb0\">$R_form_l4</td><td><input type=\"password\" name=\"newpasswd2\" value=\"\"> <input type=\"submit\" class=button value=\"$R_form_button\"></td></tr> |
</table> |
</table> |
</table>"; |
if (is_file("sql/drivers/$config[sql_type]/functions.php")) |
include_once("sql/drivers/$config[sql_type]/functions.php"); |
else{ |
echo "<b>Could not include SQL library</b><br>\n"; |
exit(); |
} |
if (isset($action)){ |
if ($action == 'checkpass'){ |
$link = @da_sql_pconnect($config); |
if ($link){ |
$res = @da_sql_query($link,$config, |
"SELECT attribute,value FROM $config[sql_check_table] WHERE username = '$login' |
AND attribute = '$config[sql_password_attribute]';"); |
if ($res){ |
$row = @da_sql_fetch_array($res,$config); |
if (is_file("crypt/$config[general_encryption_method].php")){ |
include("crypt/$config[general_encryption_method].php"); |
$enc_passwd = $row['value']; |
$passwd = da_encrypt($passwd,$enc_passwd); |
$newpasswd = da_encrypt($newpasswd,$enc_passwd); |
$newpasswd2 = da_encrypt($newpasswd2,$enc_passwd); |
if (($passwd == $enc_passwd) and ($newpasswd == $newpasswd2)){ |
$msg = '<font color=blue><b>'.$R_form_result1.'</b></font>'; |
$res2 = @da_sql_query($link,$config, |
"UPDATE $config[sql_check_table] set value='$newpasswd' WHERE username = '$login' |
AND attribute = '$config[sql_password_attribute]';");} |
else |
$msg = '<font color=red><b>'.$R_form_result2.'</b></font>'; |
} |
else |
echo "<b>Could not open encryption library file</b><br>\n"; |
} |
} |
echo "<tr><td colspan=3 align=center>$msg</td></tr>\n"; |
} |
} |
?> |
</body> |
</html> |