[PHP] one problem in php ext development

2012-02-20 Thread Rui Hu
hi,

I want to development an extension which can do something by using HTTP
request header.  So how can php extension get those HTTP request headers?

Thanks!

Best regards,

Rui Hu

State Key Laboratory of Networking  Switching Technology
Beijing University of Posts and Telecommunications(BUPT)
MSN: tchrb...@gmail.com
-


[PHP] Re: problems in extension development

2012-02-17 Thread Rui Hu
Besides, are there some APIs I can use if I want to setget environment
variables like DOCUMENT_ROOT in my extension(similar to
sapi_cgienv_get/set).

Thanks!

2012/2/17 Rui Hu tchrb...@gmail.com

 hi,

 I just started to write a simple PHP extension hello, but encountered
 some problems. I followed tutorials step by step:
 1. ./ext_skel --extname=hello
 2. modified hello.c and php_hello.h, and wrote function hello_world()
 which simply return a string hello world.
 3. phpize
 4. ./configure ; make ;
 5. the I encountered error in make. I looked up in Makefile and found that
 $(PHP_MODULE) is null, which I think is the reason. Makefile is
 automatically generated by ./configure.

 What mistake did I make? How to fix it?

 Thanks!
 Vic Hu


 --
 Best regards,

 Rui Hu

 
 State Key Laboratory of Networking  Switching Technology
 Beijing University of Posts and Telecommunications(BUPT)
 MSN: tchrb...@gmail.com

 -





-- 
Best regards,

Rui Hu

State Key Laboratory of Networking  Switching Technology
Beijing University of Posts and Telecommunications(BUPT)
MSN: tchrb...@gmail.com
-


[PHP] problems in extension development

2012-02-16 Thread Rui Hu
hi,

I just started to write a simple PHP extension hello, but encountered
some problems. I followed tutorials step by step:
1. ./ext_skel --extname=hello
2. modified hello.c and php_hello.h, and wrote function hello_world() which
simply return a string hello world.
3. phpize
4. ./configure ; make ;
5. the I encountered error in make. I looked up in Makefile and found that
$(PHP_MODULE) is null, which I think is the reason. Makefile is
automatically generated by ./configure.

What mistake did I make? How to fix it?

Thanks!
Vic Hu


-- 
Best regards,

Rui Hu

State Key Laboratory of Networking  Switching Technology
Beijing University of Posts and Telecommunications(BUPT)
MSN: tchrb...@gmail.com
-


[PHP] questions about fastcgi

2011-12-19 Thread Rui Hu
hi,

I encountered a problem while configured virtual host. My experiment
environment is Apache2+fastcgi+php-cgi.

I want to implement mass virtual hosting using rewrite rules based on
apache rewrite module. That is, for a request url like:
http://1000.xyz.com/test.php, apache will translate it to a absolute file
path like: $DOCUMENT_ROOT/1000/test.php, and then get this script to
execute.

And my conf is:
*RewriteEngine On*
*RewriteCond %{HTTP_HOST} !^www.xyz.com*
*RewriteCond %{HTTP_HOST} ^([^.]+)\.xyz\.com [NC]*
*RewriteRule (.*) /%1$1 [PT]*
I use inner redirection in order not to expose this detail to users.
Besides, I succeeded when I use external redirection, namely the [R] tag
instead of [PT] tag.
When I use [PT] tag, apache cannot run expectedly. I request a url :
http://1000.xyz.com/test.php, error message pops out like: The requested
URL /1000/cgi-bin/php.fcgi/1000/test.php was not found on this server.

I don't know if this error results from fastcgi, is it the inappropriate
config in fastcgi or inevitable problem by using it?

Really appreciate your help.

Vic

-- 
Best regards,

Rui Hu

State Key Laboratory of Networking  Switching Technology
Beijing University of Posts and Telecommunications(BUPT)
MSN: tchrb...@gmail.com
-


[PHP] SNMP Functions

2008-11-27 Thread Rui Quelhas
Hello guys, i'm running php on Leopard 10.5.5 with native php and snmp
builds. I was hoping someone could tell me how can i activate the php snmp
in order to use the snmp functions. I've searched everywhere for this but i
didn't find anything usefull. Appreciate any kind of answer.
Regards
Rui Quelhas


[PHP] PECL HTTP Extension

2008-11-13 Thread Rui Quelhas
Following the previous messages, my situation resumes in something like
this. The Extension must be properly installed because the file appears in
the correct path, so it must be something missing in the apache
configuration file ('httpd.conf') or in the php inicialization file
('php.ini'). Could someone please describe me every step i need to take and
everything i need to change in this files when i'm installing a php
extension for the first time and assuming that the php.ini is actually the
native php inicialization file on Leopard ('php.ini.default'), i think that
maybe a little especific crash-course can solve all my problems. Someone
please...
Regards

Rui Quelhas


[PHP] PECL HTTP Extension

2008-11-13 Thread Rui Quelhas
Since i'm not obtaining any kind of response from people o first answered
me. I guess is better to talk through here.
To my first message, Micah Gersten asked me if i've placed the extension
path on 'php.ini' my answer was yes, i've tried to do that but it still
wasn't loading the extension. Jochem Maas advised me to place the complete
path to the extension like this
'extension=/usr/lib/php/extensions/no-debug-non-zts-20060613/http.so',
i've also tried it, again with no success.
In the last response, Thodoris told me to place in the php.ini the line
'extension_dir=.;/usr/lib/php/extensions/no-debug-non-zts-20060613;/usr/lib/php/modules',
adding again the extension directive 'extension=http.so'. Well, seems like
there is no such path like '/usr/lib/php/modules', for the sound of it, the
closest match i get is '/usr/include/php/ext/' (path with the header files
of each extension) or '/usr/libexec/apache2' (path also with '.so' files
regarding apache modules). Either way, i've changed the unexisting path by
each one of these and again nothing happened. I don't know what else i can
do. Could somebody that has installed PECL extensions successfuly on Leopard
help me? I just need to know what i must do in the inicialization files (php
or apache) just like i was installing my first extension and having the fact
that there is the native Leopard 'php.ini.default' already in place.

