AW: [PHP] Second opinion needed - javascript blocker

2002-04-22 Thread Red Wingate

Maybe u should just strip all the javascript tags out
Of the user-input (output page) with a script like this:

$text = eregi_replace("< *script[^>]*>([^<]*)<[^>]*>","//1",$test);

this should stip all the script-tags out of the text, but
will keep the text between the tags.

(the code was NOT tested :))

HF
red
-Ursprungliche Nachricht-
Von: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 22. April 2002 9:18 PM
An: [EMAIL PROTECTED]
Betreff: [PHP] Second opinion needed - javascript blocker

I am trying to block javascript from ares of my site that  users can change.
I am going to use the following code.  Can someone give me a second opinion
on whether it will work?

function stopjavascript($text){
//Stop people from using &whatever;  tags, in case they can smuggle
javascript in with that
$text = str_replace("&","&",$text);
//Stop the onmouseover, etc. parameters
$text = eregi_replace("on","o-n",$text);
//Stop script tags, as well as links to javascript:
$text = eregi_replace("script","sc-ript",$text);
//Return the edited string
return $text;
}


--
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




AW: [PHP] Re: Second opinion needed - javascript blocker

2002-04-22 Thread Red Wingate

He might want to use this function but doing so no links or bold underline
Tags will be destroyed as well.

-Ursprungliche Nachricht-
Von: J Smith [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 22. April 2002 10:08 PM
An: [EMAIL PROTECTED]
Betreff: [PHP] Re: Second opinion needed - javascript blocker


Try looking at htmlspecialchars() and htmlentities() instead. They'll
convert things like < and > to > and < and ampersands to &.

J


Leif K-Brooks wrote:

> I am trying to block javascript from ares of my site that  users can
> change.
> I am going to use the following code.  Can someone give me a second
> opinion on whether it will work?
>
> function stopjavascript($text){
> //Stop people from using &whatever;  tags, in case they can smuggle
> javascript in with that
> $text = str_replace("&","&",$text);
> //Stop the onmouseover, etc. parameters
> $text = eregi_replace("on","o-n",$text);
> //Stop script tags, as well as links to javascript:
> $text = eregi_replace("script","sc-ript",$text);
> //Return the edited string
> return $text;
> }


--
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




AW: [PHP] Regex

2002-04-22 Thread Red Wingate

([[-a-zA-Z0-0_]*)\.([a-zA-Z]{2,4}$

should fit ur needs :P

-Ursprungliche Nachricht-
Von: James Taylor [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 22. April 2002 10:17 PM
An: [EMAIL PROTECTED]
Betreff: [PHP] Regex

I'm trying to come up with a regular expression that will match the TL
and Second Level domain names in someone's email address ONLY.

So, say someone's address is "[EMAIL PROTECTED]", I
need to match ONLY pacbell.net.   It shouldn't matter what the address
looks like, I'm looking for any number of digits, a dot, any number of
digits, and the end of the line.  The closest thing I can come up with
is  /\@.+?(.+\..+)?$/, but, as you can guess, that matches everything
except the very first character.  Can anyone help me with this? Thanks


--
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




AW: [PHP] MSSQL help w/ auto_increment

2002-04-23 Thread Red Wingate

Try : news_id int(11) auto_increment

-Ursprüngliche Nachricht-
Von: Miguel Cruz [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 23. April 2002 5:16 PM
An: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Betreff: Re: [PHP] MSSQL help w/ auto_increment

Unfortunately there is a lot of variation from one RDBMS' SQL
implementation to another.

Try something like this:

create table test (
  news_id int identity,
  title varchar(50), blah blah...

miguel

> - Original Message -
> From: "David Orn Johannsson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, April 23, 2002 10:04 AM
> Subject: [PHP] MSSQL help w/ auto_increment
>
>
> I'm having a problem wiht creating a db in MSSQL, I've only used Mysql
> be for so I tryed the syntax just the same way.
> I'm trying to execute this code:
>
> create table test
> (
>   news_id int not null auto_increment
> ,  title varchar(50) not null
> ,  ndate varchar(50) not null
> ,  headline varchar(150) not null
> ,  fullarticle text not null
> ,  lang varchar(50) not null
> ,  PRIMARY KEY(news_id))
>
> But it gives me an error on the auto_increment, which I assume is wrong
> for MSSQL, I've been searching the web for any results regarding to this
> problem of mine without any luck so I hope you can find it in your heart
> to help me if you can :)
>
> Thaks for your time
>   
> Davíð Örn Jóhannssson
> Vefforritari
> 
> Atómstöðin hf.
> Garðastræti 37
> 101 Reykjavík
> 
> sími: 595-3643
> fax: 595-3649
>   [EMAIL PROTECTED]
>   http://www.atom.is
> 
>
>
>
>
>


--
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] AW: [PHP-DB] auto-increment question

2002-04-23 Thread Red Wingate

You could consider to use zerofill, this would create ID's like 0001 0002
0003 etc.

-Ursprüngliche Nachricht-
Von: Dan Swensen [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 23. April 2002 7:22 AM
An: php
Betreff: [PHP-DB] auto-increment question

Hi all,

I'm wondering if there is a way to start an auto-increment field at a number
other than 1. I'm working on a table meant to store large amounts of users,
each with their own unique ID, but my employer wants the UIDs to be a four-
digit number, rather than starting at 1 -- but they still need to auto-
increment. Can this be done, or do I need to find a workaround (and if so,
can anyone suggest anything?)

Thanks in advance,

Dan

--
PHP Database 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




AW: [PHP] If else question

2002-04-23 Thread Red Wingate

H.

I might be wrong but :

> $ret = mysql_query($query);
> while($row = mysql_fetch_array($ret))
> {
> $user = $row['name'];
>
> $query = "SELECT uid, id, iname, image, quantity, type FROM
{$config["prefix"]}_my_items WHERE uid={$session["uid"]} AND id = '$id'
ORDER BY id";
> $ret = mysql_query($query);
> while($row = mysql_fetch_array($ret))

is absolutely wrong ... the first $ret and $row is replaced by the
second $ret and $row, try to change the names of one of those
two pairs and give it another try.

I looks to me as if one row executes the IF and another one the ELSE
Statement ( try to let the script die(); after one the first while.

red
-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 23. April 2002 8:31 PM
An: [EMAIL PROTECTED]
Betreff: Re: [PHP] If else question

Aeh, sorry - but is the 1 you test for actual a number or is it a string?
I had made this mistakes earlier, so also try
if ( $quantity == "1")

Maybe I´m absolutely wrong, (PHP 3 knowledge) but

Oliver

At 23.04.2002  10:48, you wrote:
>Ok you asked for it.
>Don't say I didn't warn you.
>
>session_start();
>$query = "SELECT name FROM {$config["prefix"]}_users WHERE
>uid={$session["uid"]}";
>$ret = mysql_query($query);
>while($row = mysql_fetch_array($ret))
>{
>$user = $row['name'];
>$query = "SELECT uid, id, iname, image, quantity, type FROM
>{$config["prefix"]}_my_items WHERE uid={$session["uid"]} AND id = '$id'
>ORDER BY id";
>$ret = mysql_query($query);
>while($row = mysql_fetch_array($ret))
>{
>   $uiid = $row['uid'];
>  $iid = $row['id'];
>   $image = $row['image'];
>   $iname = $row['iname'];
>   $quantity = $row['quantity'];
>   $type = $row['type'];
>// this is the problem if statement. Please don't yell at me for my style.
>It is easy for me to read so I'm sorry if it's not for you.
>if($quantity < 1)
>{
>echo "Sorry I can't seem to locate this item";
>}
>else
>{
>session_register("uiid");
>session_register("iid");
>session_register("image");
>session_register("iname");
>session_register("quantity");
>session_register("type");
>   if($iid == $id)
>{
>
> $display_block .="2>$iname$quantity$type";
>
> echo "$display_block";
>
>   if($type == "food")
>   //if the item food is present then set an option and include in the
>form later
>   {
>$thisoption="Feed my pet\n";
>   }
>  else
> {
> //if book or weapon is present then set a blank
> $thisoption="";
>}
>   }
>}
>}
>}
>//check if form has been submitted
>if($submit)
>{
>
>}
>else
>{
>
>//if the form has not been submitted run the following
>
>
>echo "";
>echo "";
>echo "$thisoption";
>echo "Put in my shop";
>echo "Put into my Footlocker";
>echo "Discard this item";
>echo "Donate this item";
>echo "";
>echo "";
>echo "";
>}
>Jennifer


--
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] Question on the ~= Operator ...

2002-04-26 Thread Red Wingate

Hi there,
I actually wanna know if anybody knows whats the ~= used for.
Can this Op be used to apply an regex on a string in a perl-like manner?
--red



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




AW: [PHP] reg-ex please

2002-04-27 Thread Red Wingate

Try it like this :
$code[$i] = ereg_replace("&#([0-9] {5});" , "\\1.bing" , $code[$i] );

-Ursprüngliche Nachricht-
Von: John Fishworld [mailto:[EMAIL PROTECTED]]
Gesendet: Samstag, 27. April 2002 1:11 PM
An: [EMAIL PROTECTED]
Betreff: [PHP] reg-ex please

Help please from one of the reg-ex experts out there please !

I'm trying to find the pattern &#(5 number);
example 𑃸

This works
$code[$i] = ereg_replace("&#([0-9])+" , "replace\\0.bing" , $code[$i] );

and I get back replace 𑃸.bing

but I also want to lose the &# and the ;
so I get back 69880.bing

At the moment I just re search and remove the like this
$code[$i] = ereg_replace('&#','',$code[$i]);
$code[$i] = ereg_replace(';','',$code[$i]);

but I'm sure that theortetically I can do it in one step !
Can anyone help !
Thanks in advance



--
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




AW: [PHP] reg-ex please

2002-04-27 Thread Red Wingate

Woops , one to many whitespace :)

-->
Try it like this :
$code[$i] = ereg_replace("&#([0-9]{5});" , "\\1.bing" , $code[$i] );



-Ursprüngliche Nachricht-
Von: Red Wingate [mailto:[EMAIL PROTECTED]]
Gesendet: Samstag, 27. April 2002 1:26 PM
An: [EMAIL PROTECTED]
Betreff: AW: [PHP] reg-ex please

Try it like this :
$code[$i] = ereg_replace("&#([0-9] {5});" , "\\1.bing" ,
$code[$i] );

-Ursprüngliche Nachricht-
Von: John Fishworld [mailto:[EMAIL PROTECTED]]
Gesendet: Samstag, 27. April 2002 1:11 PM
An: [EMAIL PROTECTED]
Betreff: [PHP] reg-ex please

Help please from one of the reg-ex experts out there please !

I'm trying to find the pattern &#(5 number);
example 𑃸

This works
$code[$i] = ereg_replace("&#([0-9])+" , "replace\\0.bing" , $code[$i] );

and I get back replace 𑃸.bing

but I also want to lose the &# and the ;
so I get back 69880.bing

At the moment I just re search and remove the like this
$code[$i] = ereg_replace('&#','',$code[$i]);
$code[$i] = ereg_replace(';','',$code[$i]);

but I'm sure that theortetically I can do it in one step !
Can anyone help !
Thanks in advance



--
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




AW: [PHP] reg-ex please

2002-04-27 Thread Red Wingate

Sure :)

-Ursprüngliche Nachricht-
Von: John Fishworld [mailto:[EMAIL PROTECTED]]
Gesendet: Samstag, 27. April 2002 1:46 PM
An: Red Wingate; [EMAIL PROTECTED]
Betreff: Re: [PHP] reg-ex please

Excellent  :-)))
Thanks !
Can I trouble you again with one more !


I get an url http://whatever/file.whatever (text/html/chtml)

Now trying to do the following get just the http://whatever bit
and go through my array and find .gif or .html or .chtml
and replace the eg "pics/my.gif" with http://whatever/pics/my.gif

I've only just started with this one so haven't got very far but you were so
quick I thought I'd ask ! :-))

This is my start but its definately wrong !

$code[$i] = ereg_replace("^.+.gif", "$url_file\\0",$code[$i]);

er...thanks ! :-))



