Re: [PHP] Replace space from form field using preg_replace

2004-03-17 Thread Red Wingate
str_replace(" ","+",$var); -- red Vernon wrote: I want to be able to replace a space that comes from a form field (such as in 123 My Street) with a + sign. Can anyone help me with this? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: Problems with PHP5 RC1

2004-03-19 Thread Red Wingate
I'm running RC1 on Win2k 2.0.47 without any problems. Make sure u updated your PATH settings as some folders got renamed or moved. Add /path/to/php and /path/to/php/dlls to your PATH setup. Switch 'extensions' to 'ext' in your php.ini as well if you still have an old version from an old PHP5 beta o

Re: [PHP] 9 Months Ago

2004-03-20 Thread Red Wingate
mktime returns an Unix Timestamp, you need to format it using date( [form] , <[timestamp]> ). http://php.net/date Jeff Oien wrote: When I do this: $lastmonth = mktime(0, 0, 0, date("m")-9, date("d"), date("Y")); echo "$lastmonth"; It prints this: 1056081600 Could you tell me what I'm missing? Tha

Re: [PHP] Question for PHP.net

2004-03-22 Thread Red Wingate
Hi, > Dear PHP.net, > I have got a question!!! > I`ll develop a new PHP Site and threr is a problem with Hyperlinks!!! First of all, there is no problem with hyperlinks, you maybe have an problem understanding how to use hyperlinks. > How can I use "index?nav=Webmaster"?? > Whats the source cod

Re: [PHP] Fill strings with  

2004-03-22 Thread Red Wingate
Hi Merlin, guess there is no php function which handles this, but you can easily use str_replace to do this. http://php.net/str_replace -- red Am Montag, 22. März 2004 13:02 schrieb Merlin: > Hi there, > > I was searching for a php function which fills empty spaces in string > varibales with

Re: [PHP] receiving ndr for each email sent to list

2004-03-22 Thread Red Wingate
Same here, but even without replying :-/ Chris W. Parker wrote: Jay Blanchard on Monday, March 22, 2004 10:51 AM said: [snip] i imagine other people are experiencing this also but i'm receiving the following email every time i send a message to the list. [/snip] RO

Re: [PHP] login scripts not secure?? help!

2004-03-23 Thread Red Wingate
hi, securepage.php?_SESSION[username]=admin&_SESSION[pwd]=password would not register 'username' and 'pwd' to the $_SESSION array but to the $_GET and $_REQUEST-Array like: $_GET['_SESSION']['username'] => 'admin' There is no way to inject any kind of data to the super-global Arrays at all

Re: [PHP] Constants

2004-03-23 Thread Red Wingate
IIRC it was changed to self::CONST_NAME recently interface Settings { const UNAME = "somename"; const PWORD = "password"; const SERVER = "localhost"; } class Conn implements Settings { public function __construct(){ $dbConn = mysql_connect(self::SERVER, self::UNAME, self

Re: [PHP] Constants

2004-03-23 Thread Red Wingate
Give this a read: http://marc.theaimsgroup.com/?l=php-dev&m=107936530102181&w=2 Am Dienstag, 23. März 2004 15:16 schrieb Red Wingate: > IIRC it was changed to > self::CONST_NAME recently > > interface Settings { >const UNAME = "somename"; >const P

Re: [PHP] Crash in PHP5RC1 but can't find where

2004-03-25 Thread Red Wingate
Hi David, same thing i reported to the PHP-DEV List some time ago ( before RC1 was released ). The problem is the Win32/Apache2 Combination you are using. I am not completely sure, but it looks like debug_backtrace(); causes this crash. Maybe look at my little script for details: http://download

Re: [PHP] [4.3.4] Can't ksort a subarray

2004-03-25 Thread Red Wingate
while (list($key,$dim2) = each ($A)) { uksort ( $A[ $key ] , "strcasecmp"); } print_r ($A); $dim2 will not change $A[ $key ], so you will have to change your script to alter them directly. -- red [] > I have this little code. > I want all arrays sorted case insensitive key order, but only

Re: [PHP] reg expression for ide-emails

2004-03-29 Thread Red Wingate
Oh yeah, 'Look @ the screen. You will find wonderfull colors there!' doesn't look like an e-mail adress, does it ? A basic approch to really check the syntax would be: preg_match("#^\s*[-\w_]+(\.[-\w_]+)[EMAIL PROTECTED](\.[-\w_]+)+\s*$#sim", $email) Add your special german or french characters

Re: [PHP] Crash in PHP5RC1 but can't find where

2004-03-30 Thread Red Wingate
then i think there is a problem how PHP handles debug info- rmation (as this seams to happen using reflections as well) -- red > Red Wingate wrote: > > Hi David, > > > > same thing i reported to the PHP-DEV List some time ago ( before RC1 > > was released ).

Re: [PHP] Is There a Stack Trace for Errors?

2004-03-31 Thread Red Wingate
Maybe you would like to check out debug_bracktrace(); Hawkes, Richard wrote: Hi Gang, I'm now writing the dreaded support document for the code, and I need to enhance my PHP to show error numbers so we can diagnose where it failed. All fine so far, but I've found a couple of functions that can be

Re: [PHP] Regex

2004-03-31 Thread Red Wingate
preg_match( "#39->([0-9]{8})#" , $source , $result ); Brent Clark wrote: Hi all does anyone know of a regex expression to get only the number number from after the Code 39 Kind Regards Brent Clark 1 barcodes found Code 39->10005215 This is the search1 barcodes found 2 barcodes found Code 39->1

Re: [PHP] Regex

2004-03-31 Thread Red Wingate
Faster, but wrong. Take a look at his question and examples. Burhan Khalid wrote: Brent Clark wrote: Hi all does anyone know of a regex expression to get only the number number from after the Code 39 Kind Regards Brent Clark 1 barcodes found Code 39->10005215 $barcodes = "Code 39->10005216"

Re: [PHP] Domain Name ?

2004-04-01 Thread Red Wingate
How about RTFM ? http://de2.php.net/parse_url Ryan A wrote: On 4/1/2004 11:58:01 AM, Ralph Guzman ([EMAIL PROTECTED]) wrote: The easy way... $domain = "http://www.foo.com";; $domain = explode('.', $domain); $foo = $domain['1']; Yep, thats the easy and good solution, but be warned if a subdom

Re: [PHP] Domain Name ?

2004-04-01 Thread Red Wingate
This was going for the guy that started this thread :p John W. Holmes wrote: From: "Ryan A" <[EMAIL PROTECTED]> On 4/1/2004 3:57:57 PM, [EMAIL PROTECTED] wrote: How about RTFM ? http://de2.php.net/parse_url Was that RTFM for me? or for the guy who originally wrote or for the first guy who repli

Re: [PHP] elementary question about reading an array ...

2004-04-01 Thread Red Wingate
Yet again maybe one would check the output before replying: Array ( [0] => bc Object ( [fullname] => Kent Huffman ... ) ) This is what we see: echo $db['fullname']; // nope echo $db[0]->fullname // ah !!! -- red Kenn Murrah wrote: [snip] [snip] In code that I did not create (

Re: [PHP] Relative Url

2004-04-02 Thread Red Wingate
Hi chris, Haven't much time now but maybe you can find a way with those ideas: in pollFunctions.php do : $pollFunctions_path = str_replace( basename ( _FILE_ ) , '' , _FILE_ ); in foo.php do : $foo_path = str_replace( basename ( _FILE_ ) , '' , _FILE_ ); Now you just have to compute the diff

Re: [PHP] Relative Url

2004-04-02 Thread Red Wingate
e if ( isset($target[$i]) AND $origin[$i] != $target[$i] ){ $append .= $target[$i].'/'; if ( isset($origin[$i]) ){ $string .= '../'; } }else{ $string .= '../'; } } return $string.$append; }

Re: [PHP] code design? modular?

2004-04-02 Thread Red Wingate
http://php.net/function :-) Andy B wrote: is it ok practice to put code like the code to put results from an mysql query into a combo box into an include file and then just include it wherever its needed? the code i can see would have to be used at least 5 times in the same page -- PHP Gene

Re: [PHP] code design? modular?

2004-04-02 Thread Red Wingate
hmmm was wrong there ... it's http://php.net/manual/en/functions.php Red Wingate wrote: http://php.net/function :-) Andy B wrote: is it ok practice to put code like the code to put results from an mysql query into a combo box into an include file and then just include it whereve

Re: [PHP] Image output (Newb question)

2004-04-02 Thread Red Wingate
use the output-buffer functions ( ob_start() ... etc.. ) but if you want to display an image you need to only display a image by your image or save it to a file and view it using the html tag. Fidencio Monroy wrote: Np, but I do not understand: Do should I remove all the html tags before the sc

Re: [PHP] Global $_FILEs

2004-04-02 Thread Red Wingate
give us some more info how do you 'pass' the array to your function, remeber $_FILES is a super-global array in is available in the functions scoope as well. -- red Bruno Santos wrote: Hello all. I'm developing a script that requires the user to upload 2 files. i want to put all the lin

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Red Wingate
trim will not work, try something like: $id = preg_replace("/^0+(.*)$/","//1",$id); instead Monty wrote: I tried removing the zeros, but, I get the same result: $id = 11; $id = ltrim($id, '0'); echo $id; // Displays: 9 instead of 11 ??? This didn't work either

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Red Wingate
sry... it's \\1 instead of //1 ... guess i had one to many beers :) Red Wingate wrote: trim will not work, try something like: $id = preg_replace("/^0+(.*)$/","//1",$id); instead Monty wrote: I tried removing the zeros, but, I get the same result: $id = 11

Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Red Wingate
hm ever tryed telling PHP to display the variable as an integer? echo (integer) $id ; -- red Daniel Clark wrote: Doesn't putting and x11 tell PHP it's a decimal format? $id = 11; $id2 = preg_replace("/^0+(.*)$/","\\1",$id); echo $id2; // Displays 9 echo $id;

Re: [PHP] checking for existance of $_SESSION variables

2004-04-03 Thread Red Wingate
Hi Andy, Session Variable $guestbook exists? echo isset ( $_SESSION['guestbook'] ) ? 'yes' : 'no' ; Session Variable $guestbook exists and is not empty? echo ( isset ( $_SESSION['guestbook'] ) AND empty ( $_SESSION['guestbook'] ) === FALSE ) ? 'yes' : 'no'; -- red Andy B wrote: hi... i ha

Re: [PHP] Keep HTML tags, but strip attributes

2004-04-03 Thread Red Wingate
something like this might work (written on the fly): $var = preg_replace( "/<\s*([a-z]+)([^>]*)>/i" , "" , $var ); special action on the closing tags is not necc. as they don't contain any attributes. -- red Matt Palermo wrote: Okay, I have it all set to remove ALL tags and their attributes th

Re: [PHP] RE: [PEAR] WARNING! Virus

2004-04-01 Thread Red Wingate
interessting, as those lists only allow text/plain files to be attached Daniel Kopp wrote: Hi! People who do not check anything that comes in by internet should see a doctor concerning suicidal tendences. Over here - every day I get at least one virus (probably 2-3). But ... who cares ... Norton,

Re: [PHP] How to built desktop applications.

2004-04-05 Thread Red Wingate
PHP-GTK Am Montag, 5. April 2004 10:43 schrieb [EMAIL PROTECTED]: > Hi all, > I know that is possible to built desktop applications with PHP > (applications that run only on desktop and not client applications). How is > possible this? > Is necessary use the php standard or there is help from othe

Re: [PHP] mktime error

2004-04-05 Thread Red Wingate
Your Server will most likely run in a different timezone. If both of you would use gmktime() the result will be the same. As for the negative result: Had the same problem some time ago - seams to me as if PHP doesn't like those 0,0,0 ( try 0,0,1 instead ) - You can adjust the result by reducing th

Re: [PHP] mktime error

2004-04-05 Thread Red Wingate
Woops little mistake there, first of all it's 'gmmktime()' secondly the source should look something like: $var = mktime ( 0,0,1,4,4,2004 ) - 1; You can find a nice article on this topic here: http://www.phpbuilder.com/columns/ehresman20030911.php3?page=1 -- red [...] > Your Server will most

Re: [PHP] mktime error

2004-04-05 Thread Red Wingate
You could do this like this ( as it is faster ): function CreateDate($day, $month, $year) { return $year.$month.$day.'00'; } CreateDate(04,04,2004) -> 2004040400 But make sure you add the leading zero to $month and $day ( can be easily done (number_format for example) ) -- red Am

Re: [PHP] Re: session_exist() ?? Can this be done?

2004-04-05 Thread Red Wingate
Hi, just on a side-note, the session is not always kept in a cookie ( if cookies are deactivated the session is saved in the _GET or _POST variables. A check for $_REQUEST[session_name()] might help you some more but can be exploited quite fast eg: index.php?SID=foo I guess the best way to so

Re: [PHP] Re: session_exist() ?? Can this be done?

2004-04-05 Thread Red Wingate
Again, as a sidenote, this is the first example of the PHP session documentation: [ quote - http://de.php.net/session ] [ /quote ] When using exactly this script you could check wether $_SESSION['count'] equals 0 to make sure the session was just created. -- red again :-) Red Win

Re: [PHP] Re: Reusing MySQL Connections - Can it be done?

2004-04-06 Thread Red Wingate
[...] > > I tried this, but, same results. If I store the Resource ID from a > > mysql_pconnect() in $GLOBALS['_CONNECT_DB'] and then call... > > > > mysql_query($query, $GLOBALS['_CONNECT_DB']); [...] > > How are you setting the global? > [...] I guess he said he is using $GLOBALS['_CONNECT_

Re: [PHP] php + lynx + grep

2004-04-06 Thread Red Wingate
Functions like system, exec etc aren't supported by most ISP ( at least over here in germany ). But you might give file_get_contents(); file(); ... a look as they can read the output of HTTP request which might be easier: $var = file ( 'http://weather.noaa.gov/weather/current/KTOL.html' ); fore

Re: [PHP] function CreateDate i made doesnt work?

2004-04-06 Thread Red Wingate
I've seen this type of creating a timestamp quite often now and was even so often shaking my head about it. Guess i've seen it somewhere in the PHP Documentation's user contributed notes on day. Just google for the term and you will find many hits like this: http://www.mail-archive.com/[EMAIL P

Re: [PHP] Not exactly PHP....

2004-04-06 Thread Red Wingate
[...] > > [snip] > > can anyone email me explaining me how to crate my own news group? for > > free... > > [/snip] > > > > First, you get a box (sometimes known as a crate) > > > > Brought to you by the This Message Didn't Cost You a Dime & May Have > > Brought A Smile To Another's Face Committ

Re: [PHP] regular expression

2004-04-07 Thread Red Wingate
Alright, first of all, in E-Mail Headers every param needs to be written in a seperate line, therefore following will work even with multiple recipients: $recipients = array(); $header = explode( "\n" , $header ); foreach ( $header AS $param ) { $param = trim ( $param ); if ( strtolower

Re: [PHP] assign mysql query to a variable first or not

2004-04-07 Thread Red Wingate
One of the greatest benefits is the fact, that you can easily display your actual query without copying it, passing it to a variable and then display it's content: $result = mysql_query( ); would first become: $var = ; $result = mysql_query( ); echo $var ; now if the query fails,

Re: [PHP] Validating form field text input to be a specificvariable type

2004-04-07 Thread Red Wingate
An RegExp will work but is not as fast as native functions, but you could use something like: $len1 = strlen ( $input ); $len2 = strspn ( $input , "1234567890,." ); if ( $len1 == $len2 ) { echo 'yuuhooo'; } else { echo 'd\'oh'; } [...] > > From: "William Lovaton" <[EMAIL PROTECTED]> > > >

Re: [PHP] Validating form field text input to be aspecificvariable type

2004-04-07 Thread Red Wingate
Why not add a function: display_my_cms(); This function will check the current cirumstances and displays an CMS system which fits 100% in every enviroment and layout. Even if new technics are available those will suddenly appear ( maybe CSS3 ). [...] > That's not bloat. And using a lot of li

Re: [PHP] Validating form field text input to be a specificvariable type

2004-04-07 Thread Red Wingate
No, as this would be yet another line of source. Maybe get those guys to add another function ctype_digit_and_not_empty(); -- red [...] > > * Thus wrote William Lovaton ([EMAIL PROTECTED]): > > > or modify is_numeric() to explictly perform an integer validation: > > > is_numeric(mixed value [,

Re: [PHP] confused big time

2004-04-07 Thread Red Wingate
You could even do: $sql .= " ( '".implode( "','" , $a )."' )"; This way everything is quoted though ( but this doesn't matter using MySQL anyway ). If you want to escape the values of $a you could use array_map to do this also without having to loop :-) -- red [...] > To get your list of colu

Re: [PHP] PHP 5: SimpleXML attributes

2004-04-07 Thread Red Wingate
There is a way, but somehow i don't like it though ( but you can find this in the documentation ): This is config.xml: FALSE And my Testfile: $xml = simplexml_load_file( 'config.xml' ); foreach ( $xml->lib_error->param AS $id => $param ) { echo $param['name'] ; /

Re: [PHP] PHP 5: SimpleXML attributes

2004-04-07 Thread Red Wingate
ributes() AS $a => $b ){ echo $a .' --> '. $b .''; } $n++; } } -- red Dan Phiffer wrote: Red Wingate wrote: FALSE > $xml = simplexml_load_file( 'config.xml' ); foreach ( $xml->lib_error->p

Re: [PHP] PHP 5: SimpleXML attributes

2004-04-07 Thread Red Wingate
:-) -- red Dan Phiffer wrote: Red Wingate wrote: So, this one will work out quite well ( maybe one should take a look at the documentation of attributes() :-) Wow I can't believe I missed that. Hehe. I guess the lesson here is don't always trust what you get from print_r(). Than

Re: [PHP] PHP OO concepts

2004-04-07 Thread Red Wingate
You will find some usefull ressources over at http://www.phppatterns.com/ -- red Robert Cummings wrote: [...] Hello, I have am checking out PHP OOP and it's pretty smooth. I have a decent amount of Java experience so PHP OOP is really easy to pick up. However I have a few questions I was hop

Re: [PHP] Newbie question about operators

2004-04-07 Thread Red Wingate
arrays :-) you are defining arrays like: $x = array ( 'a' => 'Apple' , 'b' => 'Banana' , ... ); -- red Gabe wrote: Thanks for the page. That was helpful. Just to make sure, is that operator only typically used then with foreach loops and arrays? "Matt Matijevich" <[EMAIL PROTECTED]> wrote i

Re: [PHP] Validating form field text input to be a specificvariable type

2004-04-07 Thread Red Wingate
refully the function that you propose is doing two things at once... at this level this is not a good idea. -William El mi? 07-04-2004 a las 12:39, Red Wingate escribió: No, as this would be yet another line of source. Maybe get those guys to add another function ctype_digit_and_not_empty(); -

Re: [PHP] Administrator page and password problem

2004-04-07 Thread Red Wingate
You mixed up here a little :-) [...] > if (strlen($_POST['password1']) > 0) { > if ($_POST['password1'] == >($_POST['password2'] { > 1. $password = TRUE; > > } else { > $password = FALSE; > echo '' > } > } else { > $password = FALSE; >

Re: [PHP] Validating form field text input to be a specificvariable type

2004-04-07 Thread Red Wingate
are considered empty() too. -William El mi? 07-04-2004 a las 16:34, Red Wingate escribió: JFYI : var_dump ( '' == 0 ) eq TRUE William Lovaton wrote: I don't think so, Wouldn't be better if ctype_digit() return false on an empty string?? any way an empty string is not

Re: [PHP] Re: Can someone with list access please remove these two?

2004-04-07 Thread Red Wingate
yep William Lovaton wrote: me too! -William El mi? 07-04-2004 a las 16:44, Justin Patrin escribió: Richard Davey wrote: Hi, Subject says it all - they're causing auto-responder junk to any list poster and it's annoying: Information Desk <[EMAIL PROTECTED]> Advance Credit Suisse Bank <[EMAIL

Re: [PHP] Re: Administrator page and password problem

2004-04-07 Thread Red Wingate
Add this into the VERY last line : [...] 0) { $name = TRUE; } else { $name = FALSE; echo 'you have forgot to enter your name'; } // check for email adress if (strlen($_POST['email']) > 0) { $email = TRUE; } else { $email = FALSE; echo 'you have forgot to enter your email adress'; }

Re: [PHP] page design and possible conflict??

2004-04-08 Thread Red Wingate
ok Am Donnerstag, 8. April 2004 14:45 schrieb Andy B: > dont know what his deal is but ok will close this idea now i guess.. > > - Original Message - > From: "Miles Thompson" <[EMAIL PROTECTED]> > To: "Andy B" <[EMAIL PROTECTED]> > Sent: Thursday, April 08, 2004 7:41 AM > Subject: Re: [PHP

Re: [PHP] Using WinNT login

2004-04-08 Thread Red Wingate
Search the archive, we had this topic about a month ago and i pointed out a quite good solution on this topic. -- red > Hi All, > > Is it possible to use the users WinNT network login for a php app? > If so can someone point me in the direction for a tutorial or directions. > > > Thanks, > > >

[PHP] Re: Globally accessible objects without using 'global $obj;'

2004-11-12 Thread Red Wingate
Hi Chris, Something that worked out very well for me was using a function that would take care of the error handling ... kind of define ( 'ERR_TYPE_ERROR' , 1 ) ; define ( 'ERR_TYPE_WARNING' , 2 ) ; class Error { // error handling code here } function _handleError ( $msg , $type ) { static

[PHP] Re: Display only one filed of the repeated records

2004-11-30 Thread Red Wingate
Hi Ahmed, hope this helps: $ary = array() ; $sql = "SELECT COUNT(*), category FROM movies GROUP BY category" ; $res = mysql_query ( $sql ) ; while ( $line = mysql_fetch_assoc ( $res ) ) { $ary[] = $line[ 'category' ] ; } echo implode ( " - " , $ary ) ; -- red Ahmed Abdel-Aliem wrote: >

[PHP] Re: Custom Open Tags

2004-12-03 Thread Red Wingate
Hi Sven, i was in the need to allow #sim"Â,Â$contentÂ,Â$source_partsÂ); foreachÂ(Â$source_parts[1]ÂASÂ$idÂ=>Â$php_sourceÂ)Â{ ob_start();Â eval(Âereg_replace(Â"\\$([a-zA-Z_][a-zA-Z0-9_]*)"Â, "\$GLOBALS[\"\\1\"]" , $php_source ) ); $contentÂ=Âstr_replace(Â$source_parts[0]

<    1   2