Regards

Rui Quelhas


[PHP] PECL HTTP Extension

2008-11-12 Thread Rui Quelhas
 Hi guys. I'm running PHP 5.2.6 (cli) on Mac OS X 10.5.5 and i've  
tried to install and configure the http pecl extension like the  
tutorial in your web site, i've used pecl to install it, i've also  
tried to compile it manually. Everything got installed correctly,  
there is the http.so file in the extensions dir (/usr/lib/php/ 
extensions/no-debug-non-zts-20060613/), the path is loaded by php/ 
apache and i've added the line extension=http.so in php.ini file.  
However the extension isn't loaded by php. I've wrote a simple script   
that uses extension_loaded('http') function and i get a false  
response. I need to use desperatly functions like http_request(...)  
for a college project so i would appreciate a quick response from you.


 If you could just provide me with a more specific Leopard tutorial  
tha would be great.


 Giving an antecipated thank you for any kind of answer.

 Regards, and keep up the good work!

 Rui Quelhas

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php broken pipe

2004-11-16 Thread Rui Francisco
Hi,
i'm using firebird 1.5.1 on a linux machine with a php script
I'm using a query in loop and go through all records to do some operations
in the middle of the script i fork(); to do other things
When i return to the parent process i try to make one update and i get 
the following error
[nativecode=Unable to complete network request to host 127.0.0.1. 
Error writing data to the connection. Broken pipe]

And continue the loop of the records of the query.
Is this a regular beaviour ?  How can it be solved ?
I'm using Pear DB for database access.
Thank you in advance
Rui Francisco
--
Rui Francisco - [EMAIL PROTECTED]
FCCN - Fundação para a Computação Científica Nacional
Av. Brasil, 101  1700-066 Lisboa - Portugal
Tel: +351 218440100   Fax: +351 218472167
-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Shell_exec timeout question

2004-11-11 Thread Rui Francisco
HI,
Does anybody know if its possible to execute a command through exec, 
shell exec, system  and if the program doesn't terminate in N seconds 
returns control to PHP ?

Thanks in advance
Rui Francisco
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Shell Script error

2004-11-10 Thread Rui Francisco
Hi,
I have a small problem with a PHP script with Pear DB
The problem is the following: I'm creating a shell script in  PHP that
access one interbase database.
The problem is that if i run it on a webserver the script run correctly
but if i runit in the command line it reports one error (DB Error:
connect failed).
Does anybody know what is the problem ?
Thanks in advance
Rui Francisco
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Shell Script error

2004-11-10 Thread Rui Francisco
Its a simple script
$_SERVER['utilizador']='user';
$_SERVER['pass']='pass';
$_SERVER['host']='localhost or IP address';
$_SERVER['db_name']='c:/path/dbname.fdb';
include_once('DB.php');
$dsn=ibase://.$_SERVER['utilizador'].:.$_SERVER['pass'].@.$_SERVER['host']./.$_SERVER['db_name'];
   $ligacaoBD=DB::connect($dsn);
   if (DB::isError($ligacaoBD)) {
   die($ligacaoBD-getMessage());
   }
The user has admin right on the database, and the database doesn't 
implement security measures like Mysql for access from other hosts.

The problem is that if i run the script on the browser it works, but on 
the command line on Windows machine it doesn't work

Thanks in advance
Rui Francisco
Angelo Zanetti wrote:
well maybe you are trying to connect to localhost which could be fine
for the server but not from commandline... send more info.
 

Rui Francisco [EMAIL PROTECTED] 11/10/2004 2:06:09 PM 
   

Hi,
I have a small problem with a PHP script with Pear DB
The problem is the following: I'm creating a shell script in  PHP that
access one interbase database.
The problem is that if i run it on a webserver the script run
correctly
but if i runit in the command line it reports one error (DB Error:
connect failed).
Does anybody know what is the problem ?
Thanks in advance
Rui Francisco
 


--
Rui Francisco - [EMAIL PROTECTED]
FCCN - Fundação para a Computação Científica Nacional
Av. Brasil, 101  1700-066 Lisboa - Portugal
Tel: +351 218440100   Fax: +351 218472167
- 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Is PHP a good language to work with images?

2004-05-26 Thread Rui Silva
Hello!
 
I need to print an image file, but I'm having some problems. 
I have a handler to a printer witch I can print text correctly with the
printer_write function. 
I can also print an image if it is in bmp format (printer_draw_bmp),
however, I want to print png files.
 
$im = imagecreatefrompng($url)
$handler = printer_open(PATH_TO_PRINTER);
if($handler){
printer_write($handler,$im);
printer_close($handler);
}
else{
//ERROR
}
 
In this example I can't print, because printer_write function just
prints text.
How can I print an image file?
 
Thank you!
 


[PHP] Printing images

2004-05-25 Thread rui . silva
Hello!

I need to print an image file, but I’m having some problems. 
I have a handler to a printer witch I can print text correctly with the 
printer_write function. 
I can also print an image if it is in bmp format (printer_draw_bmp), however, 
I want to print png files.
How can I do it?

Thank you!


__
Quanto gasta de Acesso à Internet? Faça as contas!
http://acesso.portugalmail.pt/contas

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP 4.3 unable to load php_domxml.dll in WinXP Apache 2.0.43

2002-12-29 Thread Rui Costa
hi,

Windows XP, Apache 2.0.43(Win32) with PHP 4.3 can't load DLL
'php_domxml.dll'.
it pops-up: Unknown(): unable to load dll'C:\php\extensions\php_domxml.dll'
if I use the old 'php_domxml.dll' from PHP 4.2.4, it works fine. I'm using
libxml2-2.4.30, expat 1.95.4.

by the way, 'libxml2.dll' is not packed in the PHP 4.3 Windows distribution,
although it mentions that it does in the PHP documentation.

