php-general Digest 21 May 2001 13:20:48 -0000 Issue 699 Topics (messages 53649 through 53708): PLEASE --> Compiling an extension for PHP module (pgsql.so --> missing libpq.so.2) 53649 by: Jason Re: function to complete strings with white spaces on the left 53650 by: Mark Maggelet 53700 by: Craig Vincent <?=SID?> is not translated... 53651 by: Christian Marschalek undo htmlspecial 53652 by: Nicholas should be simple 53653 by: Richard Kurth 53654 by: Jason Murray 53655 by: Richard Kurth 53656 by: Gerard Onorato e*reminder and cron 53657 by: Henry 53679 by: James Holloway query question 53658 by: Jacky 53662 by: Maxim Maletsky How to loop the HTTP_POST_VARS array? 53659 by: Carlos Fernando Scheidecker Antunes 53660 by: Carlos Fernando Scheidecker Antunes 53664 by: Maxim Maletsky 53665 by: Rasmus Lerdorf 53693 by: Carlos Fernando Scheidecker Antunes php3 vs php4 and ini_get 53661 by: Dennis Gearon Re: [PHP-DEV] Fork() in php? 53663 by: Greg Wright 53666 by: Frank Joerdens 53667 by: Frank Joerdens 53694 by: Plutarck porting from perl 53668 by: Matt Broughton 53671 by: Brian Clark Trimming 2 Characters from the end of a string? 53669 by: Jason 53670 by: Rasmus Lerdorf 53688 by: Gyozo Papp Cannot "view source" via IE browser 53672 by: John M 53673 by: Maxim Maletsky Re: ok, are servlets/jsp faster than php4? 53674 by: Steven Haryanto 53697 by: Plutarck comparison operators 53675 by: Heidi Belal 53695 by: Christian Reiniger How to test content encoding? 53676 by: Plutarck 53696 by: Christian Reiniger OOT - postgress help 53677 by: toto 53702 by: Gyozo Papp Re: file() 53678 by: elias select the max value 53680 by: Jacky 53682 by: Craig Vincent 53684 by: Tom Rogers 53687 by: Gyozo Papp security 53681 by: Ker Ruben Ramos UK based Hosting? 53683 by: Tarrant Costelloe Re: include() in a file incuded() 53685 by: Christian Reiniger Re: PHP and XHTML 53686 by: Christian Reiniger Re: RegEx Question 53689 by: Gyozo Papp checking to see if part of a variable exists? 53690 by: Sandeep Hundal 53691 by: James Holloway 53692 by: Jon Haworth Quotes in GET variables 53698 by: Mark Rogers 53701 by: Plutarck 53703 by: Mark Rogers 53705 by: James Holloway Re: get all defined constants? 53699 by: Plutarck generating thumbnails 53704 by: Samuel Lüscher 53706 by: George E. Papadakis 53707 by: Shawn Reed What's wrong with this code? 53708 by: Plutarck Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
Hi, I'm trying to compile an extension for Postgre support which I will either load in the php.ini or use the dl() function. Both methods fail right now. The dl() function gives me verbose though. I compiled the module like this: ./configure --with-apache=/usr/local/Apache/apache_13 --with-pgsql=shared make I entered the php_4.0.5/modules directory. I see two files pgsql.so and pgsql.la. I copy both to /usr/local/lib (where my libs sit as specified in php.ini). I restart the server and I get an error saying a shared library (libpq.so.2) cannot be found. I went to /usr/local/pgsql/lib and copy libpq.so.2 to /usr/local/lib. Now I get the following error: Warning: Unable to load dynamic library '/usr/local/lib/pgsql.so' - /usr/local/lib/pgsql.so: Undefined symbol "zend_ini_boolean_displayer_cb" in /public_html/inc/mainfile.php on line 3 Whats the deal with this? I am compiling right? Should php have produced a different libpq.so.2 file elsewhere? THANKS!!!
On Sun, 20 May 2001 22:03:05 -0300, Carlos Fernando Scheidecker Antunes ([EMAIL PROTECTED]) wrote: >Hello All, > >I need to output a string that must always be 17 characters even if >the inside value is not. > >Supose a have the HELLO word that is a 5 character string and I need >to output "HELLO " which is 17 characters. >How can I accomplish this in PHP4 ? > >Has anyone ever did it? echo str_pad("HELLO",17);
untested! <? if (strlen($word) < 17) { $padding = 17-strlen($word); $word .= str_repeat(' ', $padding); unset($padding); } ?> The reason for the if statement is that str_repeat will produce an error if 17-strlen($word) <= 0 and that'll break your script....of course you could remove the if state if you're positive the # of characters in $word never exceeds 16. Sincerely, Craig Vincent
My system does not tranlate <?=SID?> into the PHP Session id... Don't have a clue why, though... Any clues? Tia! Chris
-----BEGIN PGP SIGNED MESSAGE----- Hash: MD5 someone was looking for an undo htmlspecial chars well i found a snipet on sourcefourge i forgot who sent the mail so here you go who ever you are.. function unconvert_htmlspecialchars($string) { if( strlen($string) < 4 ) { return $string; } else { $string=str_replace(' ', ' ', $string); $string=str_replace('"', '"', $string); $string=str_replace('>', '>', $string); $string=str_replace('<', '<', $string); $string=str_replace('&', '&', $string); return $string; } } - -- Best regards, Nicholas mailto:[EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: 2.6 iQCVAwUAOwh4trovzXm8USdPAQFHCwQAq4xR+xFzDesNaEbyh9yXi6pZvLUFD/ef Rb5OfkXr6qj84JSzAdQpDFKVDxabQ0rLY0SdMJqgkwc6Er+TdfyZ49tP3UhUK1it fBC3HtIJspugG9ld0yF7vgNkWoDwtfiPPcN63y6Nb3xWmL1HVSNVf3cHnbFrNtAg UNmJ6Gz/oTQ= =XOxm -----END PGP SIGNATURE-----
I am trying to pull html code out of a database to put in page something like this which I have stored in a database under cheader <html> <head> <title></title> </head <body> <div align='center'> <img src="../autowebpages/autosetup.gif' width='406'height='158'border='0' alt=''></div> It seams all I have to do is put <?echo $cheader?> at the top of the page and it should work just like putting variables into a page. But is does nothing. I would look in the manual or the archives but I don't no wear or what to look for. It seams this should be simple what am I missing hear Best regards, Richard mailto:[EMAIL PROTECTED]
> It seams all I have to do is put <?echo $cheader?> at the top of the > page and it should work just like putting variables into a page. > > But is does nothing. I would look in the manual or the archives but I > don't no wear or what to look for. It seams this should be simple what > am I missing hear It sounds to me like you're trying to store PHP code in the database and have it execute it before sending it to the browser, is this correct? If it is: You can't do this just like that. Your PHP code is text in the database, and when PHP pulls it out and echo's the whole thing it'll just send it to the browser. You might need to use eval(). More info: http://www.php.net/manual/en/function.eval.php If it's not: I got the wrong idea, so please explain some more. :) Jason
Hello Richard, Never Mind It was a stupid mistake I am querying all the data in a function and forgot to add the variable to the global list work just fine DU!! Monday, May 21, 2001, 7:08:16 AM, you wrote: Richard Kurth> I am trying to pull html code out of a database to put in page Richard Kurth> something like this which I have stored in a database under cheader Richard Kurth> <html> Richard Kurth> <head> Richard Kurth> <title></title> Richard Kurth> </head Richard Kurth> <body> Richard Kurth> <div align='center'> Richard Kurth> <img src="../autowebpages/autosetup.gif' Richard Kurth> width='406'height='158'border='0' alt=''></div> Richard Kurth> It seams all I have to do is put <?echo $cheader?> at the top of the Richard Kurth> page and it should work just like putting variables into a page. Richard Kurth> But is does nothing. I would look in the manual or the archives but I Richard Kurth> don't no wear or what to look for. It seams this should be simple what Richard Kurth> am I missing hear Richard Kurth> Best regards, Richard Kurth> Richard Richard Kurth> mailto:[EMAIL PROTECTED] -- Best regards, Richard mailto:[EMAIL PROTECTED]
Richard, Forgive me for stating the obvious. How are you filling the variable $cheader? If you are simply putting an echo command without pulling the info from the database first you will obviously be getting nothing. Gerard -----Original Message----- From: Richard Kurth [mailto:[EMAIL PROTECTED]] Sent: Monday, May 21, 2001 10:08 AM To: [EMAIL PROTECTED] Subject: [PHP] should be simple I am trying to pull html code out of a database to put in page something like this which I have stored in a database under cheader <html> <head> <title></title> </head <body> <div align='center'> <img src="../autowebpages/autosetup.gif' width='406'height='158'border='0' alt=''></div> It seams all I have to do is put <?echo $cheader?> at the top of the page and it should work just like putting variables into a page. But is does nothing. I would look in the manual or the archives but I don't no wear or what to look for. It seams this should be simple what am I missing hear Best regards, Richard mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
i'd like to run something like http://sourceforge.net/projects/e-reminders/ on my site. it uses cron to trigger the mail to be sent. i'm not familiar with unix and cron. apparently i need to use shell access on my site to get this working. anybody got any tips to get cron working in the simplest way. cheers Henry http://www.bigjolt.com
Hi Henry, I'm not too familiar with Cron, but check the man pages for cron and crontab (type 'man cron' or 'man crontab', or type 'man man' if you've not used man pages before). James. ""Henry"" <[EMAIL PROTECTED]> wrote in message 018b01c0e19d$544818a0$046265cb@henry">news:018b01c0e19d$544818a0$046265cb@henry... > i'd like to run something like http://sourceforge.net/projects/e-reminders/ > on my site. it uses cron to trigger the mail to be sent. > > i'm not familiar with unix and cron. apparently i need to use shell access > on my site to get this working. > > anybody got any tips to get cron working in the simplest way. > > cheers > Henry > http://www.bigjolt.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Hi all What do I do if i want to move all values stored in one field to another field in the same table, from field A to field B? Has anyone ever done that? Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself"
several times: UPDATE table SET B=A; Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Jacky [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 22, 2001 12:37 AM To: [EMAIL PROTECTED] Subject: [PHP] query question Hi all What do I do if i want to move all values stored in one field to another field in the same table, from field A to field B? Has anyone ever done that? Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself"
Hello all, I'm trying to loop the $HTTP_POST_VARS variable like an array like this : $index = count($HTTP_POST_VARS); for($i=0; i < $index; i++) { $itens = $HTTP_POST_VARS[$i]; } But it is not working. Can anoyone tell me how to do it? Thanks, Carlos Fernando.
Oops. I've got a typo : $itens[] Here's the correct code : Hello all, I'm trying to loop the $HTTP_POST_VARS variable like an array like this : $index = count($HTTP_POST_VARS); for($i=0; i < $index; i++) { $itens[] = $HTTP_POST_VARS[$i]; } But it is not working. Can anoyone tell me how to do it? Thanks, Carlos Fernando.
no, you are trying to get an $HTTP_POST_VAR[integer]... it is not there. The keys are your variable names, therefore this is correct: foreach($HTTP_POST_VARS as $key=>$val) { $itens[] = $val; } will fit everything form ..POST_VARS into $itens array. BUT you'll loose all the key names, knowing nothing of where these values came from. try rather do this: foreach($HTTP_POST_VARS as $key=>$val) { $itens[$key] = $val; } this will result you true: if($HTTP_POST_VARS['var_name'] == $itens['var_name']) {} Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Carlos Fernando Scheidecker Antunes [mailto:[EMAIL PROTECTED]] Sent: Monday, May 21, 2001 12:43 PM To: PHP-GENERAL Subject: [PHP] How to loop the HTTP_POST_VARS array? Importance: High Oops. I've got a typo : $itens[] Here's the correct code : Hello all, I'm trying to loop the $HTTP_POST_VARS variable like an array like this : $index = count($HTTP_POST_VARS); for($i=0; i < $index; i++) { $itens[] = $HTTP_POST_VARS[$i]; } But it is not working. Can anoyone tell me how to do it? Thanks, Carlos Fernando. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
foreach($HTTP_POST_VARS as $key => $val) { echo "$key: $val<br>\n"; } On Mon, 21 May 2001, Carlos Fernando Scheidecker Antunes wrote: > Hello all, > > I'm trying to loop the $HTTP_POST_VARS variable like an array like this : > > $index = count($HTTP_POST_VARS); > > for($i=0; i < $index; i++) { > $itens = $HTTP_POST_VARS[$i]; > } > > But it is not working. > > Can anoyone tell me how to do it? > > Thanks, > > Carlos Fernando. >
Maxim, This is great. Thank you very much !! I really appreciate your explanation since I did not get anything this good in any of my books. Since all the values that I need to retrieve are CheckBoxes that are Named C1,C2,C3,C... I have done the following and it worked : function RetrieveItens() { global $Itens; global $HTTP_POST_VARS; $index = count($HTTP_POST_VARS); for($i=1; $i <= $index; $i++) { if (isset($HTTP_POST_VARS["C$i"])) $Itens[] = $HTTP_POST_VARS["C$i"]; } $index = count($Itens); return $index; } // function RetrieveItens ----- Original Message ----- From: "Maxim Maletsky" <[EMAIL PROTECTED]> To: "'Carlos Fernando Scheidecker Antunes'" <[EMAIL PROTECTED]>; "PHP-GENERAL" <[EMAIL PROTECTED]> Sent: Monday, May 21, 2001 1:00 AM Subject: RE: [PHP] How to loop the HTTP_POST_VARS array? no, you are trying to get an $HTTP_POST_VAR[integer]... it is not there. The keys are your variable names, therefore this is correct: foreach($HTTP_POST_VARS as $key=>$val) { $itens[] = $val; } will fit everything form ..POST_VARS into $itens array. BUT you'll loose all the key names, knowing nothing of where these values came from. try rather do this: foreach($HTTP_POST_VARS as $key=>$val) { $itens[$key] = $val; } this will result you true: if($HTTP_POST_VARS['var_name'] == $itens['var_name']) {} Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Carlos Fernando Scheidecker Antunes [mailto:[EMAIL PROTECTED]] Sent: Monday, May 21, 2001 12:43 PM To: PHP-GENERAL Subject: [PHP] How to loop the HTTP_POST_VARS array? Importance: High Oops. I've got a typo : $itens[] Here's the correct code : Hello all, I'm trying to loop the $HTTP_POST_VARS variable like an array like this : $index = count($HTTP_POST_VARS); for($i=0; i < $index; i++) { $itens[] = $HTTP_POST_VARS[$i]; } But it is not working. Can anoyone tell me how to do it? Thanks, Carlos Fernando. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
I love ini_get() for instance, for finding "include_path". Is there anyway to find "include_path" in php3, since ini_get() is for >= php4?
*********** REPLY SEPARATOR *********** On 20/05/2001 at 5:34 PM Zak Greant [EMAIL PROTECTED] [gregausit/phplist] wrote: >Manuel wrote: >[...] >> Since Zeev and Andi seem to be currently the most capable developers to >bring >> multi-threading capability to PHP because they developed PHP current >engine >> - Zend, my question still goes for them. After all they always seemed >more >> reasonable and opened to my suggestions than you. > > > Manuel, irritating Rasmus is not likely to make Andi, Zeev or any of >the > other developers more interested in helping you. > IIRC Rasmus was one of the main people involved in bringing PHP to life, it also resembles BASH because of involvement there, if this is wrong maybe Rasmus can tell me off list or anyone may be able to point me to some info that I can read. Anyway as a general rule, there is no point in antagonising any coder that produces code that's Open Source and under the GPL lic, now if you had a 200k contract to produce code that was specified, it would be entirely appropriate. I read what was said as its not a focus point, but was not ruled out.
On Sun, May 20, 2001 at 01:43:36PM -0700, Rasmus Lerdorf wrote: > > >Not really, the parent has to somehow call wait() on the child, otherwise > > >you'd get zombie processes... > > >Generally, implementing that sort of stuff within the Apache framework is a > > >bit of asking for trouble :I > > > > Anyway, PHP really lacks of real multi-threading capabilities. Things like > > database connection pooling, (non-HTTP) server request handling, and GUI > > event processing could be properly implemented in PHP with multi-threading > > capabilities like the way it is done in Java, Perl, Python, etc. but can't > > be done right in PHP because it lacks multi-threading support. > > > > Any plans to add multi-threading capabilities to PHP? > > Nope, but you can use the ticks feature to do some of this. What is the ticks feature and where can I read about it? The only reference I could find was in the PHP-DEV archives back in September about something you call by doing register_tick_function() . . . but nothing substantial in the way of documentation. Thanks, Frank
On Mon, May 21, 2001 at 01:55:10PM +1000, Greg Wright wrote: [ . . . ] > IIRC Rasmus was one of the main people involved in bringing PHP to life, it Well, if anyone can be said to have invented it, it's Rasmus. At some point around 96 (?) he was approached by Zeev and some others who suggested to recode what was then PHP/FI from scratch. The outcome was PHP 3.0 . . . shouldn't someone write a history of PHP? A little anecdote I keep telling is that back in '97, when I asked my very first question on this list, it was answered within less than half an hour by the mighty Rasmus himself! Having worked with M$ stuff mostly up until then if felt, wow, this is like, I post to Microsoft and get an answer from Bill within the half-hour! I was undecided then as to which scriptiong environment to go for. This won me over. Cheers, Frank
IMHO, one of the main attractions of open source software is that the creators themselves are easy to contact. Getting a question answered by a company usually involves talking to customer service, who gets an answer from a supervisor, who asked the lead of the programming department, who asked the guys in charge of the parts of the code your asking about, who read through some internal documentation and maybe the code itself, to get the answer. With open source your questions are usually answered by someone who actually works on the code itself. And sometimes the people who actually 'invented' the product are the one's you're talking to! To me, that's just really cool. It's the main attraction to open-source and small companys for me; you get to talk to the people in charge. Suggest something good and it may get done. It's like being really rich without being able to buy anything. ;) Which is precisely why it's wise to treat everyone in the community with an equal level of respect, because you're already talking to the people in charge. The PHP Group, Zend, and individuals like Rasmus control what PHP will and won't support. None of them do it on there own. There are no real dictators who control the flow of PHP's future, which is how open-source is suppose to be. Plutarck "Frank Joerdens" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Mon, May 21, 2001 at 01:55:10PM +1000, Greg Wright wrote: > [ . . . ] > > IIRC Rasmus was one of the main people involved in bringing PHP to life, it > > Well, if anyone can be said to have invented it, it's Rasmus. At some > point around 96 (?) he was approached by Zeev and some others who > suggested to recode what was then PHP/FI from scratch. The outcome was > PHP 3.0 . . . shouldn't someone write a history of PHP? > > A little anecdote I keep telling is that back in '97, when I asked my > very first question on this list, it was answered within less than half > an hour by the mighty Rasmus himself! Having worked with M$ stuff mostly > up until then if felt, wow, this is like, I post to Microsoft and get an > answer from Bill within the half-hour! I was undecided then as to which > scriptiong environment to go for. This won me over. > > Cheers, > Frank > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
I'm having some difficulty porting this code from perl to php...can anyone give me a hand? -Matt Broughton #!/usr/bin/perl # Quick and dirty Yahoo movie showtimes grabber use LWP::Simple; my $content = get("http://movies.yahoo.com/showtimes/showtimes.html?z=florence%2C+sc&r=sim "); my $text = ''; if ($content) { $content =~ s{.*<!-- movies module -->(.*)<!-- /movies module -->.*}{$1}gism; my @lines = split(/\n/, $content); my $act = ''; foreach (@lines) { next if m{^</{0,1}(table|tr|td)}; next unless ($act || /<!-- theater -->/); if (/<!-- theater -->/) { print "\n"; $act = 'theater'; next; } elsif (/<!-- .*? movie -->/) { $act = 'movie'; next; } elsif (/<!-- show info -->/) { $act = 'info'; next; } elsif (/more theaters/i) { $act = 'done'; last; } # Strip font tags s{</{0,1}font.*?>}{}gi; # Strip HR's s{<hr>}{}gi; # Strip non-breaking spaces s{( )+}{ }gi; s{<p>}{<BR>}gi; if ($act eq 'theater') { # Remove links to Yahoo theater stuff s{<a.*?>(.*?)</a>}{$1}gi; # Remove Map It link in favor of a linebreak s{map it}{<BR>}i; # Small-italicize anything that's not the theater's name s{^(.*)$}{<SMALL><I>$1</I></SMALL>} unless m{<B>}i; } elsif ($act eq 'movie') { s{<a href="(.*?)">}{<a href="http://movies.yahoo.com$1">}gi; } $text .= "$_ \n"; } } else { $text .= '<P>Movie information is unavailable at this time.'; } print $text;
Hi Matt, @ 12:31:35 AM on 5/21/2001, Matt Broughton wrote: > I'm having some difficulty porting this code from perl to php...can > anyone give me a hand? Briefly.. --(snip)-- > #!/usr/bin/perl > # Quick and dirty Yahoo movie showtimes grabber > use LWP::Simple; > my $content = > get("http://movies.yahoo.com/showtimes/showtimes.html?z=florence%2C+sc&r=sim > "); Use fopen() function. http://www.php.net/manual/en/function.fopen.php > my $text = ''; > if ($content) { > $content =~ s{.*<!-- movies module -->(.*)<!-- /movies > module -->>.*}{$1}gism; http://www.php.net/manual/en/ref.pcre.php > my @lines = split(/\n/, $content); Use explode() function. http://www.php.net/manual/en/function.explode.php > my $act = ''; > foreach (@lines) { http://www.php.net/manual/en/control-structures.foreach.php Slightly different foreach syntax. > next if m{^</{0,1}(table|tr|td)}; > next unless ($act || /<!-- theater -->/); > if (/<!-- theater -->/) { Could use switch() here. Also see perl compatible regular expressions manual link above. Same thing for the string replaces below. > print "\n"; > $act = 'theater'; > next; > } > elsif (/<!-- .*? movie -->/) { > $act = 'movie'; > next; > } > elsif (/<!-- show info -->/) { > $act = 'info'; > next; > } > elsif (/more theaters/i) { > $act = 'done'; > last; > } > # Strip font tags > s{</{0,1}font.*?>}{}gi; > # Strip HR's > s{<hr>}{}gi; > # Strip non-breaking spaces > s{( )+}{ }gi; > s{<p>}{<BR>}gi; Use strip_tags() function. http://www.php.net/manual/en/function.strip-tags.php Also: http://www.php.net/manual/en/function.htmlspecialchars.php http://www.php.net/manual/en/function.htmlentities.php > if ($act eq 'theater') { > # Remove links to Yahoo theater stuff > s{<a.*?>(.*?)</a>}{$1}gi; > # Remove Map It link in favor of a linebreak > s{map it}{<BR>}i; > # Small-italicize anything that's not the >theater's name > s{^(.*)$}{<SMALL><I>$1</I></SMALL>} unless m{<B>}i; > } > elsif ($act eq 'movie') { > s{<a href="(.*?)">}{<a > href="http://movies.yahoo.com$1">}gi; > } > $text .= "$_ \n"; > } > } > else { > $text .= '<P>Movie information is unavailable at this time.'; > } > print $text; -Brian -- PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies.
Hi, What would be the syntax to trim 2 characters off of a given string? Thanks!
> What would be the syntax to trim 2 characters off of a given string? $new = substr($old,0,-2);
see substr() in string functions (LXXIV) ----- Original Message ----- From: "Jason" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: 2001. május 21. 06:35 Subject: [PHP] Trimming 2 Characters from the end of a string? > Hi, > > > What would be the syntax to trim 2 characters off of a given string? > Thanks! > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Hello. I am having a problem when trying to "view source" via my IE browser. When I try I get the following error: "Cannot open the php_submit.php C:\WINDOWS\Temporary Internet Files\Content.IE5\8DMZ02HJ\www.yahoo(1) file. Make sure a disk is in the drive you specified." ** Above I just tried viewing source on Yahoo's home page as an example. Now, interestingly, the "php_submit.php" file was one of the first PHP files I created when I first started playing around with PHP on my PC. For every time I try to "view source", this file is mentioned as above. The second file (ie. 'www.yahoo(1)' ) is different for every page I try to view source on. I have checked with Microsoft's technet and found no help and tried all that was suggested. I am now thinking that maybe my PHP installation may have caused this. I do not recall this error happening JUST AFTER I installed. I think I could for awhile and then all of a sudden I could not. I am posting this question in a few other PHP newsgroups as I am unsure where this would fall under: php.dev php.doc php.general php.windows Thanks to anyone who can assist. John M.
this is your browser's problem. PHP has nothing to do with it. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: John M [mailto:[EMAIL PROTECTED]] Sent: Monday, May 21, 2001 2:09 PM To: [EMAIL PROTECTED] Subject: [PHP] Cannot "view source" via IE browser Hello. I am having a problem when trying to "view source" via my IE browser. When I try I get the following error: "Cannot open the php_submit.php C:\WINDOWS\Temporary Internet Files\Content.IE5\8DMZ02HJ\www.yahoo(1) file. Make sure a disk is in the drive you specified." ** Above I just tried viewing source on Yahoo's home page as an example. Now, interestingly, the "php_submit.php" file was one of the first PHP files I created when I first started playing around with PHP on my PC. For every time I try to "view source", this file is mentioned as above. The second file (ie. 'www.yahoo(1)' ) is different for every page I try to view source on. I have checked with Microsoft's technet and found no help and tried all that was suggested. I am now thinking that maybe my PHP installation may have caused this. I do not recall this error happening JUST AFTER I installed. I think I could for awhile and then all of a sudden I could not. I am posting this question in a few other PHP newsgroups as I am unsure where this would fall under: php.dev php.doc php.general php.windows Thanks to anyone who can assist. John M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
yes, i have discovered recently that php is not as fast as it is hyped to be. don't get me wrong. php is fast, but it depends on how you arrange your scripts. if you include a lot of library code (PEAR, etc etc), the overhead would increase and increase. i thought php has always cached compiled scripts (since it is fast enough for me so far), but the fact is it does not. without cacher like apc or zend cache, mod_php is no better than cgi, except it avoids per-request forking and configuration parsing. why oh why doesn't php/plain zend cache scripts in the first place? :-/ Regards, Steve On 20/05/2001 20:53, Christopher Leigh wrote: >ok, are servlets/jsp faster than php4? >since zend cache isn't free... :(
> why oh why doesn't php/plain zend cache scripts in the first place? :-/ PHP is developed in a way that no feature is added that would harm the performance or usability for the vast majority of people (80-90%+). Caching would speed individual scripts, but what if you have a very large amount of scripts or a few very large scripts? Or what if your scripts aren't used very often and you don't have plenty of extra memory (and who does?)? PHP's design would have to be significantly changed and altered, and many people wouldn't use it anyway. Thus the perfect solution is just to use an outside product. As we can see from APC and Zend Cache, caching is obviously not very easy to accomplish. If it were, we probably wouldn't be talking about this in the first place ;) The only thing that needs to be changed in PHP, IMHO, is to allow pre-compiled scripts to be handed to it for execution. Thus developing a cache would be much easier, I'd imagine. The way I'd think a cache would work best: When a script is called rather than calling PHP, have it call Cache instead of PHP directly. The cache checks it's memory and sees if that script has been compiled. If so it checks to ensure the source hasn't been altered since compiling it, then it has PHP execute it and serves it out (if the page has no dynamic pieces which change for each request like printing out the time, Cache could just hand the page out without calling PHP). Cache can be configured to store the most popular scripts, the one's that are naturally the slowest, or it can be told to handle certain scripts regardless of their popularity. And you would be able to tell it what's the most memory it could use. Sounds great, but if it were easy someone would have already done it. Currently any language is only as fast as the programmer makes it. You can write pure assembler code which trudges along at a truly embarrasingly slow rate. PHP is no different. It doesn't matter what language you're using, the more code that has to be run the slower it's going to be. The more librarys you use the slower and more memory intensive the code. It's beyond reason to think it would be any other way. PHP is slower in code execution than the C it's written in. *pauses for the "duuuhh!" reaction to wear off* That's how every scripting language works, and it is completely, utterly, and impossibly unavoidable. Trading simplicity for speed is unavoidable, unless you want to code in hexadecimal. PHP remains to be the best trade off between simplicity and speed, which means that there will always be a faster language than PHP. But IMHO, none are both faster and easier. Otherwise I wouldn't be using PHP ;) "If you don't know why something isn't working, it's probably your fault." (words to live by :) Plutarck "Steven Haryanto" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > yes, i have discovered recently that php is not as fast as it > is hyped to be. don't get me wrong. php is fast, but it depends > on how you arrange your scripts. if you include a lot of library > code (PEAR, etc etc), the overhead would increase and increase. > i thought php has always cached compiled scripts (since it is > fast enough for me so far), but the fact is it does not. without > cacher like apc or zend cache, mod_php is no better than cgi, > except it avoids per-request forking and configuration parsing. > > why oh why doesn't php/plain zend cache scripts in the first > place? :-/ > > Regards, > Steve > > On 20/05/2001 20:53, Christopher Leigh wrote: > >ok, are servlets/jsp faster than php4? > >since zend cache isn't free... :( > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Hi All, I have a form where i let people choose a file to upload, but i want to limit them to image files only. So i want to only allow the .gif and .jpg to be uploaded. What i tried doing was this: if ($filename_type == "image/gif") -- upload file otherwise give an error message! but for some reason this doesn't work. It uploads any kind of file without complaint! So what am i doing wrong? Is there another operator to compare strings for instance? Or what is the problem? Thanks! ===== Heidi Belal ICQ# 32127109 A bus stops at a bus station. A train stops at a train station. On my desk I have a work station... __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
On Monday 21 May 2001 08:03, Heidi Belal wrote: > I have a form where i let people choose a file to > upload, but i want to limit them to image files only. > So i want to only allow the .gif and .jpg to be > uploaded. What i tried doing was this: > if ($filename_type == "image/gif") > -- upload file > otherwise give an error message! > > but for some reason this doesn't work. It uploads any > kind of file without complaint! So what am i doing > wrong? Is there another operator to compare strings > for instance? Or what is the problem? == is perfectly fine for string comparison. Try doing a echo "'$filename_type'"; and (generally) a phpinfo (); to see what's passed to your script. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Those who will not reason, are bigots, those who cannot, are fools, and those who dare not, are slaves. - George Gordon Noel Byron (1788-1824), [Lord Byron]
I'm trying to test the gz_handler, among other things, but I have no idea if the output is actually gzip encoded. I'm using PHP 4.0.5 as an Apache module, and here's an example of a test script: <?php ob_start("ob_gzhandler"); ?> <p>This should be compressed. [bunch of text here just to ensure it's big enough to be encoded. the file size is about 5700kb] <?php ob_end_flush(); ?> I'm using IE 5.5 to view the page, and PHP shows the HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"] variable as "gzip, deflate", so the browser is saying it supports gzip content. Now the question is, how do I actually know if the browser is getting gzip content? Plutarck
On Monday 21 May 2001 08:14, Plutarck wrote: > I'm trying to test the gz_handler, among other things, but I have no > idea if the output is actually gzip encoded. You could try using wget with a custom Http-Accept-Encoding: header -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Those who will not reason, are bigots, those who cannot, are fools, and those who dare not, are slaves. - George Gordon Noel Byron (1788-1824), [Lord Byron]
First, i'm sorry if this is an out of topic subject, but i've try to post this email to one of postgres mailing list, and i can't find any help there. i wish, if one of you know the solutions of my problem, you can share it with me. i create a little stored procedure using plpgsql from pgaccess. function input is table name where the function will simply iterate along each record in the table and raise notice for each of them. when i run this function from shell command using : select browse_table('sex'), the function error with error message 'ERROR: parser: parse error at or near "$2"'. As i concern, this error came from the line i mark because the function can't receive variable 'table_name' to generate query. i'm new here, so can some body help me, please.... the source code is below. =========================================================== DECLARE table_name ALIAS for $1; each_row RECORD; BEGIN FOR each_row IN select * from table_name LOOP ==> i believe this's an error source raise notice 'row'; END LOOP; END; =========================================================== function description : function name : browse_table returns : bpchar parameters : bpchar language : plpgsql -toto-
Hello, you should execute your select statement as an dynamic query, because plpgsql assumes that there is valid / parseable query (and not a string containing a query) after the "IN". ( the skeleton for iterating on the result of dynamic queries) FOR record | row IN EXECUTE text_expression LOOP statements END LOOP; so you may use this as follows: FOR each_row IN EXECUTE ''select * from '' || table_name LOOP raise notice 'row'; END LOOP; I don't test it, so maybe there are some mistakes in it. It's possible too, that you must prepare your query itself into a text variable before use in FOR IN EXECUTE LOOP. I suspect that EXECUTE was added in v7.1. hope this helps, Papp Gyozo - [EMAIL PROTECTED] ----- Original Message ----- From: "toto" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: 2001. május 21. 08:46 Subject: [PHP] OOT - postgress help > First, i'm sorry if this is an out of topic subject, but i've try to post > this email to one of postgres mailing list, and i can't find any help there. > i wish, if one of you know the solutions of my problem, you can share it > with me. > > i create a little stored procedure using plpgsql from pgaccess. function > input is table name where the function will simply iterate along each record > in the table and raise notice for each of them. > > when i run this function from shell command using : select > browse_table('sex'), the function error with error message 'ERROR: parser: > parse error at or near "$2"'. As i concern, this error came from the line i > mark because the function can't receive variable 'table_name' to generate > query. > > i'm new here, so can some body help me, please.... > > the source code is below. > =========================================================== > DECLARE > table_name ALIAS for $1; > each_row RECORD; > BEGIN > FOR each_row IN select * from table_name LOOP ==> i believe this's an > error source > raise notice 'row'; > END LOOP; > END; > =========================================================== > function description : > function name : browse_table > returns : bpchar > parameters : bpchar > language : plpgsql > > > -toto- > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
yes true. 10x "Christian Reiniger" <[EMAIL PROTECTED]> wrote in message 01051912242605.00594@chrisbig">news:01051912242605.00594@chrisbig... On Saturday 19 May 2001 01:27, elias wrote: > hello, > > i have my file which reads like: > dir3/dir3-3/ > dir2/ > dir1/ > s [...] > as you noticed that in each element of the array "$a" a space is > appended for an unknown reason! Wild guess: You're on a Unixy server and the file is in DOS format (CRLF endings)? -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Very funny, Scotty! Now beam up my clothes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi all Is this the corerct way of selecting the max value in a table? "select * from score where MAX(scorevalue)" cheers Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself"
SELECT MAX(scorevalue) FROM score Will display the maximum value of your scorevalue column. Sincerely, Craig Vincent
Hi try: select * from score order by scorevalue DESC LIMIT 1 or if your db supports sub selects: select * from score where scorevalue=(select MAX(scorevalue) from score) Tom At 03:38 PM 21/05/01 -0500, Jacky wrote: >Hi all >Is this the corerct way of selecting the max value in a table? >"select * from score where MAX(scorevalue)" >cheers >Jack >[EMAIL PROTECTED] >"There is nothing more rewarding than reaching the goal you set for yourself"
select max(scorevalue) from score; ----- Original Message ----- From: "Jacky" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: 2001. május 21. 22:38 Subject: [PHP] select the max value Hi all Is this the corerct way of selecting the max value in a table? "select * from score where MAX(scorevalue)" cheers Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself"
ey guys, what are the functions that's disabled if "safe_mode" is On? also, what I just did now is disabling the functions exec() and system() just to prevent shell commands. but, how do i disable something like `ls -l /` ? the backticks. Thanks guys
> Can anyone recommend a good/cheap uk based, PHP host? I say cheap as I am > going to be needing about 500mg's of space for my current site > (httpp://planet-tolkien.com) hosted with uk2.net.
On Sunday 20 May 2001 19:39, Jaime Torres wrote: > I've been blocked by this tiny problem... > > I have a main.php file: > > <? > $frames = true; > $open = "http://myserver.com/info.html"; > if ($frames) > { > include ("frameset.php"); > } > ?> > > The frameset.php looks like (omitting almost all the HTML): > <frameset rows="100,*" border="0"> > <frame src="onlineview.php3"> > <frame src="footer.html"> > </frameset> > > In the onlineview.php file I need to use the $open URL defined before, > but it isn't defined here. What am I doing wrong? How can I get $open's > value from this file? (1) $open is defined in frameset.php (2) frameset.php outputs a HTML page with the frameset definition (3) when the browser receives this, it issues two new requests, one for "onlineview.php3" and one for "footer.html" So you don't *include* onlineview.php3, you just reference it in the HTML code. do a <frame src="onlineview.php3?open=<?= rawurlencode ($open) ?>"> instead (i.e. pass $open as parameter to onlineview.php3). -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Those who will not reason, are bigots, those who cannot, are fools, and those who dare not, are slaves. - George Gordon Noel Byron (1788-1824), [Lord Byron]
On Sunday 20 May 2001 20:51, Manuel Lemos wrote: > Hello Navid, > > On 20-May-01 14:36:33, you wrote: > >So you suggest that I use the name attribute in XHTML and ignore the > > fact that it has been depreciated and replaced by the ID attribute? > > Will that solve my problem? > > It depends. If what is going to process the document is a regular > browser, the NAME attribute is what matters. Future browsers will have > to handle current HTML compatibly. So there is no point in removing the > NAME attribute. Why not specify both? -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Those who will not reason, are bigots, those who cannot, are fools, and those who dare not, are slaves. - George Gordon Noel Byron (1788-1824), [Lord Byron]
if (preg_match_all("|testing(.*?);blah|s", $str, $matches)) { // do what you want with $matches: see in the manual! var_dump($matches); } ----- Original Message ----- From: "George E. Papadakis" <[EMAIL PROTECTED]> To: "PHP List" <[EMAIL PROTECTED]> Sent: 2001. május 20. 19:18 Subject: [PHP] RegEx Question > Hi, > > I have an ereg question::. > $data = a big string , > while (ereg ("testing([^;]*);blah(.*)",$data,$args)) { > $this = $args[1]; > $data = $args[2]; > } > > What I wanna do ,obviously, is to get all the strings between 'testng' and > 'blah' in an array. > This will do it, yet when it wont work when special chars such \n exist > between 'testing' and 'blah'. > Any ideas? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
hi all! i need to see if a $variable has a piece of text included in it. how do i do that? i need to do something like: if ($variable =matches= "@monkeys.com") { then do this} tia!
Hi Sandeep, <? if (preg_match(/"@monkeys.com/i", $variable)) { echo "Got some monkeys."; } else { echo "No monkeys here."; } ?> preg_match(); ereg(); eregi(); Will all help you. James. "Sandeep Hundal" <[EMAIL PROTECTED]> wrote in message A0A5617A0A05D5118EBD00508B8B953B5EA932@PROF-X">news:A0A5617A0A05D5118EBD00508B8B953B5EA932@PROF-X... > hi all! > > i need to see if a $variable has a piece of text included in it. how do i do > that? > > i need to do something like: > > if ($variable =matches= "@monkeys.com") { then do this} > > tia! > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
http://www.php.net/manual/en/function.strstr.php if (strstr ("i like beer", "beer")) { // it's in there } else { // it's not } -----Original Message----- From: Sandeep Hundal [mailto:[EMAIL PROTECTED]] Sent: 21 May 2001 11:39 To: Php (E-mail) Subject: [PHP] checking to see if part of a variable exists? hi all! i need to see if a $variable has a piece of text included in it. how do i do that? i need to do something like: if ($variable =matches= "@monkeys.com") { then do this} tia! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] ********************************************************************** 'The information included in this Email is of a confidential nature and is intended only for the addressee. If you are not the intended addressee, any disclosure, copying or distribution by you is prohibited and may be unlawful. Disclosure to any party other than the addressee, whether inadvertent or otherwise is not intended to waive privilege or confidentiality' **********************************************************************
If I submit a string to a script via GET which contains quotes, how should they appear in my script? Eg: --- test.php --- echo $HTTP_GET_VARS['test']; Go to: test.php?test=this+doesn%27t+work .. and you get: this doesn\'t work (Char 27 is a single quote. Echoing $test gives the same result.) I can use stripslashes lose the escape char, but should this be necessary? I'm using v4.0.4pl1 -- Mark Rogers Lose the -news in the email address if replying direct
It's a feature of PHP that it automatically escapes data submitted in PUT/GET/etc. It's nice in that it adds to how secure PHP code is, but it can be a hassle. Not sure if there is a function which removes escape characters will leaving normal backslashes alone. If you REALLY need to turn it off I believe it's the magic_quotes_gpc option. Plutarck ""Mark Rogers"" <[EMAIL PROTECTED]> wrote in message 9eavif$dks$[EMAIL PROTECTED]">news:9eavif$dks$[EMAIL PROTECTED]... > If I submit a string to a script via GET which contains quotes, how should > they appear in my script? > > Eg: > --- test.php --- > echo $HTTP_GET_VARS['test']; > > Go to: > test.php?test=this+doesn%27t+work > > .. and you get: > this doesn\'t work > > (Char 27 is a single quote. Echoing $test gives the same result.) > > I can use stripslashes lose the escape char, but should this be necessary? > I'm using v4.0.4pl1 > > -- > Mark Rogers > Lose the -news in the email address if replying direct > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
> It's a feature of PHP that it automatically escapes data submitted in > PUT/GET/etc. It didn't seem to be happening with POST which is why I thought it odd, but that probably means I didn't test properly :-) > It's nice in that it adds to how secure PHP code is, but it can be a hassle. Out of curiousity, what are the security implications? Presumably a failure to validate input properly leading to unintended actions, but I can't think of any examples to help me decide whether to turn this off. Thanks for the quick response. -- Mark Rogers
Hi Mark, > > It's nice in that it adds to how secure PHP code is, but it can be a > hassle. > > Out of curiousity, what are the security implications? Presumably a failure > to validate input properly leading to unintended actions, but I can't think > of any examples to help me decide whether to turn this off. Most default to set magic_quotes_gpc on - otherwise, to safeguard against (amongst many other things) mysql or other database errors, all fields that aren't integers would have to have addslashes() applied to them. Try entering a string like this: $string = "<a href=\"http://www.php.net\">PHP</a>"; $string = stripslashes($string); $insert = @mysql_query("INSERT INTO table (string) VALUES ('$string')") or die (mysql_error()); And see how fast you run into errors ;) James.
Hmm...SID is a constant, and when it's set it is present in $GLOBALS. But when I run this: <?php define("CON1", "Hi there!"); echo CON1; print_r($GLOBALS); ?> ...the constant exists, but is not present in $GLOBALS. Weird...anyone know why this happens? (I'm using 4.0.5) Plutarck "Alex Black" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > phpinfo() allways has a list of variables. but of course every variable is > > allways in $GLOBALS too. > > including constants? > > I just print_r'd globals to refresh my memory, and found what I was > expecting: none of my constants. > > ? > > _alex > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
is there any way to resize images in php and save them to a new file? i want to write sort of a (db-powered) picture gallery that automatically creates thumbnails out of http-uploaded files. thanks for your advice venome -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net
Find a good command line programm that does resing and use exec or system to do the thumbnailing Fopen >> fwrite >> exec. If you are on linux I suggest using NetPBM. ----- Original Message ----- From: "Samuel Lüscher" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, May 21, 2001 3:21 PM Subject: [PHP] generating thumbnails > is there any way to resize images in php and save them to a new file? > i want to write sort of a (db-powered) picture gallery that automatically > creates thumbnails out of http-uploaded files. > > thanks for your advice > venome > > -- > GMX - Die Kommunikationsplattform im Internet. > http://www.gmx.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
nahhh, if you're doing a lot of images on a page, doing a system call for each one would generate entirely too much overhead, imo. check out the built-in image manipulation functions in php. http://www.php.net/manual/en/ref.image.php there is a function called ImageCopyResized() which is probably what you would need to use. i used to have a thumbnailer written in php but alas, it's been so long ago, that i forgot how i wrote it. :) ~shawn ----- Original Message ----- From: George E. Papadakis <[EMAIL PROTECTED]> To: Samuel L?scher <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, May 21, 2001 8:31 AM Subject: Re: [PHP] generating thumbnails > Find a good command line programm that does resing and use exec or system to > do the thumbnailing > Fopen >> fwrite >> exec. > > If you are on linux I suggest using NetPBM. > > ----- Original Message ----- > From: "Samuel L?scher" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, May 21, 2001 3:21 PM > Subject: [PHP] generating thumbnails > > > > is there any way to resize images in php and save them to a new file? > > i want to write sort of a (db-powered) picture gallery that automatically > > creates thumbnails out of http-uploaded files. > > > > thanks for your advice > > venome > > > > -- > > GMX - Die Kommunikationsplattform im Internet. > > http://www.gmx.net > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
I'm creating a filter to re-write webpages, and everything is going fine. I'm trying to strip out anything using the <SCRIPT> tag, and here's what I know works: $file = eregi_replace("<script.*>.*</script>", "<!-- RWW: Scripting killed -->", $file); But I use PCRE functions, so I don't want to use ereg in one place and PCRE in another, so I tried: $file = preg_replace("#<script.*>.*</script>#i", "<!-- RWW: Scripting killed -->", $file); Thing is, that doesn't work. And I don't know why. I assume that the brackets are what is causing the trouble, but what do those brackets do in PCRE that requires they be escaped? But escaping them doesn't seem to work either... So, what's wrong with the second piece of code that isn't wrong in the first? Thanks in advance. Plutarck