> Woops , one to many whitespace :)
>
> -->
> Try it like this :
> $code[$i] = ereg_replace("&#([0-9]{5});" , "\\1.bing" , $code[$i] );
>
>
>
> -Ursprüngliche Nachricht-
> Von: Red Wingate [mailto:[EMAIL PROTECTED]]
> Gesendet: Samstag, 27. April 2002 1:26 PM
> An: [EMAIL PROTECTED]
> Betreff: AW: [PHP] reg-ex please
>
> Try it like this :
> $code[$i] = ereg_replace("&#([0-9] {5});" , "\\1.bing" ,
> $code[$i] );
>
> -Ursprüngliche Nachricht-
> Von: John Fishworld [mailto:[EMAIL PROTECTED]]
> Gesendet: Samstag, 27. April 2002 1:11 PM
> An: [EMAIL PROTECTED]
> Betreff: [PHP] reg-ex please
>
> Help please from one of the reg-ex experts out there please !
>
> I'm trying to find the pattern &#(5 number);
> example 𑃸
>
> This works
> $code[$i] = ereg_replace("&#([0-9])+" , "replace\\0.bing" , $code[$i] );
>
> and I get back replace 𑃸.bing
>
> but I also want to lose the &# and the ;
> so I get back 69880.bing
>
> At the moment I just re search and remove the like this
> $code[$i] = ereg_replace('&#','',$code[$i]);
> $code[$i] = ereg_replace(';','',$code[$i]);
>
> but I'm sure that theortetically I can do it in one step !
> Can anyone help !
> Thanks in advance
>
>
>
> --
> 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 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




Re: [PHP] PHP time zone

2004-04-13 Thread Red Wingate
Best:

use gmmktime() and add the required offset by:

$time_here = gmmktime() + ( $offset * 60 * 60 ) ;

> how can get a specific time zone, not the server time.
>
> example:
> if the server time is 13:15:46  I need to output that time +5hours
> so 18:15:46
>
> because the hosting server time  is not my local or other area time..
>
> thanks

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



Re: [PHP] intermittent problems using ftp_get ...Help!

2004-04-13 Thread Red Wingate
Maybe the max number of connections to the FTP server is reached? My
provider allows only up to 3 FTP connections at the same time which causes
similar problems to my scripts :-)

  -- red

[...]
> Can anyone tell me what would cause intermittent problems downloading files
> using ftp_get.
> I have a php file that regularly connects to a number of servers in turn
> using php's (ftp functions) and downloads files using ftp_get(...). This
> usually works but often it just fails to download a file and ends up giving
> a timeout error. Also it seems it can be any file.
>
> I just cannot understand why when I run the script a number of times in
> sucsession this will sometimes but not others. Any ideas?
[...]

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



Re: [PHP] Getting the barcode

2004-04-13 Thread Red Wingate
it's preg_match_all

Am Dienstag, 13. April 2004 15:05 schrieb Brent Clark:
> Hi All
> I have asked this question before, and the solution was partyly solved, I
> hope hope someone can help me again.
>
> I have a binary file ( readbar ) that I execute with exec().
> and it give me an output as so:
>
> readbar file
> Key1 is 4 barcodes found
>
> Code 39->10301535
> Code 39->10301536
> Code 39->10301537
> Code 39->10301538
>
>
> I need to get all the numbers after the ->
> I there is a carriage return after the number.
>
> My preg_match is like so if(preg_match("#([0-9]{8})#" , $key1, $result)){
> which works for only the first top number, but not for the rest.
> If there away to get this it an array or do a grep on this.
> There can be many lines that begin with Code 39->
>
> If somone can assist that would be most appreciated.
> Im out of ideas on this one
>
> Kind Regards and thank you
> Brent Clark

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



Re: [PHP] storing an array in an ini file

2004-04-13 Thread Red Wingate
Hi,

had the same problem before and got around this by writing my own tiny
parser that should work just nicely ( as serializing is a pain-in-the-ass when
editing the .ini file on foot )

Anyway i switched to using an XML-File now :-)

define ('REGEXP_VARIABLE','[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*');
define ('REGEXP_INDEX','[0-9a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*');

/**
 * @author   Christian Jerono <[EMAIL PROTECTED]>
 * @paramstring  $file_name  Zu verarbeitende .INI-Datei
 * @parambool$process_sections   Verarbeitung von Sectionen
 * @return   array
 */
function _parse_config_file( $file_name , $process_sections = FALSE ){
  $match_index =  "#^\[?(". REGEXP_INDEX .")\]?#";
  $match_section =  "#^\s*\[(". REGEXP_VARIABLE .")\]#";
  $match_config_param =  "#^\s*(". REGEXP_VARIABLE ."(\[". 
REGEXP_INDEX ."\])*)\s*=\s*(.*)$#";
  $match_value =  "#^(([\\\"'])(.*)(?(2)[\\\"']))|([^;]*).*$#";

  $return = array();
  $file_content = file($file_name);
  $pointer =& $return;

  foreach ( $file_content AS $file_line ){
$file_line = trim($file_line);

if ( $process_sections === TRUE AND preg_match( $match_section , 
$file_line , $section ) ){
  $pointer =& $return[$section[1]];
} else if ( preg_match( $match_config_param , $file_line , 
$config_param ) ) {
  $index_name = $config_param[1];
  $value = trim(preg_replace( $match_value , "\\3\\4" , 
$config_param[3] ));

  $sub_pointer =& $pointer;
  while ( preg_match( $match_index , $index_name , $temp ) ){
$sub_pointer =& $sub_pointer[$temp[1]];
$index_name = substr($index_name,strlen($temp[0]));
  }
  $sub_pointer = defined($value) ? constant($value) : $value;
}
  }

  return $return;
}

 -- red

[...]
> I have an ini file for my application and I use parse_ini_file to load it
> and some custom code to save modifications.  I'd like to figure out how
> to store array values in there since that is the logical place to keep
> config data.  If I can't, I could probably use a string with @@ or | in
> it as the token but an array is so much more elegant because that's what
> it's meant to do :-)
>
> Any suggestions?
[...]

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



Re: [PHP] automatic doc generation for classes

2004-04-13 Thread Red Wingate
Which version of PHP and phpDocumentor are you using ?

 -- red

Am Mittwoch, 14. April 2004 06:25 schrieb Andy B:
> so far it looks good... i got a test class/package to compile as far as the
> docs go but now when i try  to do more with it it always crashes:
> c:> c:\php\cli\php -t c:\src\test\ -o CHM:default:default -d c:\src\test\
>
> fatal error: undefined member to object in c:\phpdoc\php
> documenter\includes\converter.php on line 4199
>
> cant quite tell what im doing wrong but going to go through the docs and
> see if i messed it up somehow...
>
>
> - Original Message -
> From: "Richard Harb" <[EMAIL PROTECTED]>
> To: "Andy B" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, April 13, 2004 11:37 PM
> Subject: Re: [PHP] automatic doc generation for classes
>
> > Well, since you already mentionned it:
> > Why not use phpdoc? I use it on a regular basis: it's pretty good.
> >
> > (Yes, it works like a charm on a windows box with enough memory)
> >
> > Richard
> >
> > Tuesday, April 13, 2004, 9:10:23 PM, you wrote:
> > > does anybody have any good recommendations for anything to do auto doc
> > > generation for php classes/functions and stuff.. like phpdoc or
>
> something of
>
> > > that sort?
> > >
> > > what ones are the best to use for windows

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



Re: [PHP] remote files handling

2004-04-13 Thread Red Wingate
http://de.php.net/filemtime

[quote]
As of PHP 5.0.0 this function can also be used with some URL wrappers. Refer 
to Appendix J for a listing of which wrappers support stat() family of 
functionality.
[/quote]

 -- red

[...]
> hello sir
>  need help in remote files handling. i.e, i want to
> know the last modified date of a file on a remote
> server. for example www.abc.com/abc/Test.zip. i want
> to know the last modified date of that file.
>
> can u pls help me.
>
> thankz in advance
[...]

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



Re: [PHP] automatic doc generation for classes

2004-04-13 Thread Red Wingate
Back on-line :-)

http://phpdoc.org/docs/HTMLSmartyConverter/default/phpDocumentor/
tutorial_tags.pkg.html

[...]
> well got it to work... there was problems with the way i was making their
> comments... kept doing **/ at end of comment block instead of */
>
> never did figure out what most of the @ things are for... got as far as
> @var and their server died...oh well
>
> ill figure it out someday... like the chm format though...gues it could be
> a slight better but overall its ok... grin
[...]

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



Re: [PHP] Compile PHP question

2004-04-15 Thread Red Wingate
Wrong one here:

http://de2.php.net/manual/en/features.commandline.php

[quote]
The CLI SAPI was released for the first time with PHP 4.2.0, but was still 
experimental and had to be explicitly enabled with --enable-cli when 
running ./configure. Since PHP 4.3.0 the CLI SAPI is no longer experimental 
and the option --enable-cli is on by default. You may use --disable-cli to 
disable it.
[/quote]

Using:  './configure --enable-cli --with-mysql' is just right :-)

 -- red

[...]
> > > Hi List,
> > >
> > > How do I compile php without apache, with mysql (client is installed)
> > > as cli.

> >
> > ./configure --enable-cli --with-mysql

>
> I believe cgi is enabled by default, so
>
>./configure --disable-cgi --enable-cli --with-mysql
>
> would be better.
[...]

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



Re: [PHP] Bar/Line Graph Tool

2004-04-16 Thread Red Wingate
PEAR has some very nice Tools for this job :-)

 -- red

[...]
> Good morning gang,
>
> I'm looking for a snazzy line/bar graph class. I've got GD running, with
> just the basic fonts (I'm using an ISP, so I can't do anything about it!).
>
> Any ideas? I've tried a few of the classes at www.phpclasses.org
>  , but they all seem to be giving me errors...
> Although some of them are rather old!
>
> Hope you can help
> Richard
[...]

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



AW: [PHP] example from meloni not working

2004-04-18 Thread Red Wingate
Execute $sql :)

 -- red

-Ursprüngliche Nachricht-
Von: Anthony Ritter [mailto:[EMAIL PROTECTED] 
Gesendet: Sunday, April 18, 2004 7:42 PM
An: [EMAIL PROTECTED]
Betreff: [PHP] example from meloni not working

A basic ht counter script from Meloni's book on mysql (page 318).

Not working for me.
Every time I load the page the counter stays at zero.

Thanks for help.
TR
..




You have been counted.

The current number is 


.

// mysql SCHEMA

CREATE TABLE test_track(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
page_name VARCHAR(50),
hits INT
);

INSERT INTO test_track VALUES(1,'test1',0);


-- 
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



Re: [PHP] Why NNTP is not default protocol for php groups

2004-04-19 Thread Red Wingate
Same here, just installed some Newsgroup Software and everything works
just fine for me :-)
 -- red

Justin Patrin wrote:

Curt Zirzow wrote:

* Thus wrote T. H. Grejc ([EMAIL PROTECTED]):

Hello,

I've seen this subject before, but never really got any answer. PHP 
have news server at news.php.net but it is 'always' down and it is 
only a mailing list mirror, so some messages get lost or get 'out of 
thread'.


I've never had any problems with news.php.net being down or loosing
messages.  As for 'out of thread', that is usually due to the
person's email/newsreader client not replying correctly to a
thread.
Curt