thanks in advance
rui



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] how to display a file's last updated time using php?

2002-05-23 Thread Rui Huang

Hi, friends,

I want to display the last updated time of a file using php,
but I don't know which function I should use. It seems that
the date() just show the current time. 

For html file, a simple javascript works well, but in php files 
that script works weired. How to solve that problem?

Thanks a lot.





_
Do You Yahoo!?
Get your free yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] sessions problems :/

2001-08-31 Thread Rui Barreiros



i'm sorry if the solution to this problem was posted here before, but if it 
was i couldn't find it.

i have an app that it's basically like this:

index.php:

$app = new App;
$app-start();

in class app:

function start() {
()
session_start();

if($need_auth) {
global $auth; /* another class */
if(!isset($auth)) {
$auth = new auth;
session_register(auth);
}
$auth-start();
}
()
}

my question is, the auth class get's registered, and the auth array inside 
the auth class ($auth-auth[]) get his values recorded on the first attempt, 
but, if the user tries again, it doesn't refresh the session data, oh i'm 
using my session functions to write them on a mysql db, i've been debugging, 
and i can see all the queries that the session stores in the db through 
syslog, and for instance in $auth-start() if i change any variable like 
$this-auth[username]=$username; the data field passed to my 
session_write() still has the first value not $username instead.

another question is, at what time of the script does php call my 
session_write function to update the registered session?!

thanks all
-- 
Rui Barreiros
   Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] writing while reading

2001-08-01 Thread Rui Barreiros


hi all,

i'm writing a web chat, the frame that presents the text, has a very fast 
refresh (has to) it's about from 2 in 2 seconds, my problem is writing to the 
file (chat is file based), when the refresh read the file, it doesn't let php 
write. i made comething like this.

Function chat2file($filename, $str) {
  $fp = fopen(chats/$filename, a);
  fputs($fp, $str);
  close($fp);
}

Function file2chat($filename) {
  if(file_exists(chats/$filename)) {
$fd = fopen(chats/$filename, r);
flock($fd, LOCK_UN);
$content = fread($fd, filesize(chats/$filename));
fclose($fd);
return $content;
  } else {
return ;
  }
}

i put the non blocking option in flock while reading but still blocks and 
doesn't write, my question is it possible to write to a file while reading?!, 
if so how?

thx.

-- 
Rui Barreiros
   Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Compile .php file is possible ?

2001-03-30 Thread rui


i found a way, it's not the best secure thing, and best code obfuscator at all,
but it will keep mosta part of the curious nose out of your code, use APC
cache, it creates cache files encoded you can then use the encoded files, but
you as always need to use they're static object loaded to read the files.

About the php compiler, due to a lot of work, that project i intended to do is
suspended, but if anyone likes to start thinking about it, all that you need to
make a compiler is in the zend engine distributed with the php source, all the
parsing etc is there, so all that you need is to make a encoder of the result
after being parsed from the zend engine, then a decoder for php.

And again, all this is based on 'snooping around' zend engine src code, it may
not be that simple, or, it can be even more simple :)

On 30-Mar-2001 Jack Dempsey wrote:
 you can use the zend encoder (www.zend.com) but it costs over $2000, so
 this may not be viable...but, for right now, i believe that's the only
 way to compile php code...
 
 -jack
 
 Marian Vasile wrote:
 
 I need a method to compile my php files to give them to a customer.
 
 The main problem is that this customer have an account on a shared hosting
 service and (I think) he can't install a compiler or something new on that
 server.
 
 Is it possible to encrypt my files ?
 
 Plz HELP ASAP
 
 Yours,
 Marian
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

   Rui Barreiros
  Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/dbx dbx.c dbx_pgsql.c dbx_pgsql.h php_dbx.h

2001-03-23 Thread Rui Hirokawa
php/dbx/license/1_00.txt. |
   | If you did not receive a copy of the STENTOR license and are unable  |
   | to obtain it through the world-wide-web, please send a note to   |
   | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
   +--+
   | Author : Rui Hirokawa[EMAIL PROTECTED]  |
   +--+
 */

#include "dbx.h"
#include "php_dbx.h"
#include "dbx_pgsql.h"
#include string.h

#ifdef ZTS
extern int dbx_globals_id;
#else
extern ZEND_DBX_API zend_dbx_globals dbx_globals;
#endif

#define PGSQL_ASSOC 10
#define PGSQL_NUM   11

int dbx_pgsql_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** 
password, INTERNAL_FUNCTION_PARAMETERS) {
/* returns connection handle as resource on success or 0 
   as long on failure */
int nargs=5;
char *port="5432", *connstring=NULL;
zval **args[5], *rarg = NULL;
zval *conn_zval = NULL;
zval *returned_zval=NULL;

MAKE_STD_ZVAL(conn_zval);

if (Z_STRLEN_PP(username)0  Z_STRLEN_PP(password)0){
int len;

len = Z_STRLEN_PP(host)+Z_STRLEN_PP(db)+strlen(port);
len += Z_STRLEN_PP(username)+Z_STRLEN_PP(password)+35;
connstring = (char *)emalloc(len+1);
sprintf(connstring, "host=%s port=%s dbname=%s user=%s password=%s",
Z_STRVAL_PP(host),port, Z_STRVAL_PP(db),
Z_STRVAL_PP(username), Z_STRVAL_PP(password));
ZVAL_STRING(conn_zval, connstring, 1);
args[0] = conn_zval;
nargs = 1;
} else {
int k;

args[0] = host;
for (k=1;k4;k++){
MAKE_STD_ZVAL(rarg);
ZVAL_EMPTY_STRING(rarg);
args[k] = rarg;
}
args[4] = db;
}
dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_connect", 
returned_zval, nargs, args); 

if (!returned_zval || returned_zval-type!=IS_RESOURCE) {
if (returned_zval) zval_ptr_dtor(returned_zval);
return 0;
}
MOVE_RETURNED_TO_RV(rv, returned_zval);

