Re: [PHP] Design Problem

2002-05-30 Thread jakob

> James Holden wrote:
>
>> Does it matter?
>>
>> The search engine doesnt know your producing dynamic content, its just
>> requesting a page to scan, regardless of the way your producing it.

search engine spiders will usually disregard the search string of a URL,
i.e. everything after and including the "?" character.
to overcome this, you should use url rewrite mechanisms which can turn

http://www.example.com/page.php?key1=val1&key2=val2

to

http://www.example.com/page/val1/val2

hth,
Jakob.



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




RE: [PHP] MORE Design Problem

2002-05-30 Thread jakob


http://httpd.apache.org/docs/mod/mod_rewrite.html

hth,
Jakob.

> http://www.phpbuilder.com/columns/tim2526.php3
>
>
> - James
> --
> W: www.londontown.com
> @: [EMAIL PROTECTED]
> --
>
> -Original Message-
> From: Dani [mailto:[EMAIL PROTECTED]]
> Sent: 30 May 2002 16:12
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] MORE Design Problem
> Importance: High
>
>
> Thank you...everyone!
> I really appriciated it.
>
> Where can I learn about all of this?
>
> Is there a tutorial website about this?
>
> thanks again.
> Dani
>
>
> [EMAIL PROTECTED] wrote:
>
>> > James Holden wrote:
>> >
>> >> Does it matter?
>> >>
>> >> The search engine doesnt know your producing dynamic content, its
>> >> just requesting a page to scan, regardless of the way your
>> >> producing it.
>>
>> search engine spiders will usually disregard the search string of a
>> URL, i.e. everything after and including the "?" character.
>> to overcome this, you should use url rewrite mechanisms which can turn
>>
>> http://www.example.com/page.php?key1=val1&key2=val2
>>
>> to
>>
>> http://www.example.com/page/val1/val2
>>
>> hth,
>> Jakob.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




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




[PHP] how to use saxon.jar from php?

2002-03-04 Thread Jakob

Hi,

I would like to use the Saxon XSL processor from within PHP.  Saxon is written 
in Java (there is a saxon.jar; see http://saxon.sourceforge.net).  Although PHP 
has an option to use Sablotron as XSL processor as a module, this is not 
supported with many hosting providers, and Sablotron is not yet 100% compliant 
with the XSLT recommendation.

I am no Java programmer, but there is an API exposed by Saxon.  I got the basic 
Java "Hello World" example from the PHP man page and another one from 
oreillynet.com working.  I noticed an article on 
http://www.linuxwebdevnews.com/articles/php-java-xslt-2/ where an example was 
given, but this uses a previous version of Saxon.  When trying to follow the 
example, I always get a "Cannot create Java Virtual Machine" error message.

Does somebody uses this kind of setup, and can give me a hint as to how to use 
Saxon from within PHP?  Or is this too resource-hungry, and should be avoided 
in a production environment?

Thanks for your help in advance,
--
Jakob.

PS:  cc'ing me is appreciated, as I am on the digest list. thanks.



--
Jakob.

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




[PHP] how to find out the mysql version from php?

2001-07-10 Thread Jakob


several people seem the have the "case sensitivity problem"
regarding different mysql versions - see this extract from
the mysql manual:

"
Prior to MySQL Version 3.23.4, REGEXP is case sensitive, and the previous query 
will return no rows. To match either lowercase or uppercase `b', use this query 
instead: 

mysql> SELECT * FROM pet WHERE name REGEXP "^[bB]";

>From MySQL 3.23.4 on, to force a REGEXP comparison to be case sensitive, use 
the BINARY keyword to make one of the strings a binary string. This query will 
match only lowercase `b' at the beginning of a name: 

mysql> SELECT * FROM pet WHERE name REGEXP BINARY "^b";
"

is there a way to find out _programmatically_ which version of mysql is running 
(phpinfo() gives some information, but i don't know how this can be accessed) 
on the server.

thanks in advance,
Jakob.

PS: please cc me, i am on the very long digest list.

-- 
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] Problem with ImageMagick and PHP on Windows

2001-09-21 Thread Jakob


Hi,

I need to retrieve image properties from an EPS graphic.  therefore I installed 
ImageMagick on Windows.

This command works very well on the commandline:
C:\>C:\imagemagick\identify.exe -ping -format "%m %f %b %w %h %x %y" http://ws-
tgljfix/upload/pusunybkvv.eps

However, when executed through PHP (from inside an object):

...
$cmdline = $this->_imagemagick_identify . 
  sprintf($this->_imagemagick_identify_flags, $this->_imgfile);

/* commandline is now:
  "C:\imagemagick\identify.exe 
-ping 
-format \"%m %f %b %w %h %x %y\" http://ws-tgljfix/upload/pusunybkvv.eps";
*/

$res = `$cmdline`;
...

It doesn't generate any output, but appends the following error message to the 
Apache error log:

[Fri Sep 21 15:13:30 2001] [error] [client xxx.xx.x.xx] identify: Postscript 
delegate failed [No such file or directory].

[Fri Sep 21 15:13:30 2001] [error] [client xxx.xx.x.xx] identify: Missing an 
image file name.

How can I make this work through PHP on Windows?  Thanks for your help.  CC to 
my email appreciated, as I am on the digest list.

Thanks,
Jakob.



Jakob - icq #69728667


-- 
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] Re: Auto refresh