Same for me, I've used the newsgroup interface for quite a while now and 
it's never been "down" or lost messages on me. It's likely that the "out 
of thread" thing is a difference between your newsgroup client's 
threading code and your mail readers threading code. Some programs (such 
as mutt) can also use subject matching for threads while most others 
only use headers.

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


Re: [PHP] Why NNTP is not default protocol for php groups

2004-04-19 Thread Red Wingate
Same here, just installed some Newsgroup Software and everything works
just fine for me :-)
 -- red

Justin Patrin wrote:

Curt Zirzow wrote:

* Thus wrote T. H. Grejc ([EMAIL PROTECTED]):

Hello,

I've seen this subject before, but never really got any answer. PHP 
have news server at news.php.net but it is 'always' down and it is 
only a mailing list mirror, so some messages get lost or get 'out of 
thread'.


I've never had any problems with news.php.net being down or loosing
messages.  As for 'out of thread', that is usually due to the
person's email/newsreader client not replying correctly to a
thread.
Curt


Same for me, I've used the newsgroup interface for quite a while now and 
it's never been "down" or lost messages on me. It's likely that the "out 
of thread" thing is a difference between your newsgroup client's 
threading code and your mail readers threading code. Some programs (such 
as mutt) can also use subject matching for threads while most others 
only use headers.

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


RE: [PHP] FW: Resizing Pictures

2004-04-19 Thread Red Wingate
Maybe you should take a look at PHPs Image functions, finding out which
function matches your needs is not that hard :-)

If you don't find the right functions you can also take a look at this
list's archives as this topic was raised around 5 times 04/04 :-p

 -- red

[...]
> Hi Warren,
> 
> Thanks for the reply; however, that wasn't the answer I was searching for.
> Using PHP, I would like to resize a file once it's store in a directory on
> a (my) webserver.
> 
> Anyone know?
[...]

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



[PHP] Re: Flatten/Unflatten arrays

2004-04-19 Thread Red Wingate
Orangehairedboy wrote:
Hi,

check out http://php.net/serialize and http://php.net/unserialize .
hope this helps :-)

 -- red

[...]
> Hi all,
> 
> In Perl there is a way to flatten an array into a string, and a matching
> function to unflatten the array.
> 
> This is different from explode/implode because the function supports
> multidimentional arrays as well.
> 
> The purpose is to be able to write an array to a flatfile, and when
> necessary, read it in and it's in it's original form ready to use.
> 
> Are there PHP functions which do the same thing? If not, has anyone ever
> written functions to do this?
[...]

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



Re: [PHP] Program that'll parse HTML form with results and send HTML email?

2004-04-19 Thread Red Wingate
Nice one here, got some class for this type of handling as well but it
will also do some nice magic when it comes to checking for valid data
or displaying the input again for validation :-)

My way to go:
1. Display the form
2. Check all required fields (name start with req_)
2.1 ( ok ) Parse page and display input instead of fields
2.2 ( fail ) Parse page and display form again with values inserted
3. Send the E-Mail

[...]
> Here is a class I use with my template system but it is easy to modify
> it.
[...]

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



Re: [PHP] Unwanted e-mails

2004-04-19 Thread Red Wingate
Is php.net bounceing your posts or does your ISP bounce your e-mails?
maybe you could send us a copy to have a look?

 -- red

Lester Caine wrote:

> Chris W. Parker wrote:
> 
>> but your messages *ARE* getting accepted otherwise i would not be
>> reading this email right now!
> 
> NO THEY ARE NOT - This reply HAS to be sent via the newsgroup!
> 
> The bounce messages I am getting are as a result of .php.net NOT
> accepting my perfectly valid posts!
> 

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



[PHP] Re: show_source or highlight_string wrapping

2004-04-20 Thread Red Wingate
Aidan Lister wrote:

> Why do these functions wrap at approximately 80 chars? It's stupid! How
> can this be worked around?

It doesn't check the source to see that the browser wraps the text as it
reaches the border of the window.

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



[PHP] Re: show_source or highlight_string wrapping

2004-04-20 Thread Red Wingate
Red Wingate wrote:

> Aidan Lister wrote:
> 
>> Why do these functions wrap at approximately 80 chars? It's stupid! How
>> can this be worked around?
> 
> It doesn't check the source to see that the browser wraps the text as it
> reaches the border of the window.

Oh just another note, use  to skip this limitation :-)





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



[PHP] Re: slow upload with http post

2004-04-20 Thread Red Wingate
Yavuz maFelak wrote:

> Hello
> I have a webserver that  running php4.3.x,mysql3.5x,apache1.3.x  on
> Mandrake9. I intended to transfer this server to another server.
> I installed Freebsd4.9 on newserver. and certainly apache1.3x,php4,mysql
> and concerning components. it works well. and I have a problem.
> We have 100Mbit/s Lan media. no problem
> Folders that (some has  size of 1Mbyte or more )  are uploaded with
> http_post to the server. in old server
> the folder that size of 1mbyte was uploaded with in 2 second. but on
> Freebsd the same folder uploading with in 7,8 second. That is, Upload is
> slow What shall i do ?

wait aprox 5.8 seconds longer?

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



[PHP] Re: $PHP_SELF problem

2004-04-20 Thread Red Wingate
[EMAIL PROTECTED] wrote:

> Hi
> 
> $thisFileName = $PHP_SELF; works in a file just a few lines after the
> program start.
> 
> $thisFileName = $PHP_SELF; doesn't work (echo ("Debug: self:
> $PHP_SELF"); returns Debug: self: ) if it's within function
> getNavigation() in the Navigation object called by another program.
> 
You better check the docs on 'global' and $GLOBALS :-)

-- red

> Why?
> 
> The Navigation object is called like this:
> include ("Navigation.php4");
> $myNavigation = new Navigation ("a", "b");
> $myNavigation->getNavigation();
> 
> I guess I'm asking $PHP_SELF something confusing. Does it respond
> "index.php4" which is where the above three lines reside, or
> Navigation.php4 which is where the actual $PHP_SELF resides.
> 
> All help appreciated :-)
> 
> Cheers
> J

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



RE: [PHP] Unwanted e-mails

2004-04-20 Thread Red Wingate
[...]
>> > but your messages *ARE* getting accepted otherwise i would not be
>> > reading this email right now!
>> 
>> NO THEY ARE NOT - This reply HAS to be sent via the newsgroup!
>> 
>> The bounce messages I am getting are as a result of .php.net NOT
>> accepting my perfectly valid posts!
> 
> No, I don't believe so -- the bounce you posted looks exactly like the one
> I get from every message posted to the list, and my messages get through
> fine.  In fact, the bounce generally arrives days after the message has
> made it to the list!
[...]

Allright, lets glue this two posts together 

[...]
> > Delivery-date: Mon, 19 Apr 2004 20:30:30 +0100
> > Received: from dswu27.btconnect.com ([193.113.154.28])
> > by mx1.mail.uk.clara.net with smtp (Exim 4.30)
> > id 1BFeTO-000KR9-8m
> > for [EMAIL PROTECTED]; Mon, 19 Apr 2004 20:30:30 +0100
> > Received: from btconnect.com by dswu27.btconnect.com id
> > <[EMAIL PROTECTED]>; Mon, 19 Apr 2004
> > 20:27:04 +0100
> > Message-Type: Delivery Report
[...]

Sooo ... now if you would have taken a slight look at the mail
you got, you might have noticed 'dswu27.btconnect.com'. Now, someone
registered an e-mail adress to PHP.General

[EMAIL PROTECTED]

which bounces every message back it gets from the list (right to the
author of the mail as is does a simple reply.

 -- red

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



[PHP] Re: show_source or highlight_string wrapping

2004-04-20 Thread Red Wingate
I just build a testcase to check wether PHP does or not and it doesn't even
if i have 1080 chars in a line :p

 -- red

> No, PHP explicity inserts  at 80chars
> 
> 
> "Red Wingate" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Red Wingate wrote:
>>
>> > Aidan Lister wrote:
>> >
>> >> Why do these functions wrap at approximately 80 chars? It's stupid!
>> >> How can this be worked around?
>> >
>> > It doesn't check the source to see that the browser wraps the text as
>> > it reaches the border of the window.
>>
>> Oh just another note, use  to skip this limitation :-)
>>
>> 
>> >   hightlight_file ( '...' );
>> ?>
>> 

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



[PHP] Re: show_source or highlight_string wrapping

2004-04-20 Thread Red Wingate
Maybe you take a look at the source as there ARE NO linebreaks
in any wrong places. I know the source produced by PHP's Source
functions is a mess but take yourself a while and you will see
there are no linebreaks at all :p

-- red

Aidan Lister wrote:

> Here's a PHP4 example:
> http://ircphp.com/users/imho/?file=function.str_chop.php
> 
> Here's an example where PHP has explicitly wrapped at 80 chars, but only
> the PHP, not the HTML.
> http://ircphp.com/users/imho/
> 
> 
> 
> "Red Wingate" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> I just build a testcase to check wether PHP does or not and it doesn't
> even
>> if i have 1080 chars in a line :p
>>
>>  -- red
>>
>> > No, PHP explicity inserts  at 80chars
>> >
>> >
>> > "Red Wingate" <[EMAIL PROTECTED]> wrote in message
>> > news:[EMAIL PROTECTED]
>> >> Red Wingate wrote:
>> >>
>> >> > Aidan Lister wrote:
>> >> >
>> >> >> Why do these functions wrap at approximately 80 chars? It's stupid!
>> >> >> How can this be worked around?
>> >> >
>> >> > It doesn't check the source to see that the browser wraps the text
>> >> > as it reaches the border of the window.
>> >>
>> >> Oh just another note, use  to skip this limitation :-)
>> >>
>> >> 
>> >> > >>   hightlight_file ( '...' );
>> >> ?>
>> >> 

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



Re: [PHP] Re: <button> tag

2004-04-20 Thread Red Wingate
Try something like this:


   function submit_form( type ) {
  document.forms['submit_form'].elements['mode'].value = type;
  document.forms['submit_form'].submit();
   }






[...]
> switch ($_POST['submit'])
> {
> case "edit": ...
> case "new": ...
> }
[...]

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



Re: [PHP] Why NNTP is not default protocol for php groups

2004-04-20 Thread Red Wingate
[...]
> That is mostly Outlook and OE that are real good at trashing the Xref ...
> others (old) clients do it too, but OE is the biggest sinner in that
> aspect... (and Outlook runs on the OE engine when it comes to mail).
[...]

who is outlook ? :-)

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



RE: [PHP] Re: Converting XML into something PHP like....

2004-04-20 Thread Red Wingate
Nunners wrote:

Array != Object

echo $data->Title .'';
echo $data->avail_dataset[0]->dept_date .'';

etc. pp

There are some examples on how to convert your XML-Dump
into an Array check out the comments over at php.net

 -- red

[...]
> Hi Folks,
> 
> At the end of the email is a var_dump of my XML...
> 
> I can go through and do foreach on each section, however, this is
> completely useless in practice.
> 
> How do I call things like $data["Title"] and
> $data["avail_dataset"]["0"]["dept_date"]?
> 
> At the moment, every time I do this, it comes out as NULL
> 
> Cheers
> Nunners
[...]

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



[PHP] Re: Logic problem

2004-04-20 Thread Red Wingate
As foreach is a language-construct you cannot concat it
to a string.

try something like:

$temp = '.';
foreach ( $array AS $key ) 
   $temp .= ''.$key.'';
$temp .= '';

instead

   --red