return 1;
}

int dbx_pgsql_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** 
password, INTERNAL_FUNCTION_PARAMETERS) {
/* returns persistent connection handle as resource on success or 0 
   as long on failure */
int nargs=5;
char *port="5432", *connstring=NULL;
zval **args[5], *rarg = NULL;
zval *conn_zval = NULL;
zval *returned_zval=NULL;

MAKE_STD_ZVAL(conn_zval);

if (Z_STRLEN_PP(username)0  Z_STRLEN_PP(password)0){
int len;

len = Z_STRLEN_PP(host)+Z_STRLEN_PP(db)+strlen(port);
len += Z_STRLEN_PP(username)+Z_STRLEN_PP(password)+35;
connstring = (char *)emalloc(len+1);
sprintf(connstring, "host=%s port=%s dbname=%s user=%s password=%s",
Z_STRVAL_PP(host),port, Z_STRVAL_PP(db),
Z_STRVAL_PP(username), Z_STRVAL_PP(password));
ZVAL_STRING(conn_zval, connstring, 1);
args[0] = conn_zval;
nargs = 1;
} else {
int k;

args[0] = host;
for (k=1;k4;k++){
MAKE_STD_ZVAL(rarg);
ZVAL_EMPTY_STRING(rarg);
args[k] = rarg;
}
args[4] = db;
}
dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_pconnect", 
returned_zval, nargs, args);

if (!returned_zval || returned_zval-type!=IS_RESOURCE) {
if (returned_zval) zval_ptr_dtor(returned_zval);
return 0;
}
MOVE_RETURNED_TO_RV(rv, returned_zval);

return 1;
}

int dbx_pgsql_close(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS) {
/* returns 1 as long on success or 0 as long on failure */
int number_of_arguments=1;
zval ** arguments[1];
zval * returned_zval=NULL;

arguments[0]=dbx_handle;
dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_close", 
returned_zval, number_of_arguments, arguments);
if (!returned_zval || returned_zval-type!=IS_BOOL) {
if (returned_zval) zval_ptr_dtor(returned_zval);
return 0;
}
MOVE_RETURNED_TO_RV(rv, returned_zval);
return 1;
}

int dbx_pgsql_query(zval ** rv, zval ** dbx_handle, zval ** sql_statement, 
INTERNAL_FUNCTION_PARAMETERS) {
/* returns 1 as long or a result identifier as resource on success  
   or 0 as long on failure */
int nargs=2;
z

Re: [PHP] URIs as variables

2001-03-22 Thread rui


try this

$myurl=urlencode(base64_encode($url));

in the input type

echo "INPUT TYPE=\"HIDDEN\" NAME=\"url\"
VALUE=".urldecode(base64_decode($myurl)."";



On 22-Mar-2001 Issac Goldstand wrote:
 Nope.  That gave me:
 
 INPUT TYPE="HIDDEN" NAME="url" VALUE="script2.php?var1=ab"
 
 I'd need to enumerate $HTTP_GET_VARS variable _keys_ too, but I don't know
 how...
 Also, how can I get it to work for both GET  POST methods?  Is that
 possible?
 
 Thanks,
   Issac
 
 ""almir"" [EMAIL PROTECTED] wrote in message
 99b66u$q0o$[EMAIL PROTECTED]">news:99b66u$q0o$[EMAIL PROTECTED]...
 try with

 uri=? echo implode("", $HTTP_GET_VARS);?


 ""Issac Goldstand"" [EMAIL PROTECTED] schrieb im Newsbeitrag
 99at42$5be$[EMAIL PROTECTED]">news:99at42$5be$[EMAIL PROTECTED]...
  Newbie question here.  I am trying to pass a varaible containing a URI
  across a few scripts.  Basically, the first script get's a query string
  including the URI (eg
  http://foo.bar/script1.php?url=script2.php?var1=avar2=b).
  Now, script1 contains a form pointing to script3 so basically, I have
 the
  user form and then:
 
  ?
  echo "INPUT TYPE=\"HIDDEN\" NAME=\"url\" VALUE=\"$url\"";
  ?
 
  (I have register-gloabls enabled and am not sure whether the call to
 script1
  will be POST or GET)
 
  This creates a slight problem, as, using the above example once again,
 PHP
  will send the browser the line:
 
  INPUT TYPE="HIDDEN" NAME="url" VALUE="script2.php?var1=a"
 
  But it totally chops off everything from the "" and onwards.  How can I
 fix
  it to get the entire URI?
 
  Thanks,
  Issac
 
 
  --
  Internet is a wonderful mechanism for making a fool of
  yourself in front of a very large audience.
--Anonymous
 
  Moving the mouse won't get you into trouble...  Clicking it might.
--Anonymous
 
  PGP Key 0xE0FA561B - Fingerprint:
  7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

   Rui Barreiros
  Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] please help with this simple problem

2001-03-22 Thread rui


you haven't specified the open type (a = append, w = write, r = read only , etc
etc)

solution

$fp=fopen(basename($fname), "a");

just to match your example.