2003-06-03 Thread Jakob Mund
My advice to you is to use javascript..

"Kurosh Burris" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi Everyone,
>
> I'm now trying to add an "auto refresh" in a .php file, so that it
> automatically refreshes the same page every 15 mins.  Is there an upper
> limit to the header() function?  It seemed to work fine when it was set to
> "5" seconds, but is not working with "900".
>
> Here's the code:
>
> header( 'refresh: 900; url=.' );
>
> Thanks,
> Kurosh
>
>



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



[PHP] Re: convert seconds to hours, minutes, seconds

2003-06-03 Thread Jakob Mund
use the standard mathematics:
like 178607 / 60 / 60 = Hours ( u have to round down to the nearest
integer )
then u substract the number of hours*3600 from the 178607 seconds.
then you have to divide the number you get by 60 and you got the minutes (
remember to round down to the nearest integer ).
then u substract the number of ( hours*3600 + minutes*60 ) from 178607 and
you got the seconds..

:-)
Jakob 'iNstinct' Mund :)

"Chinmoy Barua" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hello everybody,
> I have a value 178607, which is stored as seconds. I
> like to convert it (178607 Secs) to Hours, Minutes and
> Seconds appropiatly.
> Can anybody help me supplying the code?
> Thank You,
> - Chinmoy
>
> __
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com



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



[PHP] zlib.output_compression, how to turn it OFF?

2001-05-10 Thread Jakob Kruse

Hi.

I have turned on zlib.output_compression in my PHP 4.0.5 php.ini file, and
it works beautifully. But if I want to turn off all buffering/compression
for a single page, how do I do that?

Regards,
Jakob Kruse



-- 
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: Re[2]: [PHP] Newbie redirect/variable question

2001-05-10 Thread Jakob Kruse

You should probably urlencode the address first, like this:

">test link

Not sure if it solves the problem though.

Regards,
Jakob Kruse

""Steve Wade"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Ahh - thanks - that's helped :-) (Line 9 was the http_referrer line)
>
> Now the only trouble is, it seems to still treat $fred as null.
>
> The passing line is from index.php:
>
> test link
>
>  Should this work?
>
> Thanks,
>
> Steve
> ~~~
> Steve Wade
> Youth Outreach Coordinator
> Fusion Australia Ltd (Sydney North)
> ABN 26 001 273 105
> +61 2 9477 1110




-- 
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] WEIRD, WEIRD problem with upgrade to 4.0.5

2001-05-10 Thread Jakob Kruse

Ehm... did you enable the  tags in the php.ini file?
If the code is being shown on the page it stands to reason that PHP did not
process the page at all.