[...]
> Hi All,
> 
> I am having a logic problem. (insert jokes here)  I am trying to create a
> function that will allow me to pass any number of fields and tables into a
> blanket query.
> 
> I am getting an error; Unexpected foreach.  I have tried placing the loop
> in several different places and am getting the same error.
> 
> What should I be doing differently?
> 
> Here's my code;
> 
> function myselect($array1, $array2){
> $i=   0;
> $n=   0;
> $query=   "SELECT".foreach($array1 as $flds){
> $flds[$i];
> }.
> "FROM".foreach($array2 as $tbls){
> $tbls[$n];
> }.;
> $result   =   mssql_query($query);
> print "
> ";
> $j=   0;
> while($row=   mssql_fetch_array($result)){
> $fields   =   $row[flds[$j]];
> print "".$fields."";
> }
> }
> 
> 
> alex
[...]

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



Re: [PHP] Why NNTP is not default protocol for php groups

2004-04-20 Thread Red Wingate
[...]
> According to historical records, on Tue, 20 Apr 2004 18:31:19 +0200 Red
> Wingate <[EMAIL PROTECTED]> wrote about "Re: [PHP] Why NNTP is not default
> protocol for php groups":
> 
>>[...]
>>> That is mostly Outlook and OE that are real good at trashing the Xref
>>> ... others (old) clients do it too, but OE is the biggest sinner in that
>>> aspect... (and Outlook runs on the OE engine when it comes to mail).
>>[...]
>>
>>who is outlook ? :-)
> 
> Rumor will have it that it's a mail-program ... I've yet to see proof of
> that claim.
[...]

Sounds quite dangerous ... 

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



Re: [PHP] Why NNTP is not default protocol for php groups

2004-04-20 Thread Red Wingate
Curt Zirzow wrote:

> * Thus wrote T. H. Grejc ([EMAIL PROTECTED]):
>> Justin Patrin wrote:
>> >The threading works just fine. The problem is that users have ignorant
>> >mail software that don't set the thread headers correctly. Even
>> >newsgroup client software might do this. This is *not* the server's
>> >fault in any way, shape, or form.
>> 
>> Sure it's not servers fault, knowing that news.php.net is not *real*
>> news server. It is mailing list mirror. News server dont make threads
>> based on subject like mailing list, but based on message header field.
> 
> The servers don't make threads, its the client software that is
> responsible for following up to and displaying threads, properly.
> 
> 
> Curt

You could also build your own client using PHP displaying threads by using
the imap_thread function which will return the structure of the mails.
But you will have serious performance troubles as you are only allowed to
fetch all headers at once :-(

 -- red

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



[PHP] Re: SQL Hell

2004-04-21 Thread Red Wingate
Guess some guys don't get the point of this posting or have no idea what
foreign keys are about. This problem can easily be solved using JOINs
 -- red

Lester Caine wrote:

Jason Barnett wrote:

So far I've made multiple statements pulling out all the data and 
using PHP
to formulate the information. But I know there is a better way using 
mysql.
Only thing is I haven't got the faintest idea how to do it in one 
query and
keep overheads low. I start to get lost when I'm doing select statements
within select statements.


I'm no DB guru, but as I understand it what you want to do requires 
the use of foreign keys.  InnoDB tables implement them, but I don't 
think they currently grab the related information when you do SELECT 
statements.  It sounds like you are emulating that right now with your 
SQL statements, and I don't think that any of the 4.x versions of 
MySQL will fully support foreign keys.  I did find something 
interesting, though: apparently MySQL is going to support 
*stored_procedures* and *foreign_keys* in the 5.0-5.1 branch.  I may 
have to go play with some of the 5.0 alpha stuff soon...


Alternatively, use a better database :)
Firebird has had Triggers and Stored Procedures from the start. Using 
these with PHP gives the power needed to update cross references without 
having to build complex PHP code.
http://www.firebirdsql.org/

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


[PHP] Re: How to do type/existence checking in PHP5

2004-04-23 Thread Red Wingate
Hi,

this is a plain design fault on your side:



allright, just set $a to be a string, thats allright, now
you check wether an string-offset ( foo ) is an array or
not which causes an FATAL ERROR on PHP5.

Now if you wrote some clean code you would have done:



Now this makes sense as you first of all would make sure if $a is an
array and not start with the first index ( which doesn't exist as $a
is not even an array )

 -- red

PS: PHP5 says:
Fatal error: Cannot use string offset as an array in /www/htdocs
test_offset.php on line 6

[...]
> Hi
> 
> In PHP5 the behaviour of illegal string offsets has changed. This is
> documented in the 'thin changes' file.
> 
> This gives a problem in checking for existence / types of values,
> directly into a deeper level of a multidimensional array.
> 
> I reported this as a bug[1] because I find the behaviour unfortunate, and
> furthermore it's inconsistent. This was refused, with a note 'So don't
> do it'. I think it's a really bad idea not to check the
> existence/types of values, before using them, so how should this be done
> properly in PHP5, without risking fatal errors in the case of a
> non-existent array?
> 
> This is a problem in migrating applications from PHP4 because the
> error will not appear unless the value deosn't exist, which is exactly
> why you do the check.
> 
> [1] http://bugs.php.net/bug.php?id=28107
[...]

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



Re: [PHP] OR

2004-04-25 Thread Red Wingate
BEEP wrong :)

http://www.php.net/manual/en/language.operators.php#language.operators.precedence

therefore:

$a AND $b OR $c AND $d

is not equal

$a AND $b || $c AND $d

but is equal to

$a && $b || $c && $d

-- red

Evan Nemerson wrote:
On Sunday 25 April 2004 12:14 am, Aidan Lister wrote:

if (cond || cond2)

OR

if (cond OR cond2)

What do you use, and why?


Doesn't matter- personal preference.


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


[PHP] Re: $_SERVER['SERVER_NAME'] in read-only.

2004-04-29 Thread Red Wingate
AFAIK the content of the superglobal variables cannot be changed ( even
though i haven't found this in the docs i can remeber got beaten by PHP
for doing so :-) )
Back to the problem ( if existent ):

If you don't do stuff like '$_SERVER['SERVER_NAME'] = ;' inside your
script you won't run into trouble - I know some ppl like to use such
strange work-arounds ;-)
Otherwise using
define ( 'SERVER_NAME' , $_SERVER['SERVER_NAME'] );
right at startup will usually solve your problem ( as workarounds will
most likely kill other scripts if the SERVER_NAME is diffrent :-))
  -- red

[...]
Hello,

I am using the variable $_SERVER['SERVER_NAME'] inside a function, for 
example:

function check_servname() {
  global $server ;
  if($_SERVER['SERVER_NAME'] != $server) {
 echo "NOT OK, NOT GOOD SERVER NAME" ;
 exit ;
   }
}
But we can modify the value of $_SERVER['SERVER_NAME'] before calling 
the function check_servname(). And I am looking for a the right server 
name not for a server name which may have been changed before calling 
check_servername:
$_SERVER['SERVER_NAME'] = "www.google.com" ; //before calling 
check_servname and $_SERVER['SERVER_NAME'] will be "www.google.com" 
inside the function even the server name is not "www.google.com".

Is there any way to get the server name with a variable which would be 
read-only ?

Thanks,
Vincent.


Agreed - constants are the way to do this.  I wanted to mention that the 
$_SERVER variables are meant to hold values generated by your server. Of 
course if you really ARE google then I'm going to feel stupid for even 
mentioning this :)

http://www.php.net/reserved.variables
[...]

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


Re: [PHP] Re: global vars inside includes inside functions?

2004-04-29 Thread Red Wingate
Again ain't no problem anyway

foreach ( $GLOBALS AS $k => $v ) {
$$k =& $GLOBALS[$k] ;
}
zap you are done ... again when using a function to include
a file with relying on depts within the file you would most
probably use a registry-pattern or similar to access the required
variables.
  -- red

That makes local copies only, still no access to the global variable

The other thing to consider is that everything dies at the conclusion of
the function. It may be better to do this via a class construct
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: global vars inside includes inside functions?

2004-04-29 Thread Red Wingate
Pattern are always done using OOP, but phppatterns that is one of the best
sources on this topic i could think of :-)

 -- red

[]
> Red, can you provide any more info or resources on a "registry-pattern"?
>
> I've found this:
> http://www.phppatterns.com/index.php/article/articleview/75/1/1/ , but
> I'm not really looking to get into OOP just yet :)
[...]

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



[PHP] Re: Select from 24 tables

2004-05-01 Thread Red Wingate
First, this is a MySQL Question, next time you better send your request
to a list which covers your type of question.
use tablename.fieldname in your WHERE clause if you have fields with the
same name.
 -- red

Dave Carrera wrote:
Hi List,

How do I select data from 24 table in my database.

Each one is identical in structure layout being

Id,name,list

I want to select where like $_POST[var] from a form all of the tables but I
am having trouble :(
I thought making a var string like

$string = "table1,table2,table3,.";

And doing

(select * from $string where list like \"%$_POST[var]%\");

Would work but I get a MySql error which say "Column: 'list' in where clause
is ambiguous"
I am stumped so I ask the list for help or advise please.

Any advise is very much appreciated and I thank you in advance for any help
or pointers.
Thank you

Dave C

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.672 / Virus Database: 434 - Release Date: 28/04/2004
 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Sorting text with multibyte characters

2004-05-01 Thread Red Wingate
Run into this before, PHP seams to do quite well when you set the locale
right ( de_DE ) which will place AÄBCD instead of ABCDÄÖÜ.
Hope this helps :-)

 -- red

Michal Migurski wrote:

Hi,

Does anyone have any thoughts on how to effectively sort text with
multi byte characters? I am working on a project that uses lots of German
text, and the letters with umlauts don't sort correctly. I'm using the
mb_* functions in a few places (to adapt an ASCII-encoded database to XML
output for flash, which is always expected to be in UTF-8), but none of
them seems to be made for string comparison.
thanks,
-mike.
-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Multiple substring replacement

2004-05-24 Thread Red Wingate
In this special case you would even use 'file' to read the content
of the file into an array and use 'implode' to replace every \n with

$content = implode( "" , file ( './my_file.txt' ) );
 -- red
Brent Baisley wrote:
Normally, I would say str_replace(), but for converting "\n" to "", 
use the nl2br() function.

On May 24, 2004, at 4:28 PM, GodFoca wrote:
What's the best way of replacing every ocurrence of a substring in a 
LARGE
string by another (longer) substring?
Specifically, I have read the contents of a file into a tring with fread,
and now I want to replace all "\n" with ""

Thanks in advance
Nicolas Sanguinetti
--
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] Re: MySQL equivalent for odbc_result_all()???????

2004-06-09 Thread Red Wingate
Some old piece of source i found in my libs:
function sql_dump_result ( $result ) {
  $line = '';
  $head = '';
  while ( $temp = mysql_fetch_assoc( $result ) ){
if ( empty ( $head ) ) {
  $keys  = array_keys($temp);
  $head  = 
''.implode('',$keys).'';
}

$line .= ''.implode('',$temp).'';
  }
  return ''.$head.$line.'';
}
maybe this helps :-)
Scott Fletcher wrote:
I noticed there is no MySQL equivalent for odbc_result_all(), so it meant I
had to make a user-defined function from scratch.  That part, I haven't been
able to do very well.  Does anyone have a good code or whip up one that
would work.
Thanks...
FletchSOD
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Expedia.com

2004-06-09 Thread Red Wingate
Allmost, after having a quick look at the source i tell you they
do it like that:

... loading stuff here ...

 page loading here 
done?
JS: document.getElementByid('loading').display='none';
take a look for yourself :-)
James Harrell wrote:
Hi Rene,
Here's a thought- make your animated gif that's a "grow-bar"
that fills from left to right. Maybe it maxes out at 99% or
loops back around to 0 after reaching 100. :) Display this at
the top of the screen - but not within a table that is part of
the results display. More on why shortly.
Send about 256 characters of HTML (including the IMG SRC link
to your gif), then issue a flush(). At this point begin your
long-running query, displaying output as it becomes avialable.
Once the output is complete, issue a javascript that changes
the gif to a different one that's not animated (ex: 100%).
A few things to keep in mind:
 - Some IE browsers won't display anything until 255 chars