On 22-Mar-2001 adam wrote:
 i tryed it and it ended up having an error that was caused originally by a
 lack of a $ on the 3rd line variable... after i fixed that it said wrong
 perameter count for fopen() on the third line, and "Warning: Supplied
 argument is not a valid File-Handle resource" for the remaining lines below
 that in that block of code.
 
 i'm sorry, i'm kinda new to this : (
 
 "Stewart Taylor" [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You need to copy the contents of the current file.
 Then recreate the file by writing the new message then writing back the
 original contents.

 e.g.
 $fname = basename($PHP_SELF). ".comment";
 $fsize = filesize($fname);
 fp = fopen(basename($fname));
 $data = fread($fp,fsize);
 fwrite($fp,$message);
 fwrite($fp,$data);
 fclose($fp);

 -Stewart

 -Original Message-
 From: adam [mailto:[EMAIL PROTECTED]]
 Sent: 22 March 2001 11:17
 To: [EMAIL PROTECTED]
 Subject: [PHP] please help with this simple problem


 i am coding a simple script to post a text area into a file. it works, but
 it posts it at the bottom and i wanted to have it post to the top of the
 text already there..

 here's a snip of the important part of the script:

 $fp = fopen (basename($PHP_SELF) . ".comment", "a");
  fwrite ($fp, $message);
  fclose ($fp);
  }

 any help would be much appreciated



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

   Rui Barreiros
  Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Source Protection

2001-03-19 Thread rui


I Agree with that,
Take the same atitude as mysql.
AFAIK, zend encoder is not only for hidding code, but (they say) it
optimizes php processing, if that is true, it is a good and enough reason to
release it for free for users that do open source projects.

you can still publish the original source code, and also, if you like,
compile php for production environments where the load could be high.

if the optimization thing is bogus, then i say stay whith you nice
compiler, congratulations, but you guys have a principle of a compiler within
the php code distribution, so it's not difficult to see the php source, take
the zend engine main things and make a compiler because all the parsing is done
there and execution (zend_compile.c and zend_execute.c).

i'm not a real good c programmer, soh making this alon would take a
while, but one of my goals was make a free php compiler (IF zend wouldn't
release it for non comercial use).

any help would be apreciated of course.


my best wishes.

On 19-Mar-2001 Chris Lee wrote:
 In defence of zend technologies and open source. Is your php code being used
 for profit? then purchase the encoder. Is your code being used for
 non-profit? then release it as open source for the community to use.
 
 
 -- 
 
  Chris Lee
  [EMAIL PROTECTED]
 
 
 
 
 ""Chris Anderson"" [EMAIL PROTECTED] wrote in message
 001901c0b026$6dd9a5c0$bf1412d1@s3e8p3">news:001901c0b026$6dd9a5c0$bf1412d1@s3e8p3...
 After realizing that The Zend Encoder is 2000$ I've decided that wont work
 for a college student(me). Is there any other way to protect source in my
 components?
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

   Rui Barreiros
  Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/iconv iconv.c /ext/pdf pdf.c

2001-03-09 Thread Rui Hirokawa

hirokawaFri Mar  9 18:03:26 2001 EDT

  Modified files:  
/php4/ext/iconv iconv.c 
/php4/ext/pdf   pdf.c 
  Log:
  initialized some strings in global variable structure.
  
Index: php4/ext/iconv/iconv.c
diff -u php4/ext/iconv/iconv.c:1.7 php4/ext/iconv/iconv.c:1.8
--- php4/ext/iconv/iconv.c:1.7  Mon Feb 26 07:41:38 2001
+++ php4/ext/iconv/iconv.c  Fri Mar  9 18:03:25 2001
@@ -18,10 +18,11 @@
  */
 
 #include "php.h"
+#include "php_ini.h"
+#include "php_config.h"
 
 #if HAVE_ICONV
 
-#include "php_ini.h"
 #include "php_iconv.h"
 #include "ext/standard/info.h"
 
@@ -76,10 +77,17 @@
 STD_PHP_INI_ENTRY("iconv.internal_encoding",   
ICONV_INTERNAL_ENCODING,PHP_INI_ALL,OnUpdateString,  
internal_encoding, zend_iconv_globals,  iconv_globals)
 PHP_INI_END()
 
+static void
+php_iconv_init_globals(zend_iconv_globals *iconv_globals)
+{
+   iconv_globals-input_encoding = NULL;
+   iconv_globals-output_encoding = NULL;
+   iconv_globals-internal_encoding = NULL;
+}
 
 PHP_MINIT_FUNCTION(iconv)
 {
-   ZEND_INIT_MODULE_GLOBALS(iconv, NULL, NULL);
+   ZEND_INIT_MODULE_GLOBALS(iconv, php_iconv_init_globals, NULL);
REGISTER_INI_ENTRIES();
return SUCCESS;
 }
Index: php4/ext/pdf/pdf.c
diff -u php4/ext/pdf/pdf.c:1.75 php4/ext/pdf/pdf.c:1.76
--- php4/ext/pdf/pdf.c:1.75 Mon Mar  5 08:18:50 2001
+++ php4/ext/pdf/pdf.c  Fri Mar  9 18:03:26 2001
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: pdf.c,v 1.75 2001/03/05 16:18:50 rjs Exp $ */
+/* $Id: pdf.c,v 1.76 2001/03/10 02:03:26 hirokawa Exp $ */
 /* Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp  */
 
 /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE.
@@ -27,6 +27,7 @@
 #include "php.h"
 #include "php_ini.h"
 #include "php_globals.h"
+#include "php_config.h"
 #include "ext/standard/head.h"
 #include "ext/standard/info.h"
 #include "ext/standard/file.h"
@@ -293,7 +294,7 @@
 #else
php_info_print_table_row(2, "PDFlib GmbH Version", tmp );
 #endif
-   php_info_print_table_row(2, "Revision", "$Revision: 1.75 $" );
+   php_info_print_table_row(2, "Revision", "$Revision: 1.76 $" );
php_info_print_table_end();
 
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/pdf pdf.c

2001-03-09 Thread Rui Hirokawa

hirokawaFri Mar  9 18:21:38 2001 EDT

  Modified files:  
/php4/ext/pdf   pdf.c 
  Log:
  just reversed a previous patch.
  
Index: php4/ext/pdf/pdf.c
diff -u php4/ext/pdf/pdf.c:1.76 php4/ext/pdf/pdf.c:1.77
--- php4/ext/pdf/pdf.c:1.76 Fri Mar  9 18:03:26 2001
+++ php4/ext/pdf/pdf.c  Fri Mar  9 18:21:38 2001
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: pdf.c,v 1.76 2001/03/10 02:03:26 hirokawa Exp $ */
+/* $Id: pdf.c,v 1.77 2001/03/10 02:21:38 hirokawa Exp $ */
 /* Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp  */
 
 /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE.
@@ -27,7 +27,6 @@
 #include "php.h"
 #include "php_ini.h"
 #include "php_globals.h"
-#include "php_config.h"
 #include "ext/standard/head.h"
 #include "ext/standard/info.h"
 #include "ext/standard/file.h"
@@ -294,7 +293,7 @@
 #else
php_info_print_table_row(2, "PDFlib GmbH Version", tmp );
 #endif
-   php_info_print_table_row(2, "Revision", "$Revision: 1.76 $" );
+   php_info_print_table_row(2, "Revision", "$Revision: 1.77 $" );
php_info_print_table_end();
 
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] e-commerce software