Regards,
Jakob Kruse

"Maxim Maletsky" <[EMAIL PROTECTED]> wrote in message
DC017B079D81D411998C009027B7112A015ED198@EXC-TYO-01">news:DC017B079D81D411998C009027B7112A015ED198@EXC-TYO-01...
> Hello everyone.
>
> in short: I had upgraded PHP from 4.0.1pl2 to 4.0.5.
> and this is what happened:
>
> The pages started breaking on
> '//'
> (YES, ON COMMENTS!)
>
> If there's no '//' then it works ok, but when it encounters any
> backslashes-commented line like here:
> --
>  $special_folder = 'inc';
> $DoNotQuit =True; if( !$config_inc_def )
> include("$DOCUMENT_ROOT/inc/config.php");
>
> session_start();
> session_register('array_ra');
>   session_register('PV');
> session_register('w3');
> session_unregister('view');
> file://unset($view);
> if (isset($w3))
> $time_spent = time()+1-$w3;
> $w3 = time();
>
> include ("$DOCUMENT_ROOT/inc/head.php");
> --
>
> IT CRASHES!
>
>
> The weird thing is that there a config file included before, and it HAS a
> WHOLE BUNCH of '//' but the page goes well until the first '//'
encountered.
>
> AND, THE CODE IS BEING SHOWN ON THE PAGE!
>
> to give you an idea:
>
> -- config.inc
>
> echo "What the ";
> // should print some
>
> ---
>
> -- test.php
>
> include('conf.inc');
> echo 'hell';
> ---
>
> this works fine
> prints 'What the hell'
>
> but if modify test.php:
>
> -- test.php
>
> include('conf.inc');
> // should work too..
> echo 'hell';
> ---
>
> it prints: 'What the // should work too..'
>
> ISN'T THAT WEIRD?
> WHAT IS IT?
>
> I cannot keep testing any further since we had out server down for the
whole
> 20 mins and had to place back from the tapes old PHP4.0.1pl2.
>
> CONCLUSION:
> IT WORKS ON 4.0.1pl2 AND CRASHES ON 4.0.5
>
> MY PRESUMPTIONS:
> A BUG
>
> PHP COMPILED AS:
> --with-mysql --with-pgsql --with-apxs --enable-track-vars
>
> WHAT WAS CHANGED:
> php 4.0.5 is now also compiled --with-pgsql while the previous
> installation wasn't
>
> PLATFORM:
> LINUX Red Hat 6.1
> Apache 1.3.9
>
>
> Please help us with this.
>
>
> Sincerely,
>  Maxim Maletsky
>   Web Developer
>
>  Digital Media,
>  Japan Inc Communications
>   www.japaninc.com
>   [EMAIL PROTECTED]
>   TEL: 03-3499-2175 x 1271
>   FAX: 03-3499-3109




-- 
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] SESSIONS: Why does PHP not erase session files in /TMP

2001-05-10 Thread Jakob Kruse

This has to do with session garbage collection. Check the
"session.gc_probability" option in your php.ini. I suspect the default value
of 1 means 1% chance of a collection on each session start. Changing it to
100 did the trick for me.

But do consider whether you really *want* to do garbage collection every
time a session starts. Lower values should work as well, just with a little
delay.

Regards,
Jakob Kruse

""Davor Pleskina"" <[EMAIL PROTECTED]> wrote in message
9ddf72$j2t$[EMAIL PROTECTED]">news:9ddf72$j2t$[EMAIL PROTECTED]...
> I have /TMP configured as tmp dir for session files.
>
> However, each time I try my program there is a new file; not one is being
> removed, either.
>
> How to tell PHP to remove session files when they are not needed any more?
>
> TIA,
> Davor




-- 
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: Re[2]: [PHP] Newbie redirect/variable question

2001-05-10 Thread Jakob Kruse

Well, that just means you have to rewrite the line:
header("Location: $HTTP_GET_VARS['fred']");
like this:
header("Location: " . $HTTP_GET_VARS['fred']);