have been output- hence the 256 number above.
 - Some NS browsers won't display a portion of a table until
the entire table including closing tag has been written.
Hence, don't put your grow-bar inside a table unless it's
completed before issuing the long-running query.
Hope this helps,
james

-Original Message-
From: René Fournier [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 09, 2004 3:35 PM
To: php
Subject: [PHP] Expedia.com
When Expedia.com is searching for flights, it displays a page with a
little animated GIF progress bar, then display the results.
How do they do that? How does the page sit idle until the query is
finished, and then sends a new page with the results? I was thinking
that they might use HTTP-REFRESH or something, and just keep hitting
the database until the result is there. But is there a "best way" to do
this? In my application, when the user clicks a certain button, it will
take 10-20 seconds for the operation to complete—during that time I
need the web browser to "waiit" for the data.
I looked around for an article on this, but I'm not sure how to
characterize this operation.
...Rene
--
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] Re: file knowing its own directory

2004-06-09 Thread Red Wingate
the magic constant __FILE__ will give you the absolut filesystem 
location of the file it is called. Eg:

/home/www/tests/foo.php ->

will print: '/home/www/tests/foo.php';
to retrieve the path only you could do:
/home/www/tests/foo.php ->

will print: '/home/www/tests/';
hope this helps :-)
Dennis Gearon wrote:
please CC me 'cause I am on digest
the scenario:
   three files:
  .htaccess
 has line saying "php_prepend 
'true_filesystem_location_php_prepend_file' "
  prepend.php (aforementioned prepend file)
 has line saying "include file_a.php"
  file_a.php
 has line saying"$my_true_file_system_location = 
I_NEED_A_FUNCTION_HERE;"

So, what do I replace I_NEED_A_FUNCTION_HERE with?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Unit Testing

2004-06-16 Thread Red Wingate
Used all but 'Generic PHP Framework' and everything was quite fine and
worked out just as i expected. But i was still missing some features
which made me build my own small library to fit into my Framework.
 -- red
Rick Fletcher wrote:
Has anyone done any PHP unit testing? I've been looking around for a unit
testing library to try out. Below are the ones I've found so far:
SimpleTest: http://www.lastcraft.com/simple_test.php
PHPUnit (dead?): http://phpunit.sourceforge.net/
Pear PHPUnit: http://pear.php.net/package/PHPUnit
Generic PHP Framework (dead?): http://gpfr.sourceforge.net/
SimpleTest looks the most complete and the most active, so that's where I'm
leaning. Anyone have any experience with any of these libraries, or have any
comments on PHP Unit testing in general?
Thanks.
Rick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Unit Testing

2004-06-16 Thread Red Wingate
Allmost forgot about this one:
http://www.phppatterns.com/index.php/article/articleview/33/1/2/
very well written ( phpPatterns() ) covers some other nice topics
as well, allways worth a read.
 -- red
Red Wingate wrote:
Used all but 'Generic PHP Framework' and everything was quite fine and
worked out just as i expected. But i was still missing some features
which made me build my own small library to fit into my Framework.
 -- red
Rick Fletcher wrote:
Has anyone done any PHP unit testing? I've been looking around for a unit
testing library to try out. Below are the ones I've found so far:
SimpleTest: http://www.lastcraft.com/simple_test.php
PHPUnit (dead?): http://phpunit.sourceforge.net/
Pear PHPUnit: http://pear.php.net/package/PHPUnit
Generic PHP Framework (dead?): http://gpfr.sourceforge.net/
SimpleTest looks the most complete and the most active, so that's 
where I'm
leaning. Anyone have any experience with any of these libraries, or 
have any
comments on PHP Unit testing in general?

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


Re: [PHP] Can I detect size of files which are too large to upload?

2004-06-18 Thread Red Wingate
Right,
guess i saw some kind of JS that determined the size of the selected
file and wrote it into an hidden field. Maybe you try it that way.
 -- red
Marek Kilimajer wrote:
Pablo Gosse wrote --- napísal::
Marek Kilimajer wrote:
Pablo Gosse wrote --- napísal::
Hi folks.  I'm just tweaking the file manager portion of my CMS, and
am wondering if there is any way I can identify the size of an
uploaded file which exceeded the upload_max_filesize?  I'd like to be
able to tell the user the size of the file they tried to upload, in
addition to telling them the allowable maximum size.
It would seem logical to me that I would not be able to do this,
since if the file exceeds the limit set by upload_max_filesize then
the upload should not continue past that point.
Is this an accurate assumption?
Cheers and TIA.
Pablo
Content-Length request header, approximately, it also contains other
post fields.

H, thanks Marek.  That might work, though I'm not entirely sure.  
The form through which users upload files can upload five at a time, 
so I'm assuming that the content-length request header would contain 
the sum total of all uploaded files, and I don't really see how I 
could get the individual sizes.

Thoughts?
Cheers and TIA.
Pablo
Then you are lost. If you want it really bad, you can turn on 
always_populate_raw_post_data and parse the post stream, but 
post_max_size will still limit you anyway.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: OT?? -> calling frames within frames

2004-06-18 Thread Red Wingate
Allright, even if it's OT 
Many ways to handle it, first would be to add a function within the
frameset which handles redirects to the frames:

   function handleFrameRedirect ( frame , url ) {
   document.frames[ frame ].document.location.href = url ;
   }

Within the frame you use

   parent.handleFrameRedirect(  ,  );

Another way is calling this directly within the frame:

   parent.document.frames[  ].document.location.href =  ;

  -- red
Robert Sossomon wrote:
I have two frames (A and main)
When I pull up one page it reloads main with the full page, however what
I need the system to do when I click off that page is to jump to
main.html and load item.html in the top.
Main.html currently loads 2 other pages at the beginning.
I have tried to jump them in this order, but it does not seem to be
working:
//Call the main page
echo 'parent.main.location.href
="main.html";';
//Open the next two pages I need in them
echo 'parent.B.location.href
="item.html";';
echo 'parent.C.location.href
="cart.html";';
TIA!
Robert
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OOP, Classes, Sharing Code

2004-06-28 Thread Red Wingate
Look correct from my point of view...
class Portfolio {
   var $portfolioID ;
   var $albums = array () ;
   function Portfolio ( $newID ) {
  $this->portfolioID = $newID ;
   }
   function addAlbum ( $album ) {
  $this->albums[] = $album ;
   }
   function getAlbum () {
  return current ( $this->album ) ;
   }
   
}
some knowlege on the iterator pattern is required though But you 
could even use a stack ( which i prefer )

class main {
   var $stack = NULL ;
   function create ( $ID ) {
  $this->stack = new stack ( $ID , $this->stack );
   }
   function remove ( $ID ) {
  $this->stack = $this->stack->remove();
   }
   function getID () {
  return $this->stack->getID();
   }
}
class stack {
   var $ID ;
   var $prev = NULL ;
   function stack ( $ID , $prev ) {
  $this->ID = $ID ;
  $this->prev = $prev ;
   }
   function getID () {
  return $this->ID ;
   }
   function remove () {
  return $this->prev ;
   }
}
$foo = new main();
$foo->create( 100 );
$foo->create( 200 );
echo $foo->getID();// 200
$foo->remove();
$foo->create( 300 );
echo $foo->getID();// 300
$foo->remove();
echo $foo->getID();// 100
$foo->remove();
unset ( $foo );
[...]
from what you wrote it seems that only the type of display is similar in
both classes. I don't think this is enough to extend them from the same base
class because the class properties and update/insert/load methods will be
different in each.
You have more of a 'is part of' relationship here. So I'd suggest something
like this (simplified):
class Portfolio {
var $portfolioID;
var $albums = array();
}
class Album {
var $albumID;
var $portfolioID;
var $photos = array();
}
class Photo {
var $photoID;
var $albumID;
var $name;
}
[...]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Works in Mozilla, not in IE

2004-06-28 Thread Red Wingate
I wish there wouldn't be so many ppl using IE anyway :)
Matthew Sims wrote:
* Thus wrote Robert Sossomon:
That just put me right back at the beginning, IE trying to DL the PHP
page...
put your disposition back to attachment and send the vnd.ms-excel
content type.
Also, on how the behaviour IE will treat any header is
unpredictable in an unctontrolled environment, so don't be alarmed
if you have someone else claiming that it isn't working for them :)

Read as: IE sucks.

I have php 4.2.2 installed at this moment as well...
php really hasn't anything to do with how the browser will handle
the filedownload.  You're at the mercy of the intellegence of the
browser :/

Read as: IE is stupid.
;)
--Matthew Sims
--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Image support

2004-06-28 Thread Red Wingate
RTFM
Gus wrote:
I have PHP 4.3.6
I want to add image support to manipulate JPEGs.
I downloaded http://www.boutell.com/gd but what I do next?
Thanks.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Image Problem

2004-06-28 Thread Red Wingate
Read: The best database to store images in is the Filesystem because 
thats what it's for :-)

Raditha Dissanayake wrote:
Monil Chheda wrote:
Hi,
I store images in DB properly... no issues using the
 

Storing an image directly in the database certainly isnt' the proper way 
of doing it :-)
The common practice is just to store the path to the image name in the 
database.

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


Re: [PHP] Session file in /tmp

2004-06-29 Thread Red Wingate
i guess what u are looking for is session_destroy();

Binay wrote:

> If i m getting ur problem correctly then u want to restrict the same user
> logging from different machines concurrently. If tht being the case the
> snippet u mentioned below alone won't solve the problem . you have
> maintain a flag in the database which will be on when the user logs in and
> off when he/she logs out.
> 
> 
>> Code:
>>
>> session_cache_expire(0);
>> session_cache_limiter('private');
>> session_start();
>>
>> I use this at the beginning of my script that processes data objects for
> my
>> users.  The users use multiple machines and login to the web site.  This
>> prevents the cached information from one user popping up when another
>> user
>> logs in.  Will this contribute to the solution for my main problem:
>>
>> When a user exits a window without logging out they have to wait until
>> the cookie expires or the session file in /tmp is deleted before they can
>> get
>> back in.  This is the code that executes at login:
>>
>> session_cache_expire(0);
>> session_cache_limiter('private');
>> setcookie("cookie","",0,"/","iffinet.com",1);
>> session_start();
>>
>> I was hoping this would cause the session file in /tmp to be deleted but
> it
>> doesn¹t work.  I also tried unset($_SESSION[Oid¹]) this doesn¹t work
> either.
>> Anyone have any ideas as to how I can resolve this?
>>
>> Thanks for your help!
>>
>> /Tim
>>
>> --
>> 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



Re: [PHP] Question about executing PHP script

2004-06-29 Thread Red Wingate
Yep :-)

[...]
> can I do a #!/usr/bin/php -q  at the begining of the text file?
[...]

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



[PHP] Re: Saving variables in a session in a destructor

2004-06-30 Thread Red Wingate
Maybe you check out the internals archives as an discussion about this topic
was held 1-2 days ago.

> Hi all
> 
> Using PHP5, I am trying to save some properties of an object when it
> is destroyed in its destructor, __destruct().  However, I have found
> that the session variable is NOT stored unless I explicitly destroy
> the object using unset().  If I leave php to finish executing the
> script and automatically destroy the object, the destructor IS called,
> however, the session variables are NOT saved.  A quick code example
> for clarity:
> 
> -
> class StateMachine {
>   public $stateVariable;
>   function __destruct() {
> $_SESSION['state'] = $this->stateVariable;
>   }
> }
> 
> $sm = new StateMachine();
> if (isset($_SESSION['state'])) {
>   $sm->stateVariable = $_SESSION['state'];
> } else {
>   $sm->stateVariable = 'foobar';
> }
> 
> 
> (please ignore the obvious bad coding standard of making that var
> public and accessing it, this is for simplicity of the example).
> 
> Unless I do an unset($sm); at the end of a script like this, the
> $_SESSION array will never contain the state=>foobar key/value.
> 
> Can anyone offer some insight into this?
> 
> Thanks!
> Dave

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