2001-03-06 Thread rui

hi, i think what you're looking for is something like phpshop
you may find it in www.edikon.org, and it's free.

On 06-Mar-2001 Justin French wrote:
 Hi,
 
 I'm currently using a perl/CGI developed e-commerce/website management
 tool which incorporates sessions (the ability to shop anywhere in the
 site, not just in a shop), members, member management, rewards points,
 mailing lists, statistics, and a complete separation of code and layout
 (so that the same code can be reconfigured for a new client with maybe
 only a day or hour of work).
 
 It uses DB Files instead of a database.  It also uses a windows GUI,
 which I want to replace with a web GUI for adding and deleting products,
 making categories, etc etc, maybe tied in with an excell spreadsheet or
 a windows based dbase.
 
 
 The problem is, I didn't write the code, i'm only buying a license to
 use it on each site, which is eating a bit chunk of my profit away.  On
 top of that, the developer is looking at selling the code to someone
 else soon, which will make it harder, if not impossible to get the code.
  So, before that happens, i'm looking into other options, including
 writing new code, or extending pre-existing code.
 
 
 So far I've been looking at pre-existing apps and code snippets
 available at zend.com, but I'm hoping that some developers out there
 either have an app, or have used/extended an app to suit their needs,
 which they may be able to recommend.
 
 Yes, I'm prepared to pay for decent code, it doesn't have to be free,
 but I would have to spend a long time evaluating it before buying it.
 
 
 At this stage (unless people advise me otherwise), I plan to use
 FreeBSD, PHP4 and MySQL as the platform.
 
 
 I'm not realy interested in anything that relies on javascript, java or
 cookies to run (i'd preffer sessions and server-side calculations), and
 i'd prefer something that is website based, not shop based (sessions can
 be used site wide, etc etc).
 
 
 Yeah yeah, I know I'm asking a lot :)
 
 
 Has anyone got any recommendations, or maybe anyone in Australia want to
 start developing one with me?
 
 
 Kind Regards,
 
 Justin French
 Creative Director
 Indent.com.au
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

   Rui Barreiros
  Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/iconv iconv.c

2001-02-26 Thread Rui Hirokawa

hirokawaMon Feb 26 07:41:38 2001 EDT

  Modified files:  
/php4/ext/iconv iconv.c 
  Log:
  ob_iconv_handler changed to use for text data only.
  
Index: php4/ext/iconv/iconv.c
diff -u php4/ext/iconv/iconv.c:1.6 php4/ext/iconv/iconv.c:1.7
--- php4/ext/iconv/iconv.c:1.6  Sun Feb 25 22:06:57 2001
+++ php4/ext/iconv/iconv.c  Mon Feb 26 07:41:38 2001
@@ -176,7 +176,8 @@
ZEND_WRONG_PARAM_COUNT();
}
 
-   if (php_iconv_string(Z_STRVAL_PP(zv_string), out_buffer,
+   if (SG(sapi_headers).send_default_content_type 
+   php_iconv_string(Z_STRVAL_PP(zv_string), out_buffer,
 ICONVG(internal_encoding), 
 ICONVG(output_encoding))==SUCCESS) {
RETVAL_STRING(out_buffer, 0);
@@ -189,29 +190,39 @@
 }
 /* }}} */
 
-/* {{{ proto bool iconv_set_encoding(string int_charset, string out_charset)
+/* {{{ proto bool iconv_set_encoding(string type, string charset)
Sets internal encoding and output encoding for ob_iconv_handler() */
 PHP_FUNCTION(iconv_set_encoding)
 {
-   zval **int_charset, **out_charset;
+   zval **type, **charset;
+   int argc = ZEND_NUM_ARGS();
ICONVLS_FETCH();
 
-   if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, int_charset, 
out_charset) == FAILURE) {
+   if (argc != 2 || zend_get_parameters_ex(2, type, charset) == FAILURE) {
WRONG_PARAM_COUNT;
}
-
-   convert_to_string_ex(int_charset);
-   convert_to_string_ex(out_charset);
 
-   if (ICONVG(internal_encoding)) {
-   free(ICONVG(internal_encoding));
-   }
-   ICONVG(internal_encoding) = estrndup(Z_STRVAL_PP(int_charset), 
Z_STRLEN_PP(int_charset));
+   convert_to_string_ex(type);
+   convert_to_string_ex(charset);
 
-   if (ICONVG(output_encoding)) {
-   free(ICONVG(output_encoding));
+   if(!strcasecmp("input_encoding",Z_STRVAL_PP(type))) {
+   if (ICONVG(input_encoding)) {
+   free(ICONVG(input_encoding));
+   }
+   ICONVG(input_encoding) = estrndup(Z_STRVAL_PP(charset), 
+Z_STRLEN_PP(charset));
+   } else if(!strcasecmp("output_encoding",Z_STRVAL_PP(type))) {
+   if (ICONVG(output_encoding)) {
+   free(ICONVG(output_encoding));
+   }
+   ICONVG(output_encoding) = estrndup(Z_STRVAL_PP(charset), 
+Z_STRLEN_PP(charset));
+   } else if(!strcasecmp("internal_encoding",Z_STRVAL_PP(type))) {
+   if (ICONVG(internal_encoding)) {
+   free(ICONVG(internal_encoding));
+   }
+   ICONVG(internal_encoding) = estrndup(Z_STRVAL_PP(charset), 
+Z_STRLEN_PP(charset));
+   } else {
+   RETURN_FALSE;
}
-   ICONVG(output_encoding) = 
estrndup(Z_STRVAL_PP(out_charset),Z_STRLEN_PP(out_charset));
 
RETURN_TRUE;
 }
@@ -235,10 +246,14 @@
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
+   add_assoc_string(return_value, "input_encoding", 
+ICONVG(input_encoding), 1);
add_assoc_string(return_value, "output_encoding", 
 ICONVG(output_encoding), 1);
add_assoc_string(return_value, "internal_encoding", 
 ICONVG(internal_encoding), 1);
+   } else if (!strcasecmp("input_encoding",Z_STRVAL_PP(type))) {
+   RETVAL_STRING(ICONVG(input_encoding), 1);
} else if (!strcasecmp("output_encoding",Z_STRVAL_PP(type))) {
RETVAL_STRING(ICONVG(output_encoding), 1);
} else if (!strcasecmp("internal_encoding",Z_STRVAL_PP(type))) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] array max min