But have you tried it with just $fred? You shouldn't have to use
$HTTP_GET_VARS.

Regards,
Jakob Kruse

""Steve Wade"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thanks - hmm - doesn't seem to do it though.
>
> My current code is:
>
> 
> if ($HTTP_GET_VARS['fred'] != "") {
> # $statement = "UPDATE links SET hits=hits+1 WHERE href=\"$u\"";
> # mysql_query($statement);
> header("Location: $HTTP_GET_VARS['fred']");
> exit;
> } else {
> header("Location: $HTTP_REFERRER");
> exit;
> }
> ?>
>
> which gives an error msg:
>
>
> Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
> `T_NUM_STRING' in /home/swadie/public_html/redirect.php on line 6
>
>
> ~~~
> Steve Wade
> Youth Outreach Coordinator
> Fusion Australia Ltd (Sydney North)
> ABN 26 001 273 105
> +61 2 9477 1110
>
>
> -Original Message-
> From: Jakob Kruse [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 11 May 2001 0:00
> To: [EMAIL PROTECTED]
> Subject: Re: Re[2]: [PHP] Newbie redirect/variable question
>
>
> You should probably urlencode the address first, like this:
>
>  ?>">test link
>
> Not sure if it solves the problem though.
>
> Regards,
> Jakob Kruse
>
> ""Steve Wade"" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Ahh - thanks - that's helped :-) (Line 9 was the http_referrer line)
> >
> > Now the only trouble is, it seems to still treat $fred as null.
> >
> > The passing line is from index.php:
> >
> > test link
> >
> >  Should this work?
> >
> > Thanks,
> >
> > Steve
> > ~~~
> > Steve Wade
> > Youth Outreach Coordinator
> > Fusion Australia Ltd (Sydney North)
> > ABN 26 001 273 105
> > +61 2 9477 1110




-- 
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] Php.ini style change

2001-05-11 Thread Jakob Kruse

Yup. I disagree totally. In the old style the file was totally unreadable
unless you happened to have an editor with the same concept of tab-width as
the editor of the person who wrote the file, plus the file was too wide to
read it all. Much easier this way.

And quite frankly, my eyes have no problem separating the comment lines from
the rest.

Such is life - always people to disagree with ;-)

Regards,
Jakob Kruse

"Jonatan Bagge" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Can anyone tell me why they  checnged the style of the php.ini file.
> I feel it's hardly readable anymore. Finding stuff was a lot easier when
> all the
> comments where on the right side instead of between the different
> directives.
>
> Anyone disagree?




-- 
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] include("../file.inc");

2001-05-11 Thread Jakob Kruse

You may need to set your include_path to "." in php.ini. Than again maybe
not. Try it. Then include "../file.inc" should work (on Unix or Linux, use
"\" on Windows).

Regards,
Jakob Kruse

""Matthew Ralston"" <[EMAIL PROTECTED]> wrote in message
9dgfbo$kom$[EMAIL PROTECTED]">news:9dgfbo$kom$[EMAIL PROTECTED]...
> How do you include or require a file that is above the current script in
the
> directory hierarchy? For example how would I include or require a file
whose
> path is "../file.inc" relative to the current script? I tried all of:
>
> include("../file.inc");
> require("../file.inc");
> include("/file.inc");
> require("/file.inc");
> include("..\file.inc");
> require("..\file.inc");
> include("\file.inc");
> require("\file.inc");
>
> but it doen't like any of them. :(
> I don't want to use a full path relative to the root of the drive or
> webserver folder because the included file and the script may move as the
> development server is setup differently to the real web server.
>
> Any ideas?
>
> --
> Thanks,
>
> Matt
> [EMAIL PROTECTED]
> < www.mralston.co.uk />
>
>
>
>
> --
> 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]




Re: [PHP] zlib or gzip compression?

2001-05-16 Thread Jakob Kruse

As I understood it: performance.

zlib.output_compression should be a lot more effective than using
output_handlers. I don't really have a basis for comparing them, but I have
been using zlib.output_compression since the day 4.0.5 was released and it
works beautifully and very, very fast.

Regards,
Jakob Kruse

"Alex Dupre" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> What are the differences between "output_handler = ob_gzhandler" and
> "zlib.output_compression = On" ?
>
> Alex Dupre




-- 
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] exit in function

2001-05-18 Thread Jakob Kruse

Hi

I use PHP 4.0.5 and Apache 1.3.19 on Windows 2000, with PHP running as an
Apache module.

If I use the exit construct from within a function Apache crashes. I made a
small test-page like this:



I would expect it to print "foo1" and then nothing more. But instead Apache
crashes. Why?

Regards,
Jakob Kruse

PS: I know it isn't very nice to use exit that way, but I'm trying to run
some PHP software that uses it extensively.



-- 
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] Netscape 6, What a piece of s$#@ , anyone else had problems with php and Netscape 6?

2001-05-19 Thread Jakob Kruse

Brandon, might I suggest that you start using the HTML Validator at
www.w3.org if you intend to write HTML that is viewable in Netscape 6.x. As
pointed out by many others, Netscape 6 is a browser which does things
according to W3C specs (mostly... a lot better than most other browsers
anyway) and you are quite clearly not aware of what those specs are.

I tried validating your HTML shown below. It is not even close to being
valid HTML 4.01 Transitional, which is the loosest standard anyone should
aim for at the moment (for the general progression of the WWW as a unity).

Try the validator. It really is quite nice, and it *will* teach you how to
write compliant HTML.

Regards,
Jakob Kruse

"Brandon Orther" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> This is the HTML that is returned by PHP.  Does anyone know why Netscape
> Would have problems viewing it?
>
>
> 
> 
> Control Maestro Menu System
> 
> 
> 
>  MARGINHEIGHT=0 TOPMARGIN=0 background="../html/gray-background.gif"> width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
> 
> 
>   
> 
>   
 href="menu.php?open=Web%20Mail">
>  
>   
 href="menu.php?open=Web%20Mail">Web
> Mail
> 
>   
>   
> 
> 
>   
 href="menu.php?open=Account%20Managment">
>  
>   
 href="menu.php?open=Account%20Managment">Account
> Managment
> 
>   
>   
> 
> 
>   
 href="menu.php?open=Support">
>  
>   
 href="menu.php?open=Support">Support
> 
>   
>   
> 
> 
>   
 href="menu.php?open=Billing">
>  
>   
 href="menu.php?open=Billing">Billing
> 
>   
>   
> 
> 
>   
 href="menu.php?open=Domain%20Managment">
>  
>   
 href="menu.php?open=Domain%20Managment">Domain
> Managment
> 
>   
>   
> 
> 
>   
 href="menu.php?open=Business%20Center">
>  
>   
 href="menu.php?open=Business%20Center">Business
> Center
> 
>   
>   
> 
>   
> 
>  src="menu_edge.gif">
> 
> 




-- 
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] mysql_free_result() question

2001-06-23 Thread Jakob Kruse

You should call mysql_free_result($Query) !!

It all becomes a little clearer if you change the names of the variables as
such:

$result = mysql_query("select ...");
$row = mysql_fetch_assoc($result);

That is, mysql_query() returns a "result", and mysql_fetch_*() returns a
"row" from such a result. Using mysql_free_result on a row is not advisable.

Also, in my terminology, the "query" would be the string passed to
mysql_query(), so you could do like this:

$query = "select ...";
$result = mysql_query($query);
$row = ...

Regards,
Jakob Kruse

"Chris Cameron" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm a bit unclear as to which result it is I use this function on.
> So lets say I;
> $Query = mysql_query("SELECT something FROM here");
> $Result = mysql_fetch_assoc($Query);
>
> Do I mysql_free_result the $Query or the $Result? If it's $Result, would
> this be the same as just going unset($Result)?
>
> Thanks,
> Chris
>
> --
> "If you don't find it in the index, look very carefully through the entire
catalogue."
> - Sears, Roebuck, and Co., Consumer's Guide, 1897




-- 
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] Delegating variable-length argument lists

2010-07-02 Thread Jakob Günther
Hi,

i'm writing a custom wrapper for the mysqli_stmt class. I have to
override the method mysqli_stmt::bind_param. This function uses
"variable-length argument lists". In my function i want to delegate its
arguments to the original function.

My first naiv implementation was that:

function bind_param($types) {
$sParams=array();
$first=true;
for($i=1; i < func_num_args(); $i++) {
$sParams[] = func_get_arg($i);
}

array_unshift ($sParams ,$types);
call_user_func_array (array ($this->mysqli_stmt, 'bind_param'), 
$sParams);
}

But this is not working, because  I need to pass it by reference. Is
there a way to retrieve references to a variable number of arguments?

Thx, Jakob

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



Re: [PHP] Delegating variable-length argument lists

2010-07-02 Thread Jakob Günther

I did not find a solution, so i tried passing a array with references.

$arr = array(&$a, &$b);
bind_param("ii", $arr);

function bind_param($types, $arr){
array_unshift($arr, $types);
call_user_func_array (array ($stmt, 'bind_param'), $arr);
}

This worked in a test-case in one file. But if i call the bind-param-method
from another class it did not work. Do you have any suggestions on this?


Am 02.07.2010 17:25, schrieb Jakob Günther:
> Hi,
>
> i'm writing a custom wrapper for the mysqli_stmt class. I have to
> override the method mysqli_stmt::bind_param. This function uses
> "variable-length argument lists". In my function i want to delegate its
> arguments to the original function.
>
> My first naiv implementation was that:
>
> function bind_param($types) {
>   $sParams=array();
> $first=true;
> for($i=1; i < func_num_args(); $i++) {
> $sParams[] = func_get_arg($i);
> }
>   
>   array_unshift ($sParams ,$types);
> call_user_func_array (array ($this->mysqli_stmt, 'bind_param'),   
>   $sParams);
> }
>
> But this is not working, because  I need to pass it by reference. Is
> there a way to retrieve references to a variable number of arguments?
>
> Thx, Jakob
>
>   


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



Re: [PHP] Delegating variable-length argument lists

2010-07-05 Thread Jakob Günther
Am 02.07.2010 19:34, schrieb Adam Richardson:
> On Fri, Jul 2, 2010 at 11:49 AM, Jakob Günther  <mailto:macgu...@web.de>> wrote:
>
>
> I did not find a solution, so i tried passing a array with references.
>
> $arr = array(&$a, &$b);
> bind_param("ii", $arr);
>
> function bind_param($types, $arr){
>array_unshift($arr, $types);
>call_user_func_array (array ($stmt, 'bind_param'), $arr);
> }
>
> This worked in a test-case in one file. But if i call the
> bind-param-method
> from another class it did not work. Do you have any suggestions on
> this?
>
>
> Am 02.07.2010 17:25, schrieb Jakob Günther:
> > Hi,
> >
> > i'm writing a custom wrapper for the mysqli_stmt class. I have to
> > override the method mysqli_stmt::bind_param. This function uses
> > "variable-length argument lists". In my function i want to
> delegate its
> > arguments to the original function.
> >
> > My first naiv implementation was that:
> >
> > function bind_param($types) {
> >   $sParams=array();
> > $first=true;
> > for($i=1; i < func_num_args(); $i++) {
> > $sParams[] = func_get_arg($i);
> > }
> >
> >   array_unshift ($sParams ,$types);
> > call_user_func_array (array ($this->mysqli_stmt,
> 'bind_param'),
> >   $sParams);
> > }
> >
> > But this is not working, because  I need to pass it by reference. Is
> > there a way to retrieve references to a variable number of
> arguments?
> >
> > Thx, Jakob
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> Hi Jakob,
>
> Try looking at this page:
> http://www.php.net/manual/en/mysqli-stmt.bind-param.php
>
> Specifically, search for a comment by 'gregg at mochabomb dot com', in
> which Gregg presents a simple wrapper class and deals with the
> referencing issue the same way you did, by setting array values by
> reference.
>
> I point this out as perhaps seeing the code will give you a clue as to
> why your code had issues in your second test.  If you want help
> figuring out what's causing trouble, try posting some of the other
> code (at least the class and instance vars, connection method, and the
> query method(s)) contained within the class.
>
> Adam
>
> -- 
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
Hi Adam,

thanks for your suggestion. It helped me debugging my issue. The
src-code i send was correct, of cause because it worked in the
test-case, but there was a strange behavior with, what i think, the
scope of my connection-wrapping-class. If you're not interested dont
move on reading, because it works for me now. I'm only interested what
the problem realy was.

There has been three classes involved: Mysqli_Wrapper a wrapper-class
for the mysqli-connection, Prepared_Stmt_Wrapper a wrapper class for the
statement and a PhpUnit TestCase, see all classes below. The Testcase
will fail if the new created connection in the setUp-method is not saved
as a attribute. I would really like to know the reason. My guess is
something connected with the scope of variable, but if yes is there
documentation about that?

Thank you very much, Jakob

Connection-wrapping class:
class Mysqli_Wrapper {
 var $mysqli;
 //...
 function __construct() {
 $this->mysqli = new mysqli( |DB_HOST, DB_USER, DB_PASSWORD, DB_NAME| );
 }

 function prepare($sql) {
//...
$stmt = $this->mysqli->prepare($sql);
//...   
return new Prepared_Stmt_Wrapper($stmt);
 }
 //...
}

Then a Wrapper for the prepared statement:

class Prepared_Stmt_Wrapper {
var $mysqli_stmt;
//...
public function  __construct($mysqli_stmt) {
$this->mysqli_stmt = $mysqli_stmt;
}

public function bind_param($types, $arr) {
array_unshift($arr, $types);
call_user_func_array (array($this->mysqli_stmt,'bind_param'),$arr);
}

public function execute() {
$this->mysqli_stmt->execute();
}


public function store_result() {
$this->mysqli_stmt->store_result();
}

public function num_rows() {
return $this->mysqli_stmt->num_rows();
}
//...
}

And now the not-working test-case with the working code commented out.
class Prepared_Statement_Test extends PHPUnit_Framework_TestCase {

protected $stmt;
// protected $db;

protected

[PHP] 4.3.11 and PEAR

2005-04-01 Thread Jakob Goldbach
Hi,
What happened to all the pear packages that were in 4.3.10 ?
I don't see this change in the changelog :-)
$ tar ztf php-4.3.10.tar.gz | grep tar | grep pear
php-4.3.10/pear/packages/HTTP-1.2.2.tar
php-4.3.10/pear/packages/Net_Socket-1.0.1.tar
php-4.3.10/pear/packages/Mail-1.1.3.tar
php-4.3.10/pear/packages/XML_RPC-1.1.0.tar
php-4.3.10/pear/packages/DB-1.6.2.tar
php-4.3.10/pear/packages/XML_Parser-1.0.1.tar
php-4.3.10/pear/packages/Net_SMTP-1.2.6.tar
$ tar ztf php-4.3.11.tar.gz | grep tar | grep pear
php-4.3.11/pear/packages/HTML_Template_IT-1.1.tar
php-4.3.11/pear/packages/Net_UserAgent_Detect-2.0.1.tar
php-4.3.11/pear/packages/XML_RPC-1.2.2.tar
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Unix passwd file

2002-10-04 Thread Jakob Breivik Grimstveit

Scott wrote:

>[...] does anyone know if I populate a MySQL 
>table with the login/password can php then use that encrypted password to 
>validate users?
>  
>
<http://www.php.net/manual/en/function.crypt.php> should be the answer 
to your questions.


-- 
jakob



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