[PHP] Re: Regular expression

2004-06-30 Thread Red Wingate
If you still like to gather the information without using any tools:

$email = explode( "\n" , $mailText );

foreach ( $email AS $emailLine ) {
  $emailLine = trim( $emailLine );
   
  if ( strtoupper ( substr( $emailLine , 0 , 4 ) ) == 'FROM' ) {
preg_match( '#^from\s*:\s*([^>]+)(<([^>]+)>)?#si' ,$emailLine ,$parts );
break ;
  }
}

$name  = $parts[1] ;
$email = $parts[3] ;

But you should consider the following:

FROM: Red Wingate <[EMAIL PROTECTED]>
FROM: Red Wingate
FROM: [EMAIL PROTECTED]
   .

Which makes working like this a pita.

   -- red

> I suggest not using a regex.
> 
> There are better tools for parsing an email, for example "formail".
> 
> $email = `formail -x Return-Path`;
> 
> See google.com for more information
> 
> Regards,
> Aidan
> 
> 
> "Syed Ghouse" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> Hi All
> 
> will anyone give me a solution to get the name and email address of sender
> from the mail text below using regular expression.
> 
> The result shud get
> name as syed ghouse
> and
> email as [EMAIL PROTECTED]
> 
> --- Mail text start ---
> 
> Return-Path: <[EMAIL PROTECTED]>
> Delivered-To: [EMAIL PROTECTED]
> Received: (qmail 25523 invoked by uid 508); 19 Jun 2004 06:23:25 -
> Received: from localhost (HELO 192.168.90.8) (127.0.0.1)
>   by mail.jinis.com with SMTP; 19 Jun 2004 06:23:25 -
> Received: from 192.168.90.20 (proxying for 192.168.90.85)
> (SquirrelMail authenticated user [EMAIL PROTECTED])
> by 192.168.90.8 with HTTP;
> Sat, 19 Jun 2004 11:53:25 +0530 (IST)
> Message-ID: <[EMAIL PROTECTED]>
> Date: Sat, 19 Jun 2004 11:53:25 +0530 (IST)
> Subject: test
> 
> From : 'syed ghouse' <[EMAIL PROTECTED]>
> 
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED],[EMAIL PROTECTED]
> User-Agent: SquirrelMail/1.4.2
> MIME-Version: 1.0
> Content-Type: text/plain;charset=iso-8859-1
> Content-Transfer-Encoding: 8bit
> X-Priority: 3
> Importance: Normal
> 
> test mail ignore
> 
> --- Mail text end ---
> 
> 
> Regards
> 
> Syed

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



Re: Fw: [PHP] Re: Regular expression

2004-06-30 Thread Red Wingate
First of all check who u credit :p
Secondly why don't you just try to fix it yourself?

There was just a typo in the regexp:
- #^from\s*:\s*([^>]+)(<([^>]+)>)?#si
+ #^from\s*:\s*([^<]+)(<([^>]+)>)?#si

Hopefully this will help you even more:

]+)\>)?)#si' ,
$mailLine , $parts );

  break ;
}
  }

  if ( is_array ( $parts ) === FALSE ) {
return FALSE ;
  } else {
return array ( 'name' => isset ( $parts[2] ) ? $parts[2] : 'unknown' ,
 'from' => isset ( $parts[1] ) ? $parts[1] : 'unknown' ,
 'mail' => isset ( $parts[4] ) ? $parts[4] : 'unknown' ) ;
  }
}

/**
 * @param   array   $strings
 * @return  void
 */
function debug_FetchSender ( $strings ) {
  echo '';

  foreach ( $strings AS $string ) {
$sender = fetchSender ( $string );
$sender = array_map ( 'htmlspecialchars' , $sender ) ;

print_r ( $sender );
  }

  echo '';
}

debug_FetchSender ( array ( 'FROM: Red Wingate <[EMAIL PROTECTED]>' ,
  'FROM: Red Wingate' ,
  'FROM: [EMAIL PROTECTED]' ) ) ;

?>

[...]
>> Thanks Aiden for ur help
>>
>> i used ur code and i got
>>
>> name as Red Wingate<[EMAIL PROTECTED]
>> and no email.
>>
>> So pls correct the code and send me such that i get name and email
>> separately.
>>
>> Regards
>> syed
[...]

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



Re: Fw: [PHP] Re: Regular expression

2004-06-30 Thread Red Wingate
Oh ... you forgot to include your account-info so i won't be able to
send you the money :-/
[...]
You're too nice..
Btw, I need some money. Send me money ASAP. It must be an amount
greater than $200, and be delivered to me directly, thank you.
[...]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Protecting database passwords

2004-06-30 Thread Red Wingate
Hashing ... but i guess he wants to protected the password
needed to access the DB not a PW stored in the DB.
[...]
MD5 - http://ie2.php.net/md5
One way in encryption.
[...]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Protecting database passwords

2004-06-30 Thread Red Wingate
even for the guy who wrote the source. it's allmost impossible to
restore the data as the only option is a brute-force attempt.
Chris W. Parker wrote:
Red Wingate <mailto:[EMAIL PROTECTED]>
on Wednesday, June 30, 2004 9:33 AM said:

Hashing ... but i guess he wants to protected the password
needed to access the DB not a PW stored in the DB.

you probably understand this already but for those who don't i would
like to say:
right, but the point with hashing is that even if the hashes are
retrieved/stolen it will take time (possibly too long) for the password
itself to be recovered/discovered.
chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Red Wingate
use " to display the data in the input-text element and undo this
before inserting it into the database
function quoteToHtml ( $string ) {
  return str_replace( '"' , '"' , $string );
}
function htmlToQuote ( $string ) {
  return str_replace( '"' , '"' , $string );
}
Only way to go :-)
Scott Fletcher wrote:
I'm using data that goes from the HTML textbox to PHP to MYSQL to PHP to
HTML textbox.  The only trouble I have is to escape the apostrophe character
when it is put into the HTML textbox by PHP (from MySQL).
--snip--
  echo "";
--snip--
I can't use the HTML feature like " or something because the """
would show up in the database...  Any suggestion or advice?
Thanks,
 Scott F.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Earliest PHP/FI

2004-06-30 Thread Red Wingate
maybe take a look here : http://museum.php.net/
otherwise do some research using google.
Jeff Loiselle wrote:
Does anyone know where I would be able to find the earliest version of 
PHP/FI or PHP possible? I am looking for the earliest possible version 
for academic reasons.

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


[PHP] Converting strings to match multiple charsets

2004-06-30 Thread Red Wingate
Hey guys,
i ran into serious trouble when facing the problem to convert
data, which was retrieved from a single form in our CMS to match
the requirements of multiple charsets.
Our CMS uses UTF-8 which worked out quite fine to display the data
but caused weired symbols when displayed within a TEXTAREA or INPUT
field. So i tried to convert all characters beyound A-Z,0-9 to
HTML entities which worked out even better ( i used the following
functions to convert the data :
function func_ConvertToHTML ( $string ) {
  $strlen = strlen ( $string ) ;
  $return = '' ;
  for ( $str_pos = 0 ; $str_pos < $strlen ; $str_pos++ ) {
$char  = substr ( $string , $str_pos , 1 );
$ascii = ord ( $char );
if ( $ascii >> 5 == 6 ) {
  $char2  = substr ( $string , ++$str_pos , 1 );
  $ascii2 = ord ($char2);
  $ascii  &= 31 ;
  $ascii2 &= 63 ;
  $ascii2 |= ( ($ascii & 3 ) << 6 ) ;
  $ascii >>=  2 ;
  $return .= '&#x' . str_pad ( dechex( $ascii ) , 2 , '0' , 
STR_PAD_LEFT ) . str_pad ( dechex( $ascii2 ) , 2 , '0' , STR_PAD_LEFT ) 
. ';' ;
} else {
  $return .= $char;
}
  }

  return $return;
}
But at this point i faced even bigger problems when using this kind
of data on JavaScripts or sending the data in an text/plain E-Mail.
I tryed to convert the data back but failed as chr() only supports
a Charset of 255 Characters ( which most languages don't match eg
ru, pl, ch, jp ... )
So my question is if anyone on this list has an idea on how to retrieve
the data completely? Some kind of func_ConvertFromHTML() function.
 -- red
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Converting strings to match multiple charsets

2004-06-30 Thread Red Wingate
[...]
Can't you use utf8_decode() to display the utf8 encoded data?
[...]
The displayed data worked out fine for some languages but others didn't
and even simple german chars like äöü won't show up correctly within
a textarea.
[...]
Is this what you're looking for?:
http://de2.php.net/manual/en/function.html-entity-decode.php
[...]
[quote](PHP 4 >= 4.3.0, PHP 5)[/quote]
This won't work on most servers we're hosting our CMS on  :-/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Red Wingate
[...]
Bummer, mysql_escape_string() is available only in PHP 5 and up.  I'm using
PHP 4.3.1
[...]
*mo* - wrong
[quote]
mysql_escape_string
(PHP 4 >= 4.0.3, PHP 5)
[/quote]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: problem with embeded objects and reference

2004-06-30 Thread Red Wingate
Not sure over here, but isn't it
$main->setChild(&$child1);
Vincent Dupont wrote:
Hi,
could anyone help on this 'by reference' problem.
I have 2 classes. The main class as a child class.
The child class has properties (array)
I would like to be able to manipulate the child's properties even after the child has 
been inserted into the main class.
Does this make sense?
I can do it with by getting a reference of the child class, then setting the 
property,like :
$tmp = & $main->getChild(); //get a reference to the child object
$tmp->setProperty("forth");//ok
OR
$main->setChildProperty("third"); //ok
but Whyt can't I do it directly by calling a reference to the child, like in :
$child1->setproperty("second"); //The property is not set or not displayed
I know I need a reference to the child class that is within the maoin class, but HOW??
Here is a complete example 


class class1{
var $child; //array
	function class1(){
		$this->properties = array();
	}
	
	//set the child object (class2)
	function & setChild($child){
		$this->child=$child;
	}
	
	//get the child object (class2), and call its setProperty method
	function setChildProperty($prop){ 
		$theChild = & $this->child;
		$theChild->setProperty($prop);
	}
	
	//return a reference to the child object
	function & getChild(){
		return $this->child;
	}
	
	//print the child object properties
	function display(){
		$this->child->toString();
	}

}
class class2{
var $properties; //array

function class2(){
$this->properties = array();
}

function & setProperty($new_property){
$this->properties[] = $new_property;
}

function & getProperty($index){
return $this->properties[$index];
}

function toString(){
print_r($this->properties);
}
}
$main = & new class1();
$child1 = & new class2();
$child1->setproperty("first");//displayed
$main->setChild($child1);
$child1->setproperty("second"); //NOT DISPLAYED
$main->setChildProperty("third"); //displayed
$tmp = & $main->getChild(); //get a reference to the child object
$tmp->setProperty("forth");//displayed
$main->display();
//output : Array ( [0] => first [1] => third [2] => forth ) 
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: problem with embeded objects and reference

2004-06-30 Thread Red Wingate
Lill example:
[...]
$child1->setproperty("first");//displayed
$main->setChild($child1);
$child1->setproperty("second"); //NOT DISPLAYED
[...]
$child1 is passed to $main with property 'first'. Later on
you update $child1, but not $main->child, as they are not
the same objects ( equal but not same ).
So i guess you need to
-$main->setChild($child1);
+$main->setChild(&$child1);
and
-$this->child =  $child;
+$this->child =& $child; // MUST !!!
Now i see, $this->child = $child; copys the object instead
of creating a ref.
 -- red
Red Wingate wrote:
Not sure over here, but isn't it
$main->setChild(&$child1);
Vincent Dupont wrote:
Hi,
could anyone help on this 'by reference' problem.
I have 2 classes. The main class as a child class.
The child class has properties (array)
I would like to be able to manipulate the child's properties even 
after the child has been inserted into the main class.

Does this make sense?
I can do it with by getting a reference of the child class, then 
setting the property,like :
$tmp = & $main->getChild(); //get a reference to the child object
$tmp->setProperty("forth");//ok
OR
$main->setChildProperty("third"); //ok

but Whyt can't I do it directly by calling a reference to the child, 
like in :
$child1->setproperty("second"); //The property is not set or not 
displayed
I know I need a reference to the child class that is within the maoin 
class, but HOW??

Here is a complete example

class class1{
var $child; //array
function class1(){
$this->properties = array();
}

//set the child object (class2)
function & setChild($child){
$this->child=$child;
}

//get the child object (class2), and call its setProperty method
function setChildProperty($prop){ $theChild = & $this->child;
$theChild->setProperty($prop);
}

//return a reference to the child object
function & getChild(){
return $this->child;
}

//print the child object properties
function display(){
$this->child->toString();
}

}
class class2{
var $properties; //array

function class2(){
$this->properties = array();
}

function & setProperty($new_property){
$this->properties[] = $new_property;
}

function & getProperty($index){
return $this->properties[$index];
}

function toString(){
print_r($this->properties);
}
}

$main = & new class1();
$child1 = & new class2();
$child1->setproperty("first");//displayed
$main->setChild($child1);
$child1->setproperty("second"); //NOT DISPLAYED
$main->setChildProperty("third"); //displayed
$tmp = & $main->getChild(); //get a reference to the child object
$tmp->setProperty("forth");//displayed
$main->display();
//output : Array ( [0] => first [1] => third [2] => forth ) ?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] problem with embeded objects and reference

2004-06-30 Thread Red Wingate
so, why don't you reply correctly? :p
Chris W. Parker wrote:
Vincent DUPONT 
on Wednesday, June 30, 2004 1:05 PM said:

Hi,

hi.

could anyone help on this 'by reference' problem.

when starting a new thread please do not just reply to an ongoing thread
and change the subject. please start a new email.
your fellow list members thank you.
chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] problem with embeded objects and reference