2001-02-05 Thread rui



Hi there, i have a little problem,

suppose i have a multidimensional array ex:

row[monthnr][daynr][hour][numberofusers]
row[monthnr][daynr][hour][numberofmails]
row[monthnr][daynr][hour][numberofdownloads]

the values in the array are a sql result query, soh not all of them are
filled like it is possible that row[12][1][23] is undefined.

i need to tag the value that is maximum and minimum foreach number of
users, numberof mails and numberofdownloads in the same month for example, i
tried all kinds of sort but it never makes a numeric comparison, maybe because
of the return of the sql result, anyone has any idea?

thanks in advance

   Rui Barreiros
  Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array max min

2001-02-05 Thread rui


On 05-Feb-2001 Steve Werby wrote:
 [EMAIL PROTECTED] wrote:
 suppose i have a multidimensional array ex:

 row[monthnr][daynr][hour][numberofusers]
 row[monthnr][daynr][hour][numberofmails]
 row[monthnr][daynr][hour][numberofdownloads]

 the values in the array are a sql result query, soh not all of
 them are
 filled like it is possible that row[12][1][23] is undefined.

 i need to tag the value that is maximum and minimum foreach number
 of
 users, numberof mails and numberofdownloads in the same month for example,
 i
 
 You might want to try to get this info directly from an SQL query.  It'll
 probably be much faster than a PHP solution involving looping through each
 available month and finding the max and min for 3 different keys.  If you
 decide to do this you'll probably want to nest "while ( list( $key, $val ) =
 each( $row[$i][number..] )" type statements, but given that the key "hour"
 isn't really needed you may have to transform your array and I really don't
 think this solution is as elegant as using a database query.
 
 SELECT month,
MAX(numberofusers) AS numberofusers_max,
MIN(numberofusers) AS numberofusers_min,
...,
MIN(numberofdownloads) AS numberofdownloads_min
 FROM my_table
 GROUP BY month
 WHERE where_clause;
 
 --
 Steve Werby
 COO
 24-7 Computer Services, LLC
 Tel: 804.817.2470
 http://www.247computing.com/
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

i thought about that, but i gave up on my first attempt on doing so, because
mysql complained about my query, it seems that it doesn't allow to use the
max() function with a sum() function, an example of the query is:

SELECT month,
   daynr,
   hour,
   sum(numberofusers),
   sum(numberofmails),
   sum(numberofdownloads)
FROM table
GOURP BY month, daynr, hour
WHERE where_clause;

and mysql complaints when i do another column with max(sum(numberofusers)) :\

i think i'm doomed with the big loop thing :\

   Rui Barreiros
  Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array max min

2001-02-05 Thread rui


On 05-Feb-2001 Steve Werby wrote:
 [EMAIL PROTECTED] wrote:
 i thought about that, but i gave up on my first attempt on doing so,
 because
 mysql complained about my query, it seems that it doesn't allow to use the
 max() function with a sum() function, an example of the query is:

 SELECT month,
daynr,
hour,
sum(numberofusers),
sum(numberofmails),
sum(numberofdownloads)
 FROM table
 GOURP BY month, daynr, hour
 WHERE where_clause;

 and mysql complaints when i do another column with max(sum(numberofusers))
:\
 
 You just need to add a column max(numberofusers).  You've already grouped by
 month, day and hour so:
 
 sum(numberofusers) = total # of users for that month/day/hour/
 max(numberofusers) = max # of users for any record for that month/day/hour
 
 If you're really trying to get the total # of users for the single
 month/day/hour with the most users then you need a second query.  If you can
 put into sentences exactly what you're trying to do, we can probably help
 you a little better.
 
 i think i'm doomed with the big loop thing :\
 
 Nah, I think you can avoid it.  MySQL is your friend.  grin
 
 --
 Steve Werby
 COO
 24-7 Computer Services, LLC
 Tel: 804.817.2470
 http://www.247computing.com/
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


ok, this is the real query:

select sum(numberofusers),
   sum(numberofmails),
   sum(numberofdownloads),
   month(data) as month,
   hour 
from account, site 
where site.pid=account.id and site.siteid=10
and hour!=''
group by month,hour order by month,hour

while($db-next_record())
 row[$db-Record[3]][$db-Record[4]]=$db-Record;
}

then display the table

|   |month1 |month2 |
|hour1  |value  |value  |
|hour2  |value  |value  |

and to distinguish the maximum value and minimum value with somekind of color
or bold or something.

this is the whole job, i can't seem to find another way beside the loop
thing...
thanks a lot for the help guys. 

   Rui Barreiros
  Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/iconv EXPERIMENTAL

2001-01-19 Thread Rui Hirokawa

hirokawaFri Jan 19 18:59:59 2001 EDT

  Added files: 
/php4/ext/iconv EXPERIMENTAL 
  Log:
  added: EXPERIMENTAL
  



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/iconv iconv.c php_iconv.h

