Re: [PHP] Unzip a file.
Vincent M. wrote: Hello, Is there an easy way to unzip a zipped file which contains files (images), using a function from the zlib or any. To something like that: exec("unzip zipfile.zip -d /path/to/images") ; But without using the exec function. Thanks, Vincent. You may want to check here http://www.php.net/manual/en/ref.zip.php The functions are read only. I don't know if this will do it, but it seems that if you can /read/ an entry in the zip file, you should be able to write it somewhere. However, if you just want to execute the command line app on the OS and not use exec(), just enclose your statement in backticks `unzip zipfile.zip -d /path/to/images`; -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] giving variable value in URL problem
thanx Chris, this code is running on Web, is not on Local. and I did your way, it did not work regards "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > --- Burak Delice <[EMAIL PROTECTED]> wrote: > > http://localhost/menu.php?status=0 php return > > [snip] > > > if ($status==0) echo '"trying"; > > if (!$_GET['status']) > { > echo '"trying"; > } > > Hope that helps. > > Chris > > = > Chris Shiflett - http://shiflett.org/ > > PHP Security Handbook > Coming mid-2004 > HTTP Developer's Handbook > http://httphandbook.org/ > RAMP Training Courses > http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Limiting repetitive file access
Hi, While your solution is feasible it would still consume processor and memory because you are doing this at a very high level, you will be better of solving this at a lower level by a proper use of a firewall. What you have described sounds like a kiddie script attempt at a denial of service or brute force cracking. Andre Dubuc wrote: Hi, Recently, a 'user' attempted to access a restricted area of my site repetitively (spanning five hours) entering the same url repetitively [probably by script]. A massive log file was generated. I would like to ban such behavior by limiting the number of successive 'get's a user can do (say 4 attempts) before an appropriate action is taken.. As a temporary measure (until I can figure a better way) the url in question was disabled. What I'd like to do, on a per-file basis using $_SESSION, is a combination of ipaddress perhaps with a counter that records the number of times that file was accessed, and limit the number of successive 'get's that can be done before the file is no longer accessible. In a script that checks for bad words, I have used: if ($_SESSION['text'] = "badwords"){ $_SESSION['attempt'] = 1; header("location: unwanted.php"); } [In the file unwanted.php I checked for $_SESSION['attempt'] = 1 and booted if the condition was met] However, using this approach I cannot augment this number without resorting to a file get/put schema. Is there a way around this? Is there a better approach? I've tried .htaccess but the user in question has a dynamic address. Any help appreciated. Tia, Andre -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Limiting repetitive file access
Hi, Recently, a 'user' attempted to access a restricted area of my site repetitively (spanning five hours) entering the same url repetitively [probably by script]. A massive log file was generated. I would like to ban such behavior by limiting the number of successive 'get's a user can do (say 4 attempts) before an appropriate action is taken.. As a temporary measure (until I can figure a better way) the url in question was disabled. What I'd like to do, on a per-file basis using $_SESSION, is a combination of ipaddress perhaps with a counter that records the number of times that file was accessed, and limit the number of successive 'get's that can be done before the file is no longer accessible. In a script that checks for bad words, I have used: http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ereg_replace()
chris and justin, you guys rock. thanx for pointing towards str_replace(). my code works now. thanx! "Justin French" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sunday, November 16, 2003, at 02:31 PM, erythros wrote: > > > ok, so i'm stupid. how do i replace all '? ' with '?? ' > > > > No need for regular expressions here. > > $str = 'well, how do I do this? should i experiment?'; > $newStr = str_replace('? ','?? ',$str); > echo $newStr; > // should echo well, how do I do this?? should i experiment? > ?> > > Unless you want ANY white space (\n, \t, etc) instead of just spaces, > an ereg would be better. I prefer preg_replace(): > > $str = 'well, how do I do this? should i experiment?'; > $newStr = str_replace('/?(\s)/','??\\1',$str); > echo $newStr; > ?> > > > Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ereg_replace()
On Sunday, November 16, 2003, at 02:31 PM, erythros wrote: ok, so i'm stupid. how do i replace all '? ' with '?? ' No need for regular expressions here. Unless you want ANY white space (\n, \t, etc) instead of just spaces, an ereg would be better. I prefer preg_replace(): Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ereg_replace()
--- erythros <[EMAIL PROTECTED]> wrote: > ok, so i'm stupid. how do i replace all '? ' with '?? ' $foo = '? '; $bar = str_replace('? ', '?? ', $foo); Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ereg_replace()
ok, so i'm stupid. how do i replace all '? ' with '?? ' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Segfault using ibase (firebird) with PEAR
Hi folks, I'm very new to PHP and PEAR. But I'm having very strange troubles with this simple thing. I'm trying to run the following script into a php file: query('SELECT * FROM USERS'); echo $res->numRows(); while ($row = $res->fetchRow()) { echo $row[0]; } ?> So simply, uh? But when the line containing "$res = $db->query('SELECT * FROM USERS');" is executed inmediatly I've a segfault of PHP in the Apache's access.log file and a 404 Error in my browser. Commenting this line out , the page is shown empty, as usual. Using ADODB or ibase* functions, the same procedure (stablish the connection, run the query and show the results) is done with out any problem. Thanx in advance, -- José Romero Sistemas JG Isla de Margarita - Venezuela mailto:[EMAIL PROTECTED] -BEGIN GEEK CODE BLOCK- Version: 3.1 GCS/IT$ d+(-) s+:+ a- C++(+++)$ UL>$ P+>++ L+>++$ !E W++ N++ ?o ?K w--(++)$ O-- M-(--) !V PS+ PE++ Y PGP t 5(+) X+ R tv+ b+ DI(+) D+ G(+) e++ h! r(-) y+ --END GEEK CODE BLOCK-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is "white space"
On Saturday 15 November 2003 08:22 pm, Chris Shiflett wrote: > 1. When a closing PHP tag, such as ?>, is followed by a newline, the > newline is not output. Im the original author to this thread, and this is an attempt to bring back this thread to square one, as it was straying in other directions that doesn't apply to me. Command Line editors used. ee, vi, vim, joe X GUI editors used Quanta, Gvim Currently all these editors add what appears to be a \n after a closing ?> This I believe is normal, because all *nix files contain a \n at the end of lines. I had a theory that output buffering was "cleaning" up my code, but this isn't the case, as I've turned off output buffering and Im still getting the same results. Speaking of results. Im not getting the infamous "headers sent" error. My scripts operate normally. The reason why I started this topic was to get some ammunition to ward off windows GUI editor users who claim that my code contains "white space" after the closing ?> tag. Some dummy code -> x.php y.php y.php returns false, even though, there is apparently a \n after the closing ?> tag of x.php You may download my dummy code and view them in a windows GUI php editor, and see the extra line after the closing ?> http://www.trini0.org/white_space.zip So going back to my original question -> So is "white space" only physical space (\s) or can it be anything like \t \r \n??? .Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] giving variable value in URL problem
--- Burak Delice <[EMAIL PROTECTED]> wrote: > http://localhost/menu.php?status=0 php return [snip] > if ($status==0) echo '"trying"; if (!$_GET['status']) { echo '"trying"; } Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] giving variable value in URL problem
hi, when I enter url like that http://localhost/menu.php?status=0 php return an error below : "Warning: Undefined variable: status in D:\calismalar\cengiz_ozdelice\web\menu.php on line 41" my code on 41.line is : if ($status==0) echo '"trying"; what is problem? thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't fetch HTTP POST data in PHP?
--- Arne Rusek <[EMAIL PROTECTED]> wrote: > I used this form: > > > Your name: > Email: > > > > The test.php script contained this code: > >error_reporting(E_ALL); > echo "\n"; > phpinfo(); > echo "\n"; > var_dump($_POST); > ?> > > Then I saw a pretty large page but at the end there was > > array(0) { } > > and _that_ seemed to me pretty strange. That does seem strange. I glanced at this page of yours: > http://zonk.matfyz.cz/php_post_problem And I saw this: REQUEST_METHOD => GET So, why was the request a GET request rather than a POST request? There is no content nor any entity headers either, so it doesn't seem like this line (telling us that the request method was GET) is wrong. However, I also don't see any URL variables, so it doesn't seem like the HTTP request contained any form data, whether GET or POST. > http://zonk.matfyz.cz/php_get_problem This looks a bit better. We still have a GET request method, and the query string has something: QUERY_STRING => username=zonk&email=zonk&submit=Submit+me%21 However, I can't explain why a print_r($_GET) would not display the username, email, and submit form variables. Maybe you can try: echo $username; echo $_GET['username']; echo $_POST['username']; echo $_REQUEST['username']; echo $_SERVER['QUERY_STRING']; Hopefully one of this will output something relevant. Otherwise, I suppose it's possible that there is a bug in the CGI SAPI, unless I'm missing something. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include an encoder into PHP distribution?
Hello, On 11/15/2003 07:31 PM, John Smith wrote: Anyway, I don't think Zend people will allow a competing extension be included in the core PHP distribution precisely because it compromises their business. This is exactly the reason I started this thread by asking "Who controls PHP?" ... Thanks for clearing this out. I was not saying or implying that Zend controls PHP alone. In practice they have the "knife and the cheese" in their hands, meaning currently PHP programs depend on Zend Engine to run. Maybe when somebody develops real PHP compilers things will be different. Either way, another problem of Turck is that it uses a GPL license. Most people do not understand that GPL software is not really free for the users despite what it is advertised. Yes, a good point. I could suggest that they change the license Lesser GPL, but of course I don't know how it goes (I don't have any connections to Turck people). I had to verify that it is really GPL, and it seems so. I don't know if changing to LGPL would be sufficient to be acceptable by PHP group. Still, you don't know if Turck author wants to change its license from GPL. The fact is that according to Turck benchmarks, it beats both Zend Cache and PHP-Accelerator. Since one of the important factors is Turck optimizer that is used by either the cache and the encoder, I do not know if Turck author wants to authorize the use of Turck code in closed source programs including Zend encoder and IonCube encoder, as it is potentially better and he may not be interested that competing encoders use their code. Of course, since Turck code is publically available, nothing would stop any closed source developers to steal his optimizer ideas or even code. However, keeping it GPL he would not be legitimizing it, regradless if that would prevent any real stealing to occur. Anyway, you should ask directly Turck author about his interest to change the license just in case Zend/PHP group ever agrees on an eventual contribution of Turck extensions, not just the encoder, but also the optimizer and the cache that seem to be probably the best in the market. The contact address is below in this page but I am not sure if it is upto date. http://turck-mmcache.sourceforge.net/ -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is "white space"
--- Keith Greene <[EMAIL PROTECTED]> wrote: > It's not a bug. Anything (including spaces, newlines etc) that is not > inside is output directly to the browser. There are two different things being discussed, and I'm not positive which is considered a bug. 1. When a closing PHP tag, such as ?>, is followed by a newline, the newline is not output. 2. When a script has no closing PHP tag, such as ?>, it is assumed to be the end of the file. Personally, I think the first makes no sense while the second makes perfect sense. The second, to me, is no different than how many other things are cleaned up automatically. Your database connections are closed even when you don't explicitly close them, for example. Should PHP throw an error when it reaches the end of the file and is still in PHP mode? Is that really a problem? Now, I admit that I am a big fan of symmetry, so I never omit a closing PHP tag. However, why should it be considered an error if the end of file is reached in PHP mode instead of output/HTML mode? The first point above annoys me to no end. Imagine this code: Now, I'm not trying to argue for one format over another, but doesn't it seem clear that the author of this code wanted the value of $username to be on its own row, indented by one tab within the opening and closing cell tags? Should the newline that follows the closing PHP tag not be output? I think that it should, but it is not. That's my argument. :-) Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is "white space"
Keith Greene wrote: Ok, you're getting into semantics now. http://www.php.net/manual/en/language.basic-syntax.php doesn't say whether it is acceptable or not, but as Robert pointed out, if your script is purely php, omitting it is a good way of eliminating the headache of trailing white spaces that may interfere with headers. No, I'm getting into the reality that an undocumented feature may very well be a bug, and may disappear. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is "white space"
Ok, you're getting into semantics now. http://www.php.net/manual/en/language.basic-syntax.php doesn't say whether it is acceptable or not, but as Robert pointed out, if your script is purely php, omitting it is a good way of eliminating the headache of trailing white spaces that may interfere with headers. Keith At 04:41 PM 11/15/2003, Leif K-Brooks wrote: Keith Greene wrote: That's not a bug either. Leaving out the ?> is simply telling the php parser that it has to parse the rest of the script. Where's the manual page saying that's allowed? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't fetch HTTP POST data in PHP?
Hello. I read throughout this thread and it looks like I have encountered the same problem. Everything looks just fine but somehow the PHP does not parse the request data sent to the script. I did some research on that but gave up since I couldn't find how and where those data were parsed. But I've used the PHP for a few days maybe it's just my stupidity. Some of you more acquainted with the topic will find some info I've gathered useful eventually. I used this form: Your name: Email: The test.php script contained this code: \n"; phpinfo(); echo "\n"; var_dump($_POST); ?> Then I saw a pretty large page but at the end there was array(0) { } and _that_ seemed to me pretty strange. If someone is interested in reading through the whole result it could be downloaded from http://zonk.matfyz.cz/php_post_problem I tried to change the method to GET but it didn't work either. The result could be seen at http://zonk.matfyz.cz/php_get_problem Take care. -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Arne Rusek <[EMAIL PROTECTED]> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- "Resistance is futile. Open your source code and prepare for assimilation." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is "white space"
Keith Greene wrote: That's not a bug either. Leaving out the ?> is simply telling the php parser that it has to parse the rest of the script. Where's the manual page saying that's allowed? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is "white space"
Keith Greene wrote: It's not a bug. Anything (including spaces, newlines etc) that is not inside is output directly to the browser. No, I'm talking about not using ?>. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is "white space"
Yep. It allows you to only use php where needed, and use HTML for the rest. At 04:02 PM 11/15/2003, you wrote: On Sat, 2003-11-15 at 18:49, Leif K-Brooks wrote: > Robert Cummings wrote: > > >FYI, if you're woprried about the "header cannot be sent due to > >output..." error, then if your file only has code and no HTML, then you > >can omit the ?> tag at the end of your script. This solves countless > >issues with there being a space, a tab, a newline, or any whitespace > >after the closing tag. > > > > > And when that bug is fixed? Isn't that a feature? Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- 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] Re: Alternet row colors
It's so much easier to use the mod (%) operator: using the mod operator, you can check if a variable is divisible by some other number without leaving a remainder. For this example, we want to change every other row, so we would compare our $count against 2 to see if it leaves a remainder: $bg = ($count%2==0) ? "#00" : "FF"; What this line does is FIRST, it checks to see if $count/2 leaves no remainder. If this is true, it sets the $bg var to "#00" If it is false, it sets $bg to "#FF" It only requires the addition of one line of code, and to replace your row background color with a php variable. Also, you don't need to use printf(), since you aren't specifying any formatting. See code below: code:--- $result = mysql_query("SELECT * FROM albums where id <15"); $Count = @mysql_num_rows($result); echo "\n"; echo "IDARTISTTITLELABELPRICE\n"; for ($count = 0; $count < $Count; $count++) { // Extract post details from database $myrow = mysql_fetch_array($result); $id = $myrow ['id']; $artist = $myrow ['artist']; $title = $myrow ['title']; $label = $myrow ['label']; $price = $myrow ['price']; $bg = ($count%2==0) ? "#00" : "FF"; echo "$id$artist$title$label£$price\n"; } echo "\n"; At 01:08 PM 11/15/2003, you wrote: Well, first of all Ill just scrap you script since this one is so easy its better to do it from scratch. OK, somewhere in your script you have the code that accually aoutputs the tables you are working with. Im refferring to lines here, and Im meaning the bottom of this document which is the scipt you posted, and I have numbered the lines. Overview of your script. Line 5 - we print out the table header Line 11 - 23 is the loop which prints out all the lines, or rows. Line 24 closes the table. So what we have to do? First we need to declare the values we want to use as backround colours, lets use logical names : (fig a) $backcolor1="#fafafa"; $backcolor2="#c0c0c0"; $backcolor=$backcolor1;// we assign color 1 This code has to be written before the loop starts, so somewhere before line 11. In the loop (11-23) we need to switch between the colours where we write the colour of the . So we write something like : (fig b) echo ''; // continue with the rest of here // which is -> your code. This will print out the first background color, nice. Now we need it to switch color, so we need to add a little logic. This will be inserted right before the loop ends (infact, you can put it where ever you like aslong as its in the loop). (fig c) if($backcolor=backcolor1) $backcolor=$backcolor2; else $backcolor=$backcolor1; As you see above the logic is quite simple, if the color is 1 -> we set it to 2, else we set it to 1. If you think of it, if you process this logic over and over again you will infact get 1, 2, 1, 2, 1, 2, 1, 2 all the time, :) Nice! There you have it, and I hope you got the hang of it. To take your code and implement my colorswither all you need to do is, 1. On line 21 replace #00 width $backcolor 2. Insert the logic (figc), all lines, into line 19 3. Place fig a in line 4. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- The code for return the top ten result is : 1 $result = mysql_query("SELECT * FROM albums where id <15"); 2 3 $Count = @mysql_num_rows($result); 4 5 echo "\n"; 7echo "IDARTISTTITLELABELPRICE\n"; 10 11 for ($count = 0; $count < $Count; $count++) { 12 // Extract post details from database 13$myrow = mysql_fetch_array($result); 14 $id = $myrow ['id']; 15 $artist = $myrow ['artist']; 16 $title = $myrow ['title']; 17 $label = $myrow ['label']; 18 $price = $myrow ['price']; 19 20 printf("$id$artist$title$label 22£$price\n"); 23} 24 echo "\n"; -- 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] What is "white space"
On Sat, 2003-11-15 at 18:49, Leif K-Brooks wrote: > Robert Cummings wrote: > > >FYI, if you're woprried about the "header cannot be sent due to > >output..." error, then if your file only has code and no HTML, then you > >can omit the ?> tag at the end of your script. This solves countless > >issues with there being a space, a tab, a newline, or any whitespace > >after the closing tag. > > > > > And when that bug is fixed? Isn't that a feature? Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is "white space"
It's not a bug. Anything (including spaces, newlines etc) that is not inside is output directly to the browser. At 03:49 PM 11/15/2003, you wrote: Robert Cummings wrote: FYI, if you're woprried about the "header cannot be sent due to output..." error, then if your file only has code and no HTML, then you can omit the ?> tag at the end of your script. This solves countless issues with there being a space, a tab, a newline, or any whitespace after the closing tag. And when that bug is fixed? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- 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] Example In Changes in PHP 5/Zend Engine 2.0
Below is the first php example found in "Changes in PHP 5/Zend Engine 2.0 " Hello; print "MyClass::printHello() " . $this->Bar; print "MyClass::printHello() " . $this->Foo; } } class MyClass2 extends MyClass { protected $Foo; function printHello() { MyClass::printHello(); /* Should print */ print "MyClass2::printHello() " . $this->Hello; /* Shouldn't print out anything */ print "MyClass2::printHello() " . $this->Bar; /* Shouldn't print (not declared)*/ print "MyClass2::printHello() " . $this->Foo; /* Should print */ } } $obj = new MyClass(); print $obj->Hello; /* Shouldn't print out anything */ print $obj->Bar;/* Shouldn't print out anything */ print $obj->Foo;/* Shouldn't print out anything */ $obj->printHello(); /* Should print */ ?> The result not same as stated in the remark. No print for $obj->printHello(). It only print with the code below $obj = new MyClass(); //print $obj->Hello; /* Shouldn't print out anything */ //print $obj->Bar;/* Shouldn't print out anything */ //print $obj->Foo;/* Shouldn't print out anything */ $obj->printHello(); /* Should print */ Accessing protected variable cause the output fail, why? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is "white space"
Robert Cummings wrote: FYI, if you're woprried about the "header cannot be sent due to output..." error, then if your file only has code and no HTML, then you can omit the ?> tag at the end of your script. This solves countless issues with there being a space, a tab, a newline, or any whitespace after the closing tag. And when that bug is fixed? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unzip a file.
Hello, Is there an easy way to unzip a zipped file which contains files (images), using a function from the zlib or any. To something like that: exec("unzip zipfile.zip -d /path/to/images") ; But without using the exec function. Thanks, Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Oracle 9iAS - Add PHP module
I'm running Oracle 9iAS on Linux, does anyone know if it's possible to add PHP to it as a module? Given that it's based on Apache? are there any docs out there on how to do this? thanks Ahbaid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include an encoder into PHP distribution?
Hello, On 11/15/2003 07:46 PM, Chris Shiflett wrote: Anyway, I don't think Zend people will allow a competing extension be included in the core PHP distribution precisely because it compromises their business. [snip] IMHO, if you really want to make software free without confusion, forget GPL. IMHO, if you really want to start some political debate or push your warped ideas on everyone, you can do it on another list. I am not pushing anything. I am just explaining why GPL extensions and libraries will not be accepted by the PHP group. I don't see the point in your hostility trying to act as censorship. You are not adding anything to the thread. -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't fetch HTTP POST data in PHP?
I did not omit content. Copied whole text box in sniffer using context menu comands (select all, copy) - pasted to news agent. There is no content. However, when using local server, on my desktop, I assume there is content because I am getting response from ASP page with exact data wich is sent from client. PHP page responses exactly the same as the one on remote Apache server. I have mental fog in my mind write now. "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > --- Ivan Marenic <[EMAIL PROTECTED]> wrote: > > Here is "failed" POST REQUEST to that server: > > * > > POST /http_post.php HTTP/1.1 > > User-Agent: Profile/MIDP-1.0 Configuration/CLDC-1.0 > > Host: www.milleniumtip.com:80 > > Content-Disposition: attachment; name="userfile"; > filename="userfile_txt" > > Connection: close > > Content-Type: text/plain > > Content-Length: 47 > > Content-Language: en-US > > > > > > That's the whole thing? If so, the problem seems to be a complete lack of > content. The Content-Length header specifies that 47 bytes are coming, and > Content-Type tells us that it is plain text, but there is nothing (it > should be after the blank line that follows Content-Language). Can you > check to see that you didn't omit this? > > Chris > > = > Chris Shiflett - http://shiflett.org/ > > PHP Security Handbook > Coming mid-2004 > HTTP Developer's Handbook > http://httphandbook.org/ > RAMP Training Courses > http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error?
Thanks for the help, and pointing out the security risk, Chris & David! Regards, Frank - Original Message - From: "Chris Shiflett" <[EMAIL PROTECTED]> To: "David Otton" <[EMAIL PROTECTED]>; "Frank Keessen" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, November 15, 2003 11:05 PM Subject: Re: [PHP] Parse error? > --- David Otton <[EMAIL PROTECTED]> wrote: > > I can't be bothered to figure out a test case, but you apparently have > > a SQL injection risk with your code. You're assuming that the data from > > the client is correct. > > This is a very good point. To highlight an example in the sample code you > provided (that David is referencing, I assume), look at the following: > > > foreach ($_POST['accomodatieid'] as $Key => $Value) > > { > > $query = "INSERT INTO ttra (reisid, accomodatieid) > >VALUES ($id2, $Value)"; > > $result = mysql_query ($query) > > You're using values from $_POST (which can be anything, since it's data > supplied by a user, potentially a malicious one) directly in the SQL > statement that you send to MySQL. This grants a lot of power and > flexibility to the user, which is very dangerous. > > In addition, you loop through $_POST, so that even unexpected data might > be used. This is even worse than expected data with an unexpected format. > > To fix this, assign the data you find in $_POST to another variable (or > array) once you determine that it is valid. For example: > > $safe = array(); > if ($_POST['foo'] is valid data) > { > $safe['foo'] = $_POST['foo']; > } > > Then, you can use the $safe array, and only a flaw in your data filtering > (whatever code you use for "is valid data" above) will create the same > security hole that you currently have. > > Hope that helps. > > Chris > > = > Chris Shiflett - http://shiflett.org/ > > PHP Security Handbook > Coming mid-2004 > HTTP Developer's Handbook > http://httphandbook.org/ > RAMP Training Courses > http://www.nyphp.org/ramp > > -- > 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] Can't fetch HTTP POST data in PHP?
--- Ivan Marenic <[EMAIL PROTECTED]> wrote: > Here is "failed" POST REQUEST to that server: > * > POST /http_post.php HTTP/1.1 > User-Agent: Profile/MIDP-1.0 Configuration/CLDC-1.0 > Host: www.milleniumtip.com:80 > Content-Disposition: attachment; name="userfile"; filename="userfile_txt" > Connection: close > Content-Type: text/plain > Content-Length: 47 > Content-Language: en-US > > That's the whole thing? If so, the problem seems to be a complete lack of content. The Content-Length header specifies that 47 bytes are coming, and Content-Type tells us that it is plain text, but there is nothing (it should be after the blank line that follows Content-Language). Can you check to see that you didn't omit this? Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't fetch HTTP POST data in PHP?
> Is it possible for you to show us the HTTP request that is failing? It is > possible that it is malformed in some way that is fine with some Web > servers and not with others. That may be possible but I am testing ASP i PHP(4.3.2) on same server IIS 5.0, localy. Can't sniff that (Network adapter not in use) Other, remote server I am using is Apache on RedHat Linux. Here is "failed" POST REQUEST to that server: * POST /http_post.php HTTP/1.1 User-Agent: Profile/MIDP-1.0 Configuration/CLDC-1.0 Host: www.milleniumtip.com:80 Content-Disposition: attachment; name="userfile"; filename="userfile_txt" Connection: close Content-Type: text/plain Content-Length: 47 Content-Language: en-US Here is response: HTTP/1.1 200 OK Date: Sat, 15 Nov 2003 22:02:40 GMT Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_watch/3.12 mod_throttle/3.1.2 mod_gzip/1.3.19.1a mod_auth_pam/1.0a mod_ssl/2.8.11 OpenSSL/0.9.6e PHP/4.2.3 mod_perl/1.26 FrontPage/5.0.2.2510 X-Powered-By: PHP/4.2.3 Connection: close Transfer-Encoding: chunked Content-Type: text/html > > You might be able to use ethereal (http://www.ethereal.com/) to get the > HTTP request. For sniffing HTTP traffic I am using EffeTech HTTP Sniffer. Works OK. Ivan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error?
--- David Otton <[EMAIL PROTECTED]> wrote: > I can't be bothered to figure out a test case, but you apparently have > a SQL injection risk with your code. You're assuming that the data from > the client is correct. This is a very good point. To highlight an example in the sample code you provided (that David is referencing, I assume), look at the following: > foreach ($_POST['accomodatieid'] as $Key => $Value) > { > $query = "INSERT INTO ttra (reisid, accomodatieid) >VALUES ($id2, $Value)"; > $result = mysql_query ($query) You're using values from $_POST (which can be anything, since it's data supplied by a user, potentially a malicious one) directly in the SQL statement that you send to MySQL. This grants a lot of power and flexibility to the user, which is very dangerous. In addition, you loop through $_POST, so that even unexpected data might be used. This is even worse than expected data with an unexpected format. To fix this, assign the data you find in $_POST to another variable (or array) once you determine that it is valid. For example: $safe = array(); if ($_POST['foo'] is valid data) { $safe['foo'] = $_POST['foo']; } Then, you can use the $safe array, and only a flaw in your data filtering (whatever code you use for "is valid data" above) will create the same security hole that you currently have. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error?
Frank Keessen wrote: Hi Guys, Sorry to trouble you on a saturday night (at least in The Netherlands...).. Get a parse error on line 42, but i can't see what is causing the trouble. (Parse error: parse error in /home/.sites/95/site92/web/admin/editreis.php on line 42) if(is_array($_POST['accomodatieid'])) { foreach($_POST['accomodatieid'] as $Key => $Value) { $query = 'INSERT INTO ttra(reisid, accomodatieid) VALUES ('. $id2 .', '. $Value .')'; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); }; } else { $query = 'INSERT INTO ttra(reisid, accomodatieid) VALUES ('$id2', '.$_POST['accomodatieid'].')';<- THIS IS LINE 42 $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); } Thanks for the help! Regards, Frank if(is_array($_POST['accomodatieid'])) { foreach($_POST['accomodatieid'] as $Key => $Value) { $query = "INSERT INTO ttra(reisid, accomodatieid) VALUES ('" . $id2 . "', '" . $Value . "')"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); } } else { $query = "INSERT INTO ttra(reisid, accomodatieid) VALUES ('" . $id2 . "', '" . $_POST['accomodatieid'] . "')"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't fetch HTTP POST data in PHP?
--- Ivan Marenic <[EMAIL PROTECTED]> wrote: > > This looks you are expecting to receive a POST request with PHP. So, > > are you wanting to send one or receive one? > > Receive one. Is it possible for you to show us the HTTP request that is failing? It is possible that it is malformed in some way that is fine with some Web servers and not with others. You might be able to use ethereal (http://www.ethereal.com/) to get the HTTP request. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error?
On Sat, 15 Nov 2003 22:38:07 +0100, you wrote: >Get a parse error on line 42, but i can't see what is causing the trouble. (Parse >error: parse error in /home/.sites/95/site92/web/admin/editreis.php on line 42) > >if(is_array($_POST['accomodatieid'])) { >foreach($_POST['accomodatieid'] as $Key => $Value) { >$query = 'INSERT INTO ttra(reisid, accomodatieid) VALUES ('. $id2 .', '. $Value .')'; >$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); >}; >} else { >$query = 'INSERT INTO ttra(reisid, accomodatieid) VALUES ('$id2', >'.$_POST['accomodatieid'].')';<- THIS IS LINE 42 >$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); >} if (is_array ($_POST['accomodatieid'])) { foreach ($_POST['accomodatieid'] as $Key => $Value) { $query = "INSERT INTO ttra (reisid, accomodatieid) VALUES ($id2, $Value)"; $result = mysql_query ($query) or die ("Error in query: $query. " . mysql_error ()); } } else { $query = "INSERT INTO ttra(reisid, accomodatieid) VALUES ($id2, {$_POST['accomodatieid']})"; $result = mysql_query ($query) or die ("Error in query: $query. " . mysql_error ()); } The problem was the lack of concatenation operators around $id2. If you can't see a parse error, a syntax-highlighting editor or breaking the code into several lines can help. I can't be bothered to figure out a test case, but you apparently have a SQL injection risk with your code. You're assuming that the data from the client is correct. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include an encoder into PHP distribution?
--- Manuel Lemos <[EMAIL PROTECTED]> wrote: > Anyway, I don't think Zend people will allow a competing extension be > included in the core PHP distribution precisely because it compromises > their business. [snip] > IMHO, if you really want to make software free without confusion, forget > GPL. IMHO, if you really want to start some political debate or push your warped ideas on everyone, you can do it on another list. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't fetch HTTP POST data in PHP?
> This looks you are expecting to receive a POST request with PHP. So, are > you wanting to send one or receive one? Receive one. "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > --- Ivan Marenic <[EMAIL PROTECTED]> wrote: > > Here is j2me code snippet: > > I try to avoid all of the crap that begins with the letter J, but your > example code looks like you are sending a POST request. > > > Here is PHP code snippet: > > > > // Show any post vars, but nothing shows - never! > > if(count($_POST)>0){ > > echo "POST".$new_line; > > print_r($_POST); > > echo $new_line; > > } > > This looks you are expecting to receive a POST request with PHP. So, are > you wanting to send one or receive one? > > Chris > > = > Chris Shiflett - http://shiflett.org/ > > PHP Security Handbook > Coming mid-2004 > HTTP Developer's Handbook > http://httphandbook.org/ > RAMP Training Courses > http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't fetch HTTP POST data in PHP?
--- Ivan Marenic <[EMAIL PROTECTED]> wrote: > Here is j2me code snippet: I try to avoid all of the crap that begins with the letter J, but your example code looks like you are sending a POST request. > Here is PHP code snippet: > > // Show any post vars, but nothing shows - never! > if(count($_POST)>0){ > echo "POST".$new_line; > print_r($_POST); > echo $new_line; > } This looks you are expecting to receive a POST request with PHP. So, are you wanting to send one or receive one? Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ASP code that works!
Dim binread Dim bytecount bytecount = Request.TotalBytes binread = Request.BinaryRead(bytecount) Response.BinaryWrite binread -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse error?
Hi Guys, Sorry to trouble you on a saturday night (at least in The Netherlands...).. Get a parse error on line 42, but i can't see what is causing the trouble. (Parse error: parse error in /home/.sites/95/site92/web/admin/editreis.php on line 42) if(is_array($_POST['accomodatieid'])) { foreach($_POST['accomodatieid'] as $Key => $Value) { $query = 'INSERT INTO ttra(reisid, accomodatieid) VALUES ('. $id2 .', '. $Value .')'; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); }; } else { $query = 'INSERT INTO ttra(reisid, accomodatieid) VALUES ('$id2', '.$_POST['accomodatieid'].')';<- THIS IS LINE 42 $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); } Thanks for the help! Regards, Frank
Re: [PHP] Can't fetch HTTP POST data in PHP?
Here is ASP code that works. Dim binread Dim bytecount bytecount = Request.TotalBytes binread = Request.BinaryRead(bytecount) 'Send response back to client Response.BinaryWrite binread -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Storing images
On Sat, 15 Nov 2003 13:01:21 -0800 (PST), you wrote: >--- Kim Steinhaug <[EMAIL PROTECTED]> wrote: >> Well as far as I can see you have 2 options. >> >> a) Store them directly on disc >> b) Store them in a database (eg. mySQL) >> >> I would think that a) is the best way without doubt > >I usually take this option myself, but when you are creating an >application to run on a large cluster of servers, option b is the better >choice in many cases. It eliminates having to maintain server affininty >with your load balancer or having to replicate the data among all the >servers. My first thought would be to shunt the images sideways to a seperate server, rather than backwards into a database. YMMV, of course. (Weighing in on the original post: images on the filesystem, metadata in the database. Of course, it all depends on the application - it's a piece-of-string question.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 15 Nov 2003 21:30:47 -0000 Issue 2417
php-general Digest 15 Nov 2003 21:30:47 - Issue 2417 Topics (messages 169731 through 169765): Re: CGI error when loading iFRAME 169731 by: Marek Kilimajer What is "white space" 169732 by: Gerard Samuel 169739 by: Chris Shiflett 169755 by: Robert Cummings Using $_SERVER 169733 by: Gerard Samuel Alternet row colors 169734 by: PAUL FERRIE 169735 by: Boaz Yahav 169736 by: PAUL FERRIE 169737 by: zhuravlev alexander 169760 by: Kim Steinhaug Who controls PHP? 169738 by: John Smith 169740 by: Chris Shiflett 169741 by: Nathan Taylor 169754 by: John Nichel 169756 by: Derek Ford Re: Include an encoder into PHP distribution? 169742 by: John Smith 169743 by: Nathan Taylor 169745 by: Chris Shiflett 169746 by: John Smith 169748 by: John Smith 169749 by: Eugene Lee 169750 by: John Smith 169752 by: zhuravlev alexander 169753 by: Ryan A 169764 by: Manuel Lemos 169765 by: John Smith Re: strtotime bad logic or strtotime bug? 169744 by: Chris Shiflett Storing images 169747 by: Paul Marinas 169751 by: Boaz Yahav 169757 by: Kim Steinhaug 169759 by: Chris Shiflett Can't fetch HTTP POST data in PHP? 169758 by: Ivan Marenic 169761 by: Chris Shiflett 169762 by: Manuel Lemos 169763 by: Ivan Marenic 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] -- --- Begin Message --- Miroslav I. wrote: Hi, people #The problem: There is an error message that stops proper loading of one iFRAME, I couldn't understand what is the problem. Complete error message issued: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:<< ###Additional: PHP Version 4.3.3 is running on Windows 2000 server This is a common problem with php on iis, google for the error string to get possible solutions. --- End Message --- --- Begin Message --- Most of the time, I edit files via the command line, (FBSD). When the files are saved, it adds a \n (newline) character (at least I believe that is what it is) after the closing ?> When viewing these files in a windows GUI editor, there is an extra line after the ?> closing tag. Using the php function headers_sent(), doesn't show that there is any output being created by these extra lines after closing ?> So is "white space" only physical space (\s) or can it be anything like \t \r \n??? Thanks. --- End Message --- --- Begin Message --- --- Gerard Samuel <[EMAIL PROTECTED]> wrote: > Most of the time, I edit files via the command line, (FBSD). When > the files are saved, it adds a \n (newline) character (at least I > believe that is what it is) after the closing ?> When viewing these > files in a windows GUI editor, there is an extra line after the ?> > closing tag. Using the php function headers_sent(), doesn't show that > there is any output being created by these extra lines after closing > ?> > > So is "white space" only physical space (\s) or can it be anything > like \t \r \n??? This is a feature/bug of PHP, depending on your perspective. When a closing ?> is followed by a newline, the newline is not output. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp --- End Message --- --- Begin Message --- On Sat, 2003-11-15 at 12:12, Chris Shiflett wrote: > --- Gerard Samuel <[EMAIL PROTECTED]> wrote: > > Most of the time, I edit files via the command line, (FBSD). When > > the files are saved, it adds a \n (newline) character (at least I > > believe that is what it is) after the closing ?> When viewing these > > files in a windows GUI editor, there is an extra line after the ?> > > closing tag. Using the php function headers_sent(), doesn't show that > > there is any output being created by these extra lines after closing > > ?> > > > > So is "white space" only physical space (\s) or can it be anything > > like \t \r \n??? > > This is a feature/bug of PHP, depending on your perspective. When a > closing ?> is followed by a newline, the newline is not output. FYI, if you're woprried about the "header cannot be sent due to output..." error, then if your file only has code and no HTML, then you can omit the ?> tag at the end of your script. This solves countless issues with there being a space, a tab, a newline, or any whitespace after the closing tag. Cheers, Rob. -- .. | InterJinn Application Framework - h
Re: [PHP] Include an encoder into PHP distribution?
> Anyway, I don't think Zend people will allow a competing extension be > included in the core PHP distribution precisely because it compromises > their business. This is exactly the reason I started this thread by asking "Who controls PHP?" ... Thanks for clearing this out. > Either way, another problem of Turck is that it uses a GPL license. Most > people do not understand that GPL software is not really free for the > users despite what it is advertised. Yes, a good point. I could suggest that they change the license Lesser GPL, but of course I don't know how it goes (I don't have any connections to Turck people). I had to verify that it is really GPL, and it seems so. JS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include an encoder into PHP distribution?
Hello, On 11/15/2003 03:24 PM, John Smith wrote: Ok then, that's nice to hear. How about then the idea of including a reasonably good compiler/encoder into standard PHP distribution? For example Turck MMcache is one, gpl'd and comes as a php/zend extension. I don't think there are other free encoders as this, so there wouldn't even be a dispute over which to choose? The right place for you to discuss that is [EMAIL PROTECTED] (aka php-dev) as it is where most core developers hang out. Anyway, I don't think Zend people will allow a competing extension be included in the core PHP distribution precisely because it compromises their business. At most, they will not object to be included in PECL extension repository as PECL extensions are not shipped with standard PHP distribution. Either way, another problem of Turck is that it uses a GPL license. Most people do not understand that GPL software is not really free for the users despite what it is advertised. There are restrictions in the GPL license that prevent the software that uses it to be linked with other software without imposing license contamination, ie, software based on GPL license becomes GPL. This is incompatible with PHP and Apache licenses which are BSD based. Unlike GPL, BSD like licenses are really free for the users. So, linking PHP or Apache with GPL license would make them less free. Most people do not understand this licensing thing very well because they confuse free as in gratis which is what Apache, PHP and others with BSD like licenses, with strictly conditional free of the GPL software. IMHO, if you really want to make software free without confusion, forget GPL. -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't fetch HTTP POST data in PHP?
Here is j2me code snippet: byte[] postData="This is my test line! It works! Yipi-Yai-Yee!!!".getBytes(); try{ c = (HttpConnection)Connector.open(url_post); c.setRequestMethod(HttpConnection.POST); c.setRequestProperty( "User-Agent", "Profile/MIDP-1.0 Configuration/CLDC-1.0" ); c.setRequestProperty( "Content-Language", "en-US" ); c.setRequestProperty( "Content-Type", "text/plain"); c.setRequestProperty( "Connection", "close"); c.setRequestProperty( "Content-Disposition","attachment; name=\"userfile\"; filename=\"userfile_txt\""); c.setRequestProperty( "Content-Length", Integer.toString( postData.length ) ); os = c.openOutputStream(); os.write( postData ); os.close(); os = null; Here is PHP code snippet: //Here I see HTTP method, and response is POST : echo $_SERVER['REQUEST_METHOD']; : : // Show any post vars, but nothing shows - never! if(count($_POST)>0){ echo "POST".$new_line; print_r($_POST); echo $new_line; } : // try with upload files array if(count($_FILES)>0){ echo "FILES".$new_line; print_r($_FILES); echo $new_line; } That's it. Greetings, Ivan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can't fetch HTTP POST data in PHP?
Hello, On 11/15/2003 06:54 PM, Ivan Marenic wrote: Any idea why? I am sending HTTP post request from j2me mobile device. Request is OK because it works well on ASP page. You may want to try this class to submit HTTP request. See the test_http_post.php example script: http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't fetch HTTP POST data in PHP?
--- Ivan Marenic <[EMAIL PROTECTED]> wrote: > Any idea why? > > I am sending HTTP post request from j2me mobile device. > > Request is OK because it works well on ASP page. You have to provide some information if you want anyone to help you. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Alternet row colors
Well, first of all Ill just scrap you script since this one is so easy its better to do it from scratch. OK, somewhere in your script you have the code that accually aoutputs the tables you are working with. Im refferring to lines here, and Im meaning the bottom of this document which is the scipt you posted, and I have numbered the lines. Overview of your script. Line 5 - we print out the table header Line 11 - 23 is the loop which prints out all the lines, or rows. Line 24 closes the table. So what we have to do? First we need to declare the values we want to use as backround colours, lets use logical names : (fig a) $backcolor1="#fafafa"; $backcolor2="#c0c0c0"; $backcolor=$backcolor1;// we assign color 1 This code has to be written before the loop starts, so somewhere before line 11. In the loop (11-23) we need to switch between the colours where we write the colour of the . So we write something like : (fig b) echo ''; // continue with the rest of here // which is -> your code. This will print out the first background color, nice. Now we need it to switch color, so we need to add a little logic. This will be inserted right before the loop ends (infact, you can put it where ever you like aslong as its in the loop). (fig c) if($backcolor=backcolor1) $backcolor=$backcolor2; else $backcolor=$backcolor1; As you see above the logic is quite simple, if the color is 1 -> we set it to 2, else we set it to 1. If you think of it, if you process this logic over and over again you will infact get 1, 2, 1, 2, 1, 2, 1, 2 all the time, :) Nice! There you have it, and I hope you got the hang of it. To take your code and implement my colorswither all you need to do is, 1. On line 21 replace #00 width $backcolor 2. Insert the logic (figc), all lines, into line 19 3. Place fig a in line 4. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- The code for return the top ten result is : 1 $result = mysql_query("SELECT * FROM albums where id <15"); 2 3 $Count = @mysql_num_rows($result); 4 5 echo "\n"; 7echo "IDARTISTTITLELABELPRICE\n"; 10 11 for ($count = 0; $count < $Count; $count++) { 12 // Extract post details from database 13$myrow = mysql_fetch_array($result); 14 $id = $myrow ['id']; 15 $artist = $myrow ['artist']; 16 $title = $myrow ['title']; 17 $label = $myrow ['label']; 18 $price = $myrow ['price']; 19 20 printf("$id$artist$title$label 22£$price\n"); 23} 24 echo "\n"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Storing images
--- Kim Steinhaug <[EMAIL PROTECTED]> wrote: > Well as far as I can see you have 2 options. > > a) Store them directly on disc > b) Store them in a database (eg. mySQL) > > I would think that a) is the best way without doubt I usually take this option myself, but when you are creating an application to run on a large cluster of servers, option b is the better choice in many cases. It eliminates having to maintain server affininty with your load balancer or having to replicate the data among all the servers. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't fetch HTTP POST data in PHP?
Any idea why? I am sending HTTP post request from j2me mobile device. Request is OK because it works well on ASP page. Thanks for help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Storing images
Well as far as I can see you have 2 options. a) Store them directly on disc b) Store them in a database (eg. mySQL) I would think that a) is the best way without doubt, since it doest use any extra processing power to serve the images to your visitors as its only the webserver doing the usuall stuff. The b) option has a better advantage regarding the backup function, as its easier backuping a database than backing up a directory with scripts anyway. (Unless you are thinking FTP, but right now im thinking automatied scripts) On the otehr hand I have succesfully installed ZIP ability with PHP, which makes backing up directories no problem. So all in all it depends on where you stand if you know what I mean. The database sollution puts extra demand on the database as it constantly has to query the database to get the images all the time. So if you are thinking about the health of your server, and how quick you want your site to accessible for your visitors I would stick to a) I dont think it good practise to store images into the database either. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Paul Marinas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Hi, i was wondering which is the best way to store images. I'm using an > upload section for my site and i'm using a script to put those images > from the upload section on a diferent section of the site. > > 10x > Paul > GnuPG Key http://sgi.rdscv.ro/~paulm/paulm.PGP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who controls PHP?
John Nichel wrote: Chris Shiflett wrote: --- John Smith <[EMAIL PROTECTED]> wrote: >> Please, tell me that Zend is not the dictator here. No one is a dictator. Chris So there is an opening for a dictator then? How can I get my name on the ballot? ;) I am the only dictator here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is "white space"
On Sat, 2003-11-15 at 12:12, Chris Shiflett wrote: > --- Gerard Samuel <[EMAIL PROTECTED]> wrote: > > Most of the time, I edit files via the command line, (FBSD). When > > the files are saved, it adds a \n (newline) character (at least I > > believe that is what it is) after the closing ?> When viewing these > > files in a windows GUI editor, there is an extra line after the ?> > > closing tag. Using the php function headers_sent(), doesn't show that > > there is any output being created by these extra lines after closing > > ?> > > > > So is "white space" only physical space (\s) or can it be anything > > like \t \r \n??? > > This is a feature/bug of PHP, depending on your perspective. When a > closing ?> is followed by a newline, the newline is not output. FYI, if you're woprried about the "header cannot be sent due to output..." error, then if your file only has code and no HTML, then you can omit the ?> tag at the end of your script. This solves countless issues with there being a space, a tab, a newline, or any whitespace after the closing tag. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who controls PHP?
Chris Shiflett wrote: --- John Smith <[EMAIL PROTECTED]> wrote: >> Please, tell me that Zend is not the dictator here. No one is a dictator. Chris So there is an opening for a dictator then? How can I get my name on the ballot? ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include an encoder into PHP distribution?
Hey, Or CodeSecure from http://securecents.com Cheers, -Ryan P.S - biased opinion as i work with them. > Ok then, that's nice to hear. > > How about then the idea of including a reasonably good compiler/encoder into > standard PHP distribution? For example Turck MMcache is one, gpl'd and comes > as a php/zend extension. > > I don't think there are other free encoders as this, so there wouldn't even > be a dispute over which to choose? > > -- > 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] Include an encoder into PHP distribution?
On Sat, Nov 15, 2003 at 11:58:18AM -0600, Eugene Lee wrote: > On Sat, Nov 15, 2003 at 07:52:28PM +0200, John Smith wrote: > : > : I have no connection to Turck MMcache in any way than just a user who needs > : it. But distributing software encoded with it is difficult while it is not > : so easily available (have to be separately downloaded and installed). > > I'm still having problems getting Turck MMcache to work on FreeBSD. > It looks like the configure script is Linux-centric. That's a bit of a > minus when it comes to distributing software across multiple platforms. I've successfully installed turck-mmcache-2.4.6 from FreeBSD Ports collection. cd /usr/ports/www/turck-mmcache/ make install -- zhuravlev alexander u l s t u n o c ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Storing images
Interesting that you should bring this up now :) I have started a thread about this with my opinion at : http://www.weberblog.com/article.php?story=20031115124356140 I hope people will share their experience. Sincerely berber Visit http://www.weberdev.com/ & http://www.weberblog.com/ Today!!! To see where PHP might take you tomorrow. Share your code : http://addexample.weberdev.com Search for PHP Code from your browser http://toolbar.weberdev.com Share your thoughts : http://www.weberblog.com/submit.php?type=story&topic=PHP_Web_Logs -Original Message- From: Paul Marinas [mailto:[EMAIL PROTECTED] Sent: Saturday, November 15, 2003 7:54 PM To: [EMAIL PROTECTED] Subject: [PHP] Storing images Hi, i was wondering which is the best way to store images. I'm using an upload section for my site and i'm using a script to put those images from the upload section on a diferent section of the site. 10x Paul GnuPG Key http://sgi.rdscv.ro/~paulm/paulm.PGP -- 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] Include an encoder into PHP distribution?
Yes, it's still quite a new piece of software, at least so I have understood. But anyway, as an idea for the future. Just about any encoder would be great. If it's really built-in, always-on, that would be even better. Besides encoding, I think code profiling features should be (almost) built in too. "Eugene Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sat, Nov 15, 2003 at 07:52:28PM +0200, John Smith wrote: > : > : I have no connection to Turck MMcache in any way than just a user who needs > : it. But distributing software encoded with it is difficult while it is not > : so easily available (have to be separately downloaded and installed). > > I'm still having problems getting Turck MMcache to work on FreeBSD. > It looks like the configure script is Linux-centric. That's a bit of a > minus when it comes to distributing software across multiple platforms. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include an encoder into PHP distribution?
On Sat, Nov 15, 2003 at 07:52:28PM +0200, John Smith wrote: : : I have no connection to Turck MMcache in any way than just a user who needs : it. But distributing software encoded with it is difficult while it is not : so easily available (have to be separately downloaded and installed). I'm still having problems getting Turck MMcache to work on FreeBSD. It looks like the configure script is Linux-centric. That's a bit of a minus when it comes to distributing software across multiple platforms. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include an encoder into PHP distribution?
> > I don't think there are other free encoders as this, so there wouldn't > > even be a dispute over which to choose? > > Which one should be chosen? Doesn't it seem a bit ridiculous for the PHP > development team to be picking a winner? Open source is all about choice, > in my opinion. > > If I had to choose a winner, personally, I wouldn't pick your choice > anyway: > > http://apc.communityconnect.com/ Yes, but, I don't think APC, while a good cacher, has the source code protecting (encoding into opcode code) feature? There is the Ioncobe encoder, Zend encoder and Turck that I know of. Of course any of them would suit me (just one opinion while everyone has one), but Turck is the only free one *I* know of. Well, if there is going to be a winner comtest, maybe Ioncube or Zend wants to join it, I don't know. -JS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Storing images
Hi, i was wondering which is the best way to store images. I'm using an upload section for my site and i'm using a script to put those images from the upload section on a diferent section of the site. 10x Paul GnuPG Key http://sgi.rdscv.ro/~paulm/paulm.PGP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include an encoder into PHP distribution?
I think Zend even has their business model partly in the encoder software, there must be some need for it. Don't you think so? Granted, this would increase the size of the download by a hundred kilobytes. I have no connection to Turck MMcache in any way than just a user who needs it. But distributing software encoded with it is difficult while it is not so easily available (have to be separately downloaded and installed). Don't you think that this kind of functionality would be good for *PHP language* in general, in many ways? It would encourage some people to adopt PHP in the first place and not think of alternatives which offer this by default. And of course this kind of software increases the performance too, while it has the caching functionality as well. -JS > "Nathan Taylor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Well that's all good and grand but why increase the size of the distribution when it's not necessary to? Nobody wants to download something > they don't necessarily need included. > Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include an encoder into PHP distribution?
--- John Smith <[EMAIL PROTECTED]> wrote: > How about then the idea of including a reasonably good > compiler/encoder into standard PHP distribution? For example Turck > MMcache is one, gpl'd and comes as a php/zend extension. > > I don't think there are other free encoders as this, so there wouldn't > even be a dispute over which to choose? Which one should be chosen? Doesn't it seem a bit ridiculous for the PHP development team to be picking a winner? Open source is all about choice, in my opinion. If I had to choose a winner, personally, I wouldn't pick your choice anyway: http://apc.communityconnect.com/ Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strtotime bad logic or strtotime bug?
--- Gnik <[EMAIL PROTECTED]> wrote: > I isolated the problem to be in the 'strtotime' function. Here is a > test I ran - when it runs, after getting to 2003-10-26, it scrolls > incessently: > > BEGIN CODE-- > $stop= "2003-12-27" ; > $start= "2003-01-01" ; > While ($start <> $stop) { > echo " Date: " . $start ; > $start = date('Y-m-d', strtotime($start) + 86400); > } > ?> > END CODE-- Your approach makes me wonder why you are bothering to convert between timestamps and formatted dates so many times. It makes much more sense to use timestamps for conditionals and math, and use date() only in your echo statement. As for your particular error, I'm sure you could easily find it with just a few minutes of debugging. For example, output the value of $start and $stop at the beginning and very end of each loop. Also, you might want to use != for not equal. From the manual (http://www.php.net/manual/en/language.expressions.php): PHP supports > (bigger than), >= (bigger than or equal to), == (equal), != (not equal), < (smaller than) and <= (smaller than or equal to). These expressions are most commonly used inside conditional execution, such as if statements. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include an encoder into PHP distribution?
Well that's all good and grand but why increase the size of the distribution when it's not necessary to? Nobody wants to download something they don't necessarily need included. Nathan - Original Message - From: John Smith To: [EMAIL PROTECTED] Sent: Saturday, November 15, 2003 12:24 PM Subject: Re: [PHP] Include an encoder into PHP distribution? Ok then, that's nice to hear. How about then the idea of including a reasonably good compiler/encoder into standard PHP distribution? For example Turck MMcache is one, gpl'd and comes as a php/zend extension. I don't think there are other free encoders as this, so there wouldn't even be a dispute over which to choose? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include an encoder into PHP distribution?
Ok then, that's nice to hear. How about then the idea of including a reasonably good compiler/encoder into standard PHP distribution? For example Turck MMcache is one, gpl'd and comes as a php/zend extension. I don't think there are other free encoders as this, so there wouldn't even be a dispute over which to choose? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who controls PHP?
Hello, Zend in no way dictates PHP, they are simply a major player in it's development and are just as important as the PHP community. Zend develops much of the core extensions for PHP but at the same time, they do not own or even run. Nathan - Original Message - From: John Smith To: [EMAIL PROTECTED] Sent: Saturday, November 15, 2003 11:59 AM Subject: [PHP] Who controls PHP? Hi, Please, can someone shed a little light on this subject: who controls PHP? How much Zend has the power to say what goes into PHP and what not? How much does the "community" actually have power? For example, there are practical reasons why one should be concerned about this: PHP doesn't have an opcode compiler/loader built in. I find this quite frustrating to have to use some additional software to do that, which for example Java and Python has built-in. Please, tell me that Zend is not the dictator here. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who controls PHP?
--- John Smith <[EMAIL PROTECTED]> wrote: > Please, can someone shed a little light on this subject: who controls > PHP? PHP is open source. You should have received the license when you downloaded it. It is not something to be controlled. > Please, tell me that Zend is not the dictator here. No one is a dictator. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is "white space"
--- Gerard Samuel <[EMAIL PROTECTED]> wrote: > Most of the time, I edit files via the command line, (FBSD). When > the files are saved, it adds a \n (newline) character (at least I > believe that is what it is) after the closing ?> When viewing these > files in a windows GUI editor, there is an extra line after the ?> > closing tag. Using the php function headers_sent(), doesn't show that > there is any output being created by these extra lines after closing > ?> > > So is "white space" only physical space (\s) or can it be anything > like \t \r \n??? This is a feature/bug of PHP, depending on your perspective. When a closing ?> is followed by a newline, the newline is not output. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Who controls PHP?
Hi, Please, can someone shed a little light on this subject: who controls PHP? How much Zend has the power to say what goes into PHP and what not? How much does the "community" actually have power? For example, there are practical reasons why one should be concerned about this: PHP doesn't have an opcode compiler/loader built in. I find this quite frustrating to have to use some additional software to do that, which for example Java and Python has built-in. Please, tell me that Zend is not the dictator here. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alternet row colors
On Sat, Nov 15, 2003 at 06:09:18PM +0200, Boaz Yahav wrote: > > function alternate_rows( > // color_1 and color_2 have default values, but can be over-ridden. > $data, > $color_1 = '#99', > $color_2 = 'black' > ) > { > // Declare $color as static so it retains its value when program // execution leaves > the local function's scope. > static $color; > > // Set the color to that's not currently set. > if ( $color == $color_1 ) > { > $color = $color_2; > } > else > { > $color = $color_1; > } > > echo '' . $data . ''; } > > I have tried a few was of implamenting this into my current php code but i have had > no luck :( > > > Could some one help me with this please :) > If you check the website and click "top ten" > http://thor.ancilenetworks.co.uk/~pferrie/vinrev/index2.htm > > > The code for return the top ten result is : > $result = mysql_query("SELECT * FROM albums where id <15"); > > $Count = @mysql_num_rows($result); > > echo "\n"; > echo "IDARTIST bgcolor='#66'>TITLELABEL bgcolor='#66'>PRICE\n"; > > for ($count = 0; $count < $Count; $count++) { > // Extract post details from database > $myrow = mysql_fetch_array($result); > $id = $myrow ['id']; >$artist = $myrow ['artist']; > $title = $myrow ['title']; > $label = $myrow ['label']; > $price = $myrow ['price']; > replace > printf(" bgcolor='#00'>$id$artist$title$label > ?$price\n"); with echo ''.$id.''.$artist.''.$title.''.$label.''.$price."\n"; > } > echo "\n"; > > ?> > -- zhuravlev alexander u l s t u n o c ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alternet row colors
Thats pretty much what i have got off www.hotscripts.com. The problem is adding it to my exsisting code. ~cheers Paul "Boaz Yahav" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] You can also check : A PHP function To Make Alternative Colored table rows http://www.weberdev.com/get_example.php3?count=3609 Alternating background color for HTML table rows http://www.weberdev.com/get_example.php3?count=3482 Another way to alternate table rows http://www.weberdev.com/get_example.php3?count=1832 How to display any array in several rows and columns of a table. Not just in one column or in alternate rows. This example shows a nice color table generated with PHP, but can be used with any array values(e.g. Database) http://www.weberdev.com/get_example.php3?count=1761 HTML Table with random alternating colours, helps you see what you colour options are. http://www.weberdev.com/get_example.php3?count=1555 Sincerely berber Visit http://www.weberdev.com/ & http://www.weberblog.com/ Today!!! To see where PHP might take you tomorrow. Share your code : http://addexample.weberdev.com Search for PHP Code from your browser http://toolbar.weberdev.com Share your thoughts : http://www.weberblog.com/submit.php?type=story&topic=PHP_Web_Logs -Original Message- From: PAUL FERRIE [mailto:[EMAIL PROTECTED] Sent: Saturday, November 15, 2003 5:46 PM To: [EMAIL PROTECTED] Subject: [PHP] Alternet row colors Hello all I have been working on this website http://thor.ancilenetworks.co.uk/~pferrie/vinrev/index2.htm I did not design the site i have just been asked to tweak it My php knowledge is limited always learning something new. Anyways I have been trying to use a code that i got from www.hotscripts.com the scipts retutns alternet rows colors for information sent back from the database when displayed in the broswer. Here is the script: //--- function alternate_rows( // color_1 and color_2 have default values, but can be over-ridden. $data, $color_1 = '#99', $color_2 = 'black' ) { // Declare $color as static so it retains its value when program // execution leaves the local function's scope. static $color; // Set the color to that's not currently set. if ( $color == $color_1 ) { $color = $color_2; } else { $color = $color_1; } echo '' . $data . ''; } I have tried a few was of implamenting this into my current php code but i have had no luck :( Could some one help me with this please :) If you check the website and click "top ten" http://thor.ancilenetworks.co.uk/~pferrie/vinrev/index2.htm The code for return the top ten result is : $result = mysql_query("SELECT * FROM albums where id <15"); $Count = @mysql_num_rows($result); echo "\n"; echo "IDARTISTTITLELABELPRICE\n"; for ($count = 0; $count < $Count; $count++) { // Extract post details from database $myrow = mysql_fetch_array($result); $id = $myrow ['id']; $artist = $myrow ['artist']; $title = $myrow ['title']; $label = $myrow ['label']; $price = $myrow ['price']; printf("$id$artist$title$label £$price\n"); } echo "\n"; ?> Cheers Paul -- 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] Alternet row colors
You can also check : A PHP function To Make Alternative Colored table rows http://www.weberdev.com/get_example.php3?count=3609 Alternating background color for HTML table rows http://www.weberdev.com/get_example.php3?count=3482 Another way to alternate table rows http://www.weberdev.com/get_example.php3?count=1832 How to display any array in several rows and columns of a table. Not just in one column or in alternate rows. This example shows a nice color table generated with PHP, but can be used with any array values(e.g. Database) http://www.weberdev.com/get_example.php3?count=1761 HTML Table with random alternating colours, helps you see what you colour options are. http://www.weberdev.com/get_example.php3?count=1555 Sincerely berber Visit http://www.weberdev.com/ & http://www.weberblog.com/ Today!!! To see where PHP might take you tomorrow. Share your code : http://addexample.weberdev.com Search for PHP Code from your browser http://toolbar.weberdev.com Share your thoughts : http://www.weberblog.com/submit.php?type=story&topic=PHP_Web_Logs -Original Message- From: PAUL FERRIE [mailto:[EMAIL PROTECTED] Sent: Saturday, November 15, 2003 5:46 PM To: [EMAIL PROTECTED] Subject: [PHP] Alternet row colors Hello all I have been working on this website http://thor.ancilenetworks.co.uk/~pferrie/vinrev/index2.htm I did not design the site i have just been asked to tweak it My php knowledge is limited always learning something new. Anyways I have been trying to use a code that i got from www.hotscripts.com the scipts retutns alternet rows colors for information sent back from the database when displayed in the broswer. Here is the script: //--- function alternate_rows( // color_1 and color_2 have default values, but can be over-ridden. $data, $color_1 = '#99', $color_2 = 'black' ) { // Declare $color as static so it retains its value when program // execution leaves the local function's scope. static $color; // Set the color to that's not currently set. if ( $color == $color_1 ) { $color = $color_2; } else { $color = $color_1; } echo '' . $data . ''; } I have tried a few was of implamenting this into my current php code but i have had no luck :( Could some one help me with this please :) If you check the website and click "top ten" http://thor.ancilenetworks.co.uk/~pferrie/vinrev/index2.htm The code for return the top ten result is : $result = mysql_query("SELECT * FROM albums where id <15"); $Count = @mysql_num_rows($result); echo "\n"; echo "IDARTISTTITLELABELPRICE\n"; for ($count = 0; $count < $Count; $count++) { // Extract post details from database $myrow = mysql_fetch_array($result); $id = $myrow ['id']; $artist = $myrow ['artist']; $title = $myrow ['title']; $label = $myrow ['label']; $price = $myrow ['price']; printf("$id$artist$title$label £$price\n"); } echo "\n"; ?> Cheers Paul -- 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] Alternet row colors
Hello all I have been working on this website http://thor.ancilenetworks.co.uk/~pferrie/vinrev/index2.htm I did not design the site i have just been asked to tweak it My php knowledge is limited always learning something new. Anyways I have been trying to use a code that i got from www.hotscripts.com the scipts retutns alternet rows colors for information sent back from the database when displayed in the broswer. Here is the script: //--- function alternate_rows( // color_1 and color_2 have default values, but can be over-ridden. $data, $color_1 = '#99', $color_2 = 'black' ) { // Declare $color as static so it retains its value when program // execution leaves the local function's scope. static $color; // Set the color to that's not currently set. if ( $color == $color_1 ) { $color = $color_2; } else { $color = $color_1; } echo '' . $data . ''; } I have tried a few was of implamenting this into my current php code but i have had no luck :( Could some one help me with this please :) If you check the website and click "top ten" http://thor.ancilenetworks.co.uk/~pferrie/vinrev/index2.htm The code for return the top ten result is : $result = mysql_query("SELECT * FROM albums where id <15"); $Count = @mysql_num_rows($result); echo "\n"; echo "IDARTISTTITLELABELPRICE\n"; for ($count = 0; $count < $Count; $count++) { // Extract post details from database $myrow = mysql_fetch_array($result); $id = $myrow ['id']; $artist = $myrow ['artist']; $title = $myrow ['title']; $label = $myrow ['label']; $price = $myrow ['price']; printf("$id$artist$title$label £$price\n"); } echo "\n"; ?> Cheers Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using $_SERVER
Whats your take on adding your own data in the $_SERVER array? For example, if I wanted to add a value to the $_SERVER array like -> $_SERVER['foo'] = 'bar'; Yes its possible, but Im looking for "legality" issues with this frame of thought. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What is "white space"
Most of the time, I edit files via the command line, (FBSD). When the files are saved, it adds a \n (newline) character (at least I believe that is what it is) after the closing ?> When viewing these files in a windows GUI editor, there is an extra line after the ?> closing tag. Using the php function headers_sent(), doesn't show that there is any output being created by these extra lines after closing ?> So is "white space" only physical space (\s) or can it be anything like \t \r \n??? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CGI error when loading iFRAME
Miroslav I. wrote: Hi, people #The problem: There is an error message that stops proper loading of one iFRAME, I couldn't understand what is the problem. Complete error message issued: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:<< ###Additional: PHP Version 4.3.3 is running on Windows 2000 server This is a common problem with php on iis, google for the error string to get possible solutions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] msession - giving me a hard time
John W. Holmes wrote: Heh... okay, let's start over. From Server1: If you create a link like this: Server 2 The problem with SID is that it is defined as session_name=session_id if the client did not send session cookie. Otherwise it will be an empty string. So the proper way is Server 2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php