2004-06-30 Thread Red Wingate
better don't blame the other pal :-)
http://screens.erisx.de/reply.gif
  -- red
Red Wingate wrote:
so, why don't you reply correctly? :p
Chris W. Parker wrote:
Vincent DUPONT <mailto:[EMAIL PROTECTED]>
on Wednesday, June 30, 2004 1:05 PM said:

Hi,

hi.

could anyone help on this 'by reference' problem.

when starting a new thread please do not just reply to an ongoing thread
and change the subject. please start a new email.
your fellow list members thank you.
chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Converting strings to match multiple charsets

2004-06-30 Thread Red Wingate
[]
Hi Red,
I'm actually working on a project as well at the moment that uses utf8 data
in MySQL. All chars should be OK when output with utf8_decode(). Do the
chars only look wrong within textarea or also outside of form elements?
[]
Actually everything ( expect one language ... i guess it was pl ) was
displayed fine using utf8_decode but everything within an textarea or
our RTE was displayed completly wrong ... either those 1/4... symbols or
the good ol '' ... not sure in which kind formated the data was
returned :-)
 -- red
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Converting strings to match multiple charsets

2004-06-30 Thread Red Wingate
yep, as i said it was displayed correctly everywhere expect in the forms
oh i might mention - Mozilla worked well but IE destroyed the data (only
in textareas)
Torsten Roehr wrote:
"Red Wingate" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[]
Hi Red,
I'm actually working on a project as well at the moment that uses utf8
data
in MySQL. All chars should be OK when output with utf8_decode(). Do the
chars only look wrong within textarea or also outside of form elements?
[]
Actually everything ( expect one language ... i guess it was pl ) was
displayed fine using utf8_decode but everything within an textarea or
our RTE was displayed completly wrong ... either those 1/4... symbols or
the good ol '' ... not sure in which kind formated the data was
returned :-)

Does the data look correct in the database? Have you tried browsing the
table with phpMyAdmin?
Torsten
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Messages to List Being Truncated

2004-06-30 Thread Red Wingate
the first one was truncated but the second one was complete. Btw thx
Chris for opening up yet another thread that could have been avoided
if your client was configured correctly.
 -- red
Chris W. Parker wrote:
Pablo Gosse 
on Wednesday, June 30, 2004 2:29 PM said:

Hi folks.  I've just attempted to twice post a message, and for some
reason it's being truncated somewhere between my Sent Items folder and
when it appears on the list.
Has anyone had similar problems.  Anyone have any idea what could be
causing it?

this email appeared to be complete. is it always truncated at the same
spot (or what appears to be the same spot)?

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


Re: [PHP] Messages to List Being Truncated

2004-06-30 Thread Red Wingate
Usually it should be \\\ to get a \ ... now lets take a look
at your regexp 
/^[a-zA-Z0-9\(\)]{1}[ a-zA-Z0-9\(\)_\,\.\-\'\"]{1,999}$/
^[a-zA-Z0-9()] should work, as ( and ) only needs to be escaped
when not within an []-block (cannot recall the name right now)
[- a-zA-Z0-9(),.'\"\\\_]{1,999}$ should be correct here, i am not
sure about the >>.<< and >>,<<. >>'\"<< should be replaced by >>\'"<<
if you use single quotes to build the pattern.
Full regexp would be:
#^[a-zA-Z0-9()][- a-zA-Z0-9(),.'\"\\\_]{1,999}$#
or even easier:
#^[a-z0-9()][- a-z0-9(),.'\"\\\_]{1,999}$#i
I replaced the delimiter / with # as you don't use it within the regexp
and using / makes escaping the >>/<< even worse ( guess it's 7 / then )
Hope this helps you :-)
 -- red
Pablo Gosse wrote:

the first one was truncated but the second one was complete. Btw thx
Chris for opening up yet another thread that could have been avoided
if your client was configured correctly.  

This is strange.  At any rate, I've put the message in an html page on
our server.
http://www.unbc.ca/regexp.html
If anyone could take a look and give me a hint as to what the problem
might be I would greatly appreciate it.
Cheers and TIA.
Pablo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Messages to List Being Truncated

2004-06-30 Thread Red Wingate
Buddy,
nobody ( and especialy not me ) would have offended you, if you wouldn't
have flamed someone for creating a new thread by replying to another.
Your E-Mail client breaks the Threads just like he did which makes
reading the threads a pita.
It was stated more then once that replying useing any version of Outlook
causes troubles as they won't accept the MID ( or refs ) of other client
software on the first reply ( as every other client adds the one set by
outlook atleast every message following your initial message will follow
the thread correctly ( maybe take a look at the header information )
I would recommend you to either use some kind of Newsgroup software or
just try another e-mail client ( eg thunderbird )
  -- red
ps: stay calm :-)
[...]
oh woe is me! if only i hadn't offended thee, red, you wouldn't have
sent such a hurtful email. from the depths of my soul, and the bottom of
my heart, a thousand pardons to you and your kin. may they forever be
blessed with "configured correctly" email clients. oh how i long for the
day when i can stir up no trouble, and cause no pain.
of all the people i could have been why was i me? oh how i rue the day i
was born! argh i say.
[...]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] safe mode/open basedir not working ?

2004-06-30 Thread Red Wingate
Thats just what he said :p
Robert Mena wrote:
Marek,
but the program was executed using a system call from a php script.
- rt
On Wed, 30 Jun 2004 23:50:02 +0200, Marek Kilimajer <[EMAIL PROTECTED]> wrote:
robert mena wrote --- napísal::

Hi,
I host a few virtual domains in apache 2 and use php.
The virtual domain is something like

   ServerAdmin [EMAIL PROTECTED]
   DocumentRoot /home/httpd/html/domain.com
   ServerName www.domain.com
   ErrorLog   logs/domain.com-error_log
   CustomLog  logs/domain.com-access_log combined
   ScriptAlias /cgi-bin/ /home/httpd/cgi-bin/
   
   AllowOverride AuthConfig Limit
   php_admin_value doc_root "/home/httpd/html/domain.com/"
   php_admin_flag safe_mode on
   php_admin_value open_basedir "/home/httpd/html/domain.com:/tmp/"
   

Recently I had a minor problem with a user that uploaded via ftp a php
script in his domain and this domain used exec/system etc to call
perl, read files.
Shouldn't the settings above retrict such thing ?
no, this setting affects only php, not programs executed from 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] Re: warning: function registration failed

2004-07-12 Thread Red Wingate
Try a clean install of PHP5 otherwise head over to the interals
list to make sure it won't be a showstopper for the Release
sceduled for today.
 -- red
Josh Close wrote:
I installed php-5.0.0 and I get these error when doing "php -v"
PHP Warning:  Function registration failed - duplicate name -
mssql_connect in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_pconnect in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_close in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_select_db in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_query in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_free_result in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_get_last_message in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_num_rows in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_num_fields in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_fetch_field in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_fetch_row in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_fetch_array in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_fetch_object in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_data_seek in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_field_seek in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_result in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_min_error_severity in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name -
mssql_min_message_severity in Unknown on line 0
PHP Warning:  mssql:  Unable to register functions, unable to load in
Unknown on line 0
I'm using gentoo linux. I downgraded back to php-4x and I'm still
getting the errors.
What's going on here? How do I fix this?
Is it because gentoo now has both the mssql and freetds flags?

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


[PHP] Re: Compile Php5: --with-mysql and --with-mysqli

2004-07-14 Thread Red Wingate
[quote src="doc"]
If you would like to install the mysql extension along with the mysqli
extension you have to use the same client library to avoid any conflicts.
[/quote]

Jacob Friis Larsen wrote:

> How do I install Php5 with both --with-mysql and --with-mysqli?
> 
> MySQL is 4.1.3-beta and installed as official MySQL RPM.
> 
> This didn't work:
> ./configure --with-mysql=/usr/include/mysql --enable-embedded-mysqli
> 
> ./configure --with-mysql=/usr/include/mysql
> --with-mysql=/usr/bin/mysql_config
> 
> ./configure --with-mysql=/usr/include/mysql
> --with-mysqli=/usr/bin/mysql_config
> 
> The last gave me a lot of errors.
> 
> 
> Thanks,
> Jacob

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



[PHP] Re: ereg question/prob...

2004-07-15 Thread Red Wingate
$regs is an array not a string !
try print_r or var_dump to determine $regexp's content
Tim Van Wassenhove wrote:
In article <[EMAIL PROTECTED]>, Bruce wrote:
$file = ".txt";
ereg("(\.)([a-z0-9]{3,5})$", $file, $regs);
echo " ww = ".$regs. "";
i'm trying to figure out how to get the portion of the regex that's the
"extension" of the file. my understanding of the docs, says that the
"extension" should be in the $reg array
any ideas/comments on where my mistake is would be appreciated...

Will it work with 123.123.txt ?
If you have a look at the file functions in the manual, you'll find much
better solutions like pathinfo();

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


[PHP] Re: PHP5 release HTTP Authentication not working on FreeBSD.

2004-07-15 Thread Red Wingate
known problem, will be fixed soon in 5.0.1 which should be released asap
William Bailey wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Guys,
I've just upgraded from 5.0 rc3 to 5.0 release on freeBSD (using the
ports) and now find that HTTP Authentication dosent work.
Here is the test script that i am using:
Hello '{$_SERVER['PHP_AUTH_USER']}'.";
~   echo "You entered {$_SERVER['PHP_AUTH_PW']} as your password.";
~  }
?>
And here is the output that i get:
Notice: Undefined index: PHP_AUTH_USER in test.php on line 10
Hello ''.
You entered pass as your password.
As you can see PHP_AUTH_USER is on longer being set. Does anybody else
have this issue or know of a fix?   