2001-01-13 Thread Rui Hirokawa

hirokawaSat Jan 13 23:40:16 2001 EDT

  Modified files:  
/php4/ext/iconv iconv.c php_iconv.h 
  Log:
  added iconv_get_encoding and supported initialization from php.ini
  
Index: php4/ext/iconv/iconv.c
diff -u php4/ext/iconv/iconv.c:1.3 php4/ext/iconv/iconv.c:1.4
--- php4/ext/iconv/iconv.c:1.3  Tue Jan  9 07:53:09 2001
+++ php4/ext/iconv/iconv.c  Sat Jan 13 23:40:16 2001
@@ -18,6 +18,7 @@
  */
 
 #include "php.h"
+#include "php_config.h"
 
 #if HAVE_ICONV
 
@@ -35,6 +36,7 @@
 function_entry iconv_functions[] = {
 PHP_FE(iconv, 
 NULL)
 PHP_FE(ob_iconv_handler,   NULL)
+PHP_FE(iconv_get_encoding, NULL)
 PHP_FE(iconv_set_encoding, NULL)
{NULL, NULL, NULL}  
 };
@@ -57,48 +59,22 @@
 int php_iconv_string(char *, char **, char *, char *);
 
 
-static PHP_INI_MH(OnUpdateIconvOutputEncoding)
-{
-   ICONVLS_FETCH();
-
-   if (ICONVG(iconv_output_encoding)) {
-   free(ICONVG(iconv_output_encoding));
-   }
-   ICONVG(iconv_output_encoding) = zend_strndup(new_value, new_value_length);
-   return SUCCESS;
-}
-
-static PHP_INI_MH(OnUpdateIconvInternalEncoding)
-{
-   ICONVLS_FETCH();
-
-   if (ICONVG(iconv_internal_encoding)) {
-   free(ICONVG(iconv_internal_encoding));
-   }
-   ICONVG(iconv_internal_encoding) = zend_strndup(new_value, new_value_length);
-   return SUCCESS;
-}
-
-
 PHP_INI_BEGIN()
-   PHP_INI_ENTRY_EX("iconv.output_encoding",   ICONV_OUTPUT_ENCODING, 
 PHP_INI_SYSTEM, OnUpdateIconvOutputEncoding,NULL)
-   PHP_INI_ENTRY_EX("iconv.internal_encoding", 
ICONV_INTERNAL_ENCODING,PHP_INI_SYSTEM, 
OnUpdateIconvInternalEncoding,  NULL)
+STD_PHP_INI_ENTRY("iconv.input_encoding",  ICONV_INPUT_ENCODING,  
+ PHP_INI_ALL,OnUpdateString,  input_encoding,
+zend_iconv_globals,  iconv_globals)
+STD_PHP_INI_ENTRY("iconv.output_encoding", ICONV_OUTPUT_ENCODING, 
+ PHP_INI_ALL,OnUpdateString,  output_encoding,   
+zend_iconv_globals,  iconv_globals)
+STD_PHP_INI_ENTRY("iconv.internal_encoding",   
+ICONV_INTERNAL_ENCODING,PHP_INI_ALL,OnUpdateString,  
+internal_encoding, zend_iconv_globals,  iconv_globals)
 PHP_INI_END()
 
 
 PHP_MINIT_FUNCTION(iconv)
 {
-/* Remove comments if you have entries in php.ini
REGISTER_INI_ENTRIES();
-*/
return SUCCESS;
 }
 
 PHP_MSHUTDOWN_FUNCTION(iconv)
 {
-/* Remove comments if you have entries in php.ini
UNREGISTER_INI_ENTRIES();
-*/
return SUCCESS;
 }
 
@@ -172,6 +148,7 @@
RETURN_FALSE;
}
 }
+/* }}} */
 
 /* {{{ proto string ob_iconv_handler(string contents)
Returns str in output buffer converted to the iconv.output_encoding character set 
*/
@@ -187,8 +164,8 @@
}
 
if (php_iconv_string(Z_STRVAL_PP(zv_string), out_buffer,
-ICONVG(iconv_internal_encoding), 
-
ICONVG(iconv_output_encoding))==SUCCESS) {
+ICONVG(internal_encoding), 
+ICONVG(output_encoding))==SUCCESS) {
RETVAL_STRING(out_buffer, 0);
} else {
zval_dtor(return_value);
@@ -197,6 +174,7 @@
}

 }
+/* }}} */
 
 /* {{{ proto bool iconv_set_encoding(string int_charset, string out_charset)
Sets internal encoding and output encoding for ob_iconv_handler() */
@@ -212,20 +190,54 @@
convert_to_string_ex(int_charset);
convert_to_string_ex(out_charset);
 
-   if (ICONVG(iconv_internal_encoding)) {
-   free(ICONVG(iconv_internal_encoding));
+   if (ICONVG(internal_encoding)) {
+   free(ICONVG(internal_encoding));
}
-   ICONVG(iconv_internal_encoding) = estrndup(Z_STRVAL_PP(int_charset), 
Z_STRLEN_PP(int_charset));
+   ICONVG(internal_encoding) = estrndup(Z_STRVAL_PP(int_charset), 
+Z_STRLEN_PP(int_charset));
 
-   if (ICONVG(iconv_output_encoding)) {
-   free(ICONVG(iconv_output_encoding));
+   if (ICONVG(output_encoding)) {
+   free(ICONVG(output_encoding));
}
-   ICONVG(iconv_output_encoding) = 
estrndup(Z_STRVAL_PP(out_charset),Z_STRLEN_PP(out_charset));
+   ICONVG(output_encoding) = 
+estrndup(Z_STRVAL_PP(out_charset),Z_STRLEN_PP(out_charset));
 
RETURN_TRUE;
 }
+/* }}} */
+
+/* {{{ proto array iconv_get_encoding([string type])
+   Get internal encoding and output encoding for ob_iconv_handler() */