- --
Regards,
William Bailey.
Pro-Net Internet Services Ltd.
http://www.pro-net.co.uk/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFA9o3ZzSfrYDJMXmERAmZqAKCunk+xl2w+RRIKOvbDTQEWjXbGCgCgxXsw
DknafWhfiwLTYrusTzHl0gE=
=IMNL
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Regular Expressions

2004-07-15 Thread Red Wingate
Yep, but to avoid his problem with empty Strings he should use
something like:
/Last Name: *(.*?)\n/
outerwise \s* will match the first newline and continue to the end
of the next line !
Tim Van Wassenhove wrote:
In article <[EMAIL PROTECTED]>, Arik Raffael Funke wrote:
implement following pattern "Last Name:\s*(.*)\n".

I get just 'Jason'. But what I currently get is:
Jason
Street: abc

This is behaviour because (.*) is greedy.
As you noticed, it matched "Jason \nStreet:abc"
/Last Name:\s+(.*?)\n/

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


[PHP] Re: Regular Expressions

2004-07-15 Thread Red Wingate
Oh guess it would be even better and faster to only use:
/Last Name:([^\n]*)/
and trim() the result :-)
 -- red
Red Wingate wrote:
Yep, but to avoid his problem with empty Strings he should use
something like:
/Last Name: *(.*?)\n/
outerwise \s* will match the first newline and continue to the end
of the next line !
Tim Van Wassenhove wrote:
In article <[EMAIL PROTECTED]>, Arik Raffael Funke wrote:
implement following pattern "Last Name:\s*(.*)\n".


I get just 'Jason'. But what I currently get is:
Jason
Street: abc

This is behaviour because (.*) is greedy.
As you noticed, it matched "Jason \nStreet:abc"
/Last Name:\s+(.*?)\n/

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


Re: [PHP] How to tell if the file is already locked with flock()???

2004-07-15 Thread Red Wingate
http://de2.php.net/manual/en/function.is-writeable.php
Jay Blanchard wrote:
[snip]
How do we tell if the file is already locked when someone use a
flock()
on the file??
[/snip]
If your flock attempt returns FALSE then it is likely locked already
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP5 and pass by reference bug.

2004-07-16 Thread Red Wingate
Maybe you recheck the dokumentation on what exactly referenzes are. Do 
you expect the function to alter the string "something here" and every-
time you later print the string within your script you get the altered one?

ONLY variables can be passed by referenze !
 -- red
Daevid Vincent wrote:
So, I'm getting all these errors/warnings in PHP5 now saying that I have to
put the & on the function and not in the passing (which sorta makes sense
and puts the burden on the function rather than the user, which I like too).
So I spend the time to go and fix several thousand lines of code.
Then I start to see these other errors...
Maybe I'm missing something, but this seems like a glaring bug in passing by
reference that nobody caught...
say you have 

	function foo(&$bar) 
	{
	}

well that works great as long as you use it like
foo($x);
but if you try 

foo("something here");
Or
foo( array('a','b','c') );
it shits the bed. :-(
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP5 and pass by reference bug.

2004-07-16 Thread Red Wingate
Maybe you recheck the dokumentation on what exactly referenzes are. Do 
you expect the function to alter the string "something here" and every-
time you later print the string within your script you get the altered one?

ONLY variables can be passed by referenze !
 -- red
Daevid Vincent wrote:
So, I'm getting all these errors/warnings in PHP5 now saying that I have to
put the & on the function and not in the passing (which sorta makes sense
and puts the burden on the function rather than the user, which I like too).
So I spend the time to go and fix several thousand lines of code.
Then I start to see these other errors...
Maybe I'm missing something, but this seems like a glaring bug in passing by
reference that nobody caught...
say you have 

	function foo(&$bar) 
	{
	}

well that works great as long as you use it like
foo($x);
but if you try 

foo("something here");
Or
foo( array('a','b','c') );
it shits the bed. :-(
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] load a URL and trap output

2004-03-12 Thread Red Wingate
Best way would be filegetcontents() and implode the content
with "\n".
eg:

http://www.somedomain.com');
$temp = implode ( "\n" , $temp );
echo $temp ;
?>
Chris Boget wrote:

How do I make my application load a URL and trap the returned data so 
that it never creates any browser output?


Aside from the fopen() and fread() that was suggested by another person
you can also use the ob_* functions.
Chris

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


Re: [PHP] MySQL Writes Exception for PHP in License

2004-03-13 Thread Red Wingate
When you compile PHP --with-mysql=/path/to/mysql you will use the
libs from the installed MySQL dist , when using the bundled MySQL
libs by compiling --with-mysql you can use MySQL feature even if
you haven't installed on your maschine.

Am Samstag, 13. März 2004 19:24 schrieb Karl Timmermann:
> So I guess PHP 5 can now include the MySQL libraries.
>
> Anyone know if they will include them with the first release of PHP 5,
> or have plans to?
>
> What difference will this make? I ask, because I read that just
> configuring with "--with-mysql=/usr" allows you to use MySQL with PHP
> 5. THis is how I always compiled with PHP 4, so I guess I don't really
> get how they included them before, and what the differences were/are
> going to be without the libraries?
>
>
> Thanks!
> Karl

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



Re: [PHP] HTML Utilities

2004-03-13 Thread Red Wingate
How about this:



function toList ( $array ) {
$temp = '';
foreach ( $array AS $item ) {
if ( is_array ( $item ) ) {
$temp .= ''.toList ( $array ).'';
} else {
$temp .= ''.$item.'';
}
}
return $temp ;
}
$array = array ( 10 , 20 , array ( 30 , 40 ) );

echo toList ( $array ) ;

?>

Haven't testet it but i think this should work out quite nice :)

Jeff Oien wrote:
Are there any ready made utilities out there for adding HTML
tags to lists? For example if I have:
This Thing
That Thing
The Other Thing
Lot More Things etc.
I would like to have something that would either add 
 (including  at beginning and end) or
. If there's nothing out there I'll try to do it myself
but then I'll have to bother you people with questions. :)
Jeff Oien
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] HTML Utilities

2004-03-13 Thread Red Wingate
woops :-)



function toList ( $array ) {
  $temp = '';
  foreach ( $array AS $item ) {
if ( is_array ( $item ) ) {
  $temp .= ''.toList ( $array ).'';
} else {
  $temp .= ''.$item.'';
}
  }
  return ''.$temp.'' ;
}
$array = array ( 10 , 20 , array ( 30 , 40 ) );

echo toList ( $array ) ;

?>

This should now be well formated :-)

Red Wingate wrote:

How about this:



function toList ( $array ) {
$temp = '';
foreach ( $array AS $item ) {
if ( is_array ( $item ) ) {
$temp .= ''.toList ( $array ).'';
} else {
$temp .= ''.$item.'';
}
}
return $temp ;
}
$array = array ( 10 , 20 , array ( 30 , 40 ) );

echo toList ( $array ) ;

?>

Haven't testet it but i think this should work out quite nice :)

Jeff Oien wrote:

Are there any ready made utilities out there for adding HTML
tags to lists? For example if I have:
This Thing
That Thing
The Other Thing
Lot More Things etc.
I would like to have something that would either add 
 (including  at beginning and end) or
. If there's nothing out there I'll try to do it myself
but then I'll have to bother you people with questions. :)
Jeff Oien

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


Re: [PHP] Re: determine logged in user

2004-03-16 Thread Red Wingate
Seen some interesting ways on doing this on the client. Basicly you run
a bash script ( on autostart for example ) and pass the login-info which
are saved in the enviroment to the server to make sure the user is known
by the server as well.
Another way could be to check wether the REMOTE_ADDR has authentificated
to the samba-server within a spec. timespan.
Greets,
  red
[snip]
Can PHP determine the username of the person currently logged into a
Windows 2K machine?
[snip]
On the machine running the client (web browser) or the machine running the
server?
On the client, no.  At least, I hope not.
On the server... ?  Maybe.  Maybe if you ran a login script that wrote the
username to a file that PHP read.  I can't really think of a clean way of
doing it.
[snip]

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


Re: [PHP] Re: determine logged in user

2004-03-16 Thread Red Wingate
One last thing, check the PHP-DEV Archives someone send a quite nice
trick on how to do that about 1-2 months ago.
Bye,
  red
Ashley wrote:

Thanks for the info guys.  I guess that I will just make a login screen 
of some sort to accomplish what I need.

Thanks again,
Ashley
Red Wingate wrote:

Seen some interesting ways on doing this on the client. Basicly you run
a bash script ( on autostart for example ) and pass the login-info which
are saved in the enviroment to the server to make sure the user is known
by the server as well.
Another way could be to check wether the REMOTE_ADDR has authentificated
to the samba-server within a spec. timespan.
Greets,
  red
[snip]

Can PHP determine the username of the person currently logged into a
Windows 2K machine?


[snip]

On the machine running the client (web browser) or the machine 
running the
server?
On the client, no.  At least, I hope not.
On the server... ?  Maybe.  Maybe if you ran a login script that 
wrote the
username to a file that PHP read.  I can't really think of a clean 
way of
doing it.


[snip]


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


Re: [PHP] Re: determine logged in user

2004-03-16 Thread Red Wingate
Here you go:

http://marc.theaimsgroup.com/?l=php-dev&m=107732506523441&w=2

Have fun,
   red
Ashley wrote:

Do you happen to know what the subject was?  I cannot seem to find the 
particular post you are mentioning.

Ashley

Red Wingate wrote:

One last thing, check the PHP-DEV Archives someone send a quite nice
trick on how to do that about 1-2 months ago.
Bye,
  red
Ashley wrote:

Thanks for the info guys.  I guess that I will just make a login 
screen of some sort to accomplish what I need.

Thanks again,
Ashley
Red Wingate wrote:

Seen some interesting ways on doing this on the client. Basicly you run
a bash script ( on autostart for example ) and pass the login-info 
which
are saved in the enviroment to the server to make sure the user is 
known
by the server as well.

Another way could be to check wether the REMOTE_ADDR has 
authentificated
to the samba-server within a spec. timespan.

Greets,
  red
[snip]

Can PHP determine the username of the person currently logged into a
Windows 2K machine?




[snip]

On the machine running the client (web browser) or the machine 
running the
server?
On the client, no.  At least, I hope not.
On the server... ?  Maybe.  Maybe if you ran a login script that 
wrote the
username to a file that PHP read.  I can't really think of a clean 
way of
doing it.




[snip]





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


Re: [PHP] Re:

2004-03-16 Thread Red Wingate
[...]
> Why are so many people telling this poor person to escape their quotes?
> That WILL NOT WORK in HTML. The correct way to do this is to use
> htmlspecialchars() or htmlentities(). In fact, this should always be
> done on dynamic values in an input or any other HTML data that should be
> displayed literally, such as for within textareas.
[...]

Thanks, was just about to write that as i read all of these 'use escape-chars
in HTML'-guys.

   red

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



Re: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Red Wingate
Maybe you guys should take a read about pre- and post-increment :-)

Sam Masiello wrote:
This drove me nuts for a while and instead of doing $variable++ I
started using ++$variable and never had the problem again.
--Sam

Jake McHenry wrote:

No.

$correct++;

Is all you need for the second condition, it automatically sets
itself back. 



Does this always work? In my timesheet app, I have to do $counter =
$counter + 1, because for some reason the $counter++; doesn't work.
It just + doesn't
work, no incrementation of the variable. Is there something in
php.ini that can prohibit this from working? 

Thanks,
Jake


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


  